2010-05-06 04:18:01 -07:00
|
|
|
#ifndef CAMERAIMAGE_H
|
|
|
|
#define CAMERAIMAGE_H
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
#include <QString>
|
|
|
|
#include <zxing/LuminanceSource.h>
|
|
|
|
|
|
|
|
using namespace zxing;
|
|
|
|
|
|
|
|
class CameraImageWrapper : public LuminanceSource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CameraImageWrapper();
|
2011-12-16 10:51:48 -08:00
|
|
|
CameraImageWrapper(QImage& image);
|
2010-05-06 04:18:01 -07:00
|
|
|
CameraImageWrapper(CameraImageWrapper& otherInstance);
|
|
|
|
~CameraImageWrapper();
|
|
|
|
|
2010-05-06 13:19:38 -07:00
|
|
|
int getWidth() const;
|
|
|
|
int getHeight() const;
|
2010-05-06 04:18:01 -07:00
|
|
|
|
2010-05-06 13:19:38 -07:00
|
|
|
unsigned char getPixel(int x, int y) const;
|
|
|
|
unsigned char* copyMatrix() const;
|
2010-05-06 04:18:01 -07:00
|
|
|
|
2010-05-06 13:19:38 -07:00
|
|
|
void setImage(QString fileName);
|
2010-05-06 04:18:01 -07:00
|
|
|
void setImage(QImage newImage);
|
|
|
|
QImage grayScaleImage(QImage::Format f);
|
|
|
|
QImage getOriginalImage();
|
2011-09-19 03:32:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
// Callers take ownership of the returned memory and must call delete [] on it themselves.
|
|
|
|
unsigned char* getRow(int y, unsigned char* row);
|
|
|
|
unsigned char* getMatrix();
|
2010-05-06 04:18:01 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
QImage image;
|
2011-09-19 03:32:17 -07:00
|
|
|
unsigned char* pRow;
|
|
|
|
unsigned char* pMatrix;
|
2010-05-06 04:18:01 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //CAMERAIMAGE_H
|