forked from ftylitak/qzxing
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CameraImageWrapper.h
47 lines (35 loc) · 1.14 KB
/
CameraImageWrapper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CAMERAIMAGE_H
#define CAMERAIMAGE_H
#include <QImage>
#include <QString>
#include <zxing/LuminanceSource.h>
using namespace zxing;
class CameraImageWrapper : public LuminanceSource
{
public:
CameraImageWrapper();
CameraImageWrapper(QImage& image);
CameraImageWrapper(CameraImageWrapper& otherInstance);
~CameraImageWrapper();
int getWidth() const;
int getHeight() const;
unsigned char getPixel(int x, int y) const;
unsigned char* copyMatrix() const;
/**
* Set the source of the image. If it fails, returns false.
*/
bool setImage(QString fileName);
bool setImage(QImage newImage);
QImage grayScaleImage(QImage::Format f);
QImage getOriginalImage();
// 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();
void setSmoothTransformation(bool enable);
private:
QImage image;
unsigned char* pRow;
unsigned char* pMatrix;
bool isSmoothTransformationEnabled;
};
#endif //CAMERAIMAGE_H