| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ | 7 #ifndef CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ |
| 8 #define CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ | 8 #define CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ |
| 9 | 9 |
| 10 #include "core/fxcodec/jbig2/JBig2_Define.h" | 10 #include "core/fxcodec/jbig2/JBig2_Define.h" |
| 11 | 11 |
| 12 struct FX_RECT; |
| 13 |
| 12 enum JBig2ComposeOp { | 14 enum JBig2ComposeOp { |
| 13 JBIG2_COMPOSE_OR = 0, | 15 JBIG2_COMPOSE_OR = 0, |
| 14 JBIG2_COMPOSE_AND = 1, | 16 JBIG2_COMPOSE_AND = 1, |
| 15 JBIG2_COMPOSE_XOR = 2, | 17 JBIG2_COMPOSE_XOR = 2, |
| 16 JBIG2_COMPOSE_XNOR = 3, | 18 JBIG2_COMPOSE_XNOR = 3, |
| 17 JBIG2_COMPOSE_REPLACE = 4 | 19 JBIG2_COMPOSE_REPLACE = 4 |
| 18 }; | 20 }; |
| 19 | 21 |
| 20 struct FX_RECT; | |
| 21 class CJBig2_Image { | 22 class CJBig2_Image { |
| 22 public: | 23 public: |
| 23 CJBig2_Image(int32_t w, int32_t h); | 24 CJBig2_Image(int32_t w, int32_t h); |
| 24 | |
| 25 CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t* pBuf); | 25 CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t* pBuf); |
| 26 | |
| 27 CJBig2_Image(const CJBig2_Image& im); | 26 CJBig2_Image(const CJBig2_Image& im); |
| 28 | |
| 29 ~CJBig2_Image(); | 27 ~CJBig2_Image(); |
| 30 | 28 |
| 29 int32_t width() const { return m_nWidth; } |
| 30 int32_t height() const { return m_nHeight; } |
| 31 int32_t stride() const { return m_nStride; } |
| 32 |
| 31 FX_BOOL getPixel(int32_t x, int32_t y); | 33 FX_BOOL getPixel(int32_t x, int32_t y); |
| 32 | |
| 33 int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); | 34 int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); |
| 34 | 35 |
| 35 void copyLine(int32_t hTo, int32_t hFrom); | 36 void copyLine(int32_t hTo, int32_t hFrom); |
| 36 | |
| 37 void fill(FX_BOOL v); | 37 void fill(FX_BOOL v); |
| 38 | 38 |
| 39 FX_BOOL composeTo(CJBig2_Image* pDst, | 39 FX_BOOL composeTo(CJBig2_Image* pDst, |
| 40 int32_t x, | 40 int32_t x, |
| 41 int32_t y, | 41 int32_t y, |
| 42 JBig2ComposeOp op); | 42 JBig2ComposeOp op); |
| 43 FX_BOOL composeTo(CJBig2_Image* pDst, | 43 FX_BOOL composeTo(CJBig2_Image* pDst, |
| 44 int32_t x, | 44 int32_t x, |
| 45 int32_t y, | 45 int32_t y, |
| 46 JBig2ComposeOp op, | 46 JBig2ComposeOp op, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 60 int32_t y, | 60 int32_t y, |
| 61 CJBig2_Image* pSrc, | 61 CJBig2_Image* pSrc, |
| 62 JBig2ComposeOp op); | 62 JBig2ComposeOp op); |
| 63 FX_BOOL composeFrom(int32_t x, | 63 FX_BOOL composeFrom(int32_t x, |
| 64 int32_t y, | 64 int32_t y, |
| 65 CJBig2_Image* pSrc, | 65 CJBig2_Image* pSrc, |
| 66 JBig2ComposeOp op, | 66 JBig2ComposeOp op, |
| 67 const FX_RECT* pSrcRect); | 67 const FX_RECT* pSrcRect); |
| 68 | 68 |
| 69 CJBig2_Image* subImage(int32_t x, int32_t y, int32_t w, int32_t h); | 69 CJBig2_Image* subImage(int32_t x, int32_t y, int32_t w, int32_t h); |
| 70 | |
| 71 void expand(int32_t h, FX_BOOL v); | 70 void expand(int32_t h, FX_BOOL v); |
| 72 | 71 |
| 73 public: | |
| 74 int32_t m_nWidth; | |
| 75 | |
| 76 int32_t m_nHeight; | |
| 77 | |
| 78 int32_t m_nStride; | |
| 79 | |
| 80 uint8_t* m_pData; | 72 uint8_t* m_pData; |
| 81 | 73 |
| 82 FX_BOOL m_bNeedFree; | 74 private: |
| 75 int32_t m_nWidth; // 1-bit pixels |
| 76 int32_t m_nHeight; // lines |
| 77 int32_t m_nStride; // bytes |
| 78 bool m_bOwnsBuffer; |
| 83 }; | 79 }; |
| 84 | 80 |
| 85 #endif // CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ | 81 #endif // CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_ |
| OLD | NEW |