Make a bunch of JBig2 classes independent of CJBig2_Object.
[pdfium.git] / core / src / fxcodec / jbig2 / JBig2_Image.h
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  public:
21   CJBig2_Image(int32_t w, int32_t h);
22
23   CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t* pBuf);
24
25   CJBig2_Image(CJBig2_Image& im);
26
27   ~CJBig2_Image();
28
29   FX_BOOL getPixel(int32_t x, int32_t y);
30
31   int32_t setPixel(int32_t x, int32_t y, FX_BOOL v);
32
33   void copyLine(int32_t hTo, int32_t hFrom);
34
35   void fill(FX_BOOL v);
36
37   FX_BOOL composeTo(CJBig2_Image* pDst,
38                     int32_t x,
39                     int32_t y,
40                     JBig2ComposeOp op);
41   FX_BOOL composeTo(CJBig2_Image* pDst,
42                     int32_t x,
43                     int32_t y,
44                     JBig2ComposeOp op,
45                     const FX_RECT* pSrcRect);
46
47   FX_BOOL composeTo_opt2(CJBig2_Image* pDst,
48                          int32_t x,
49                          int32_t y,
50                          JBig2ComposeOp op);
51   FX_BOOL composeTo_opt2(CJBig2_Image* pDst,
52                          int32_t x,
53                          int32_t y,
54                          JBig2ComposeOp op,
55                          const FX_RECT* pSrcRect);
56
57   FX_BOOL composeFrom(int32_t x,
58                       int32_t y,
59                       CJBig2_Image* pSrc,
60                       JBig2ComposeOp op);
61   FX_BOOL composeFrom(int32_t x,
62                       int32_t y,
63                       CJBig2_Image* pSrc,
64                       JBig2ComposeOp op,
65                       const FX_RECT* pSrcRect);
66
67   CJBig2_Image* subImage(int32_t x, int32_t y, int32_t w, int32_t h);
68
69   void expand(int32_t h, FX_BOOL v);
70
71  public:
72   int32_t m_nWidth;
73
74   int32_t m_nHeight;
75
76   int32_t m_nStride;
77
78   uint8_t* m_pData;
79
80   FX_BOOL m_bNeedFree;
81 };
82 #endif