1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _JBIG2_IMAGE_H_ 8 #define _JBIG2_IMAGE_H_ 9 #include "JBig2_Define.h" 10 #include "JBig2_Module.h" 11 typedef enum { 12 JBIG2_COMPOSE_OR = 0, 13 JBIG2_COMPOSE_AND = 1, 14 JBIG2_COMPOSE_XOR = 2, 15 JBIG2_COMPOSE_XNOR = 3, 16 JBIG2_COMPOSE_REPLACE = 4 17 } JBig2ComposeOp; 18 struct FX_RECT; 19 class CJBig2_Image : public CJBig2_Object 20 { 21 public: 22 23 CJBig2_Image(FX_INT32 w, FX_INT32 h); 24 25 CJBig2_Image(FX_INT32 w, FX_INT32 h, FX_INT32 stride, FX_BYTE*pBuf); 26 27 CJBig2_Image(CJBig2_Image &im); 28 29 ~CJBig2_Image(); 30 31 FX_BOOL getPixel(FX_INT32 x, FX_INT32 y); 32 33 FX_INT32 setPixel(FX_INT32 x, FX_INT32 y, FX_BOOL v); 34 35 void copyLine(FX_INT32 hTo, FX_INT32 hFrom); 36 37 void fill(FX_BOOL v); 38 39 FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); 40 FX_BOOL composeTo(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); 41 42 FX_BOOL composeTo_unopt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); 43 44 FX_BOOL composeTo_opt(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); 45 46 FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op); 47 FX_BOOL composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op, const FX_RECT* pSrcRect); 48 49 FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op); 50 FX_BOOL composeFrom(FX_INT32 x, FX_INT32 y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); 51 CJBig2_Image *subImage_unopt(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); 52 53 CJBig2_Image *subImage(FX_INT32 x, FX_INT32 y, FX_INT32 w, FX_INT32 h); 54 55 void expand(FX_INT32 h, FX_BOOL v); 56 public: 57 58 FX_INT32 m_nWidth; 59 60 FX_INT32 m_nHeight; 61 62 FX_INT32 m_nStride; 63 64 FX_BYTE *m_pData; 65 66 FX_BOOL m_bNeedFree; 67 }; 68 #endif 69