#ifndef _QCamFrame_hpp_ #define _QCamFrame_hpp_ #include #include #include #include #include #include class QImage; using namespace std; enum ImageMode { YuvFrame, GreyFrame, /* GR BG */ RawRgbFrame1, /* RG GB */ RawRgbFrame2, /* BG GR */ RawRgbFrame3, /* GB RG */ RawRgbFrame4, }; /*** to not be used */ class QCamFrameCommon { protected: QCamFrameCommon(ImageMode mode): mode_(mode) { init(); //cout << "new()="< properties_; }; class QCamFrame { public: QCamFrame(ImageMode mode=YuvFrame); QCamFrame(const QCamFrame& other); QCamFrame & operator=(const QCamFrame & other); ~QCamFrame(); const QCamFrameCommon * getCommon() const { return common_; } QCamFrameCommon * setCommon(); const QSize & size() const { return common_->size_;} int ySize() const { return getCommon()->ySize_;} int uSize() const { return getCommon()->uSize_;} int vSize() const { return getCommon()->vSize_;} const unsigned char * Y() const { return getCommon()->Y();} const unsigned char * U() const { return getCommon()->U();} const unsigned char * V() const { return getCommon()->V();} const unsigned char * YLine(int line) const { return getCommon()->YLine(line);} const unsigned char * ULine(int line) const { return getCommon()->ULine(line);} const unsigned char * VLine(int line) const { return getCommon()->VLine(line);} unsigned char * YforUpdate() { return setCommon()->Y();} unsigned char * UforUpdate() { return setCommon()->U();} unsigned char * VforUpdate() { return setCommon()->V();} unsigned char * YforOverwrite(); unsigned char * UforOverwrite(); unsigned char * VforOverwrite(); unsigned char * YLineForUpdate(int line) { return setCommon()->YLine(line);} unsigned char * ULineForUpdate(int line) { return setCommon()->ULine(line);} unsigned char * VLineForUpdate(int line) { return setCommon()->VLine(line);} void setSize(const QSize & s) { if (getCommon()->size_ != s) setCommon()->setSize(s) ;} bool empty() const { return getCommon()->empty(); } void clear() { setCommon()->clear();} const QImage & colorImage() const { return getCommon()->colorImage();} const QImage & grayImage() const { return getCommon()->grayImage();} const QImage & grayImageNegated() const { return getCommon()->grayImageNegated();} const QImage & falseColorImage() const { return getCommon()->falseColorImage();} void copy(const QCamFrame & src, int srcX1,int srcY1, int srcX2,int srcY2, int dstX,int dstY, bool mirrorX=false,bool mirrorY=false); void setMode(ImageMode val) { if (getCommon()->getMode() != val) setCommon()->setMode(val);} ImageMode getMode() const { return getCommon()->getMode();} void rotate(int centerX,int centerY,double angle) {if (angle !=0.0) setCommon()->rotate(centerX,centerY,angle);} const string & getProperty(const string & propName) const { return getCommon()->getProperty(propName);} void exportProperties(map & dest) const; void setAllProperies(const map & src) const; private: QCamFrameCommon * common_; }; #endif