Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
qimagesource.cpp
Go to the documentation of this file.
1 #include "qimagesource.h"
2 #include <QColor>
3 
4 QImageLuminanceSource::QImageLuminanceSource(QImage& _image) : LuminanceSource(_image.width(), _image.height())
5 {
6  image = _image.copy();
7 }
8 
9 
10 ArrayRef<char> QImageLuminanceSource::getRow(int y, ArrayRef<char> _row) const
11 {
12  for (int x = 0; x < this->getWidth(); x++)
13  _row[x] = qGray(image.pixel(x, y));
14  return _row;
15 }
16 
17 ArrayRef<char> QImageLuminanceSource::getMatrix() const
18 {
19  ArrayRef<char> mymatrix(width*height);
20  for (int y = 0; y < height; y++)
21  {
22  for (int x = 0; x < width; x++) {
23  mymatrix[y*width+x] = qGray(image.pixel(x, y));
24  }
25  }
26  return mymatrix;
27 }
28 
ArrayRef< char > getRow(int y, ArrayRef< char > row) const
ArrayRef< char > getMatrix() const
QImageLuminanceSource(QImage &image)
Definition: qimagesource.cpp:4