| 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_INCLUDE_FX_CODEC_H_ | 7 #ifndef CORE_FXCODEC_INCLUDE_FX_CODEC_H_ |
| 8 #define CORE_FXCODEC_INCLUDE_FX_CODEC_H_ | 8 #define CORE_FXCODEC_INCLUDE_FX_CODEC_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "core/fxcodec/codec/ccodec_basicmodule.h" |
| 15 #include "core/fxcodec/codec/ccodec_faxmodule.h" |
| 16 #include "core/fxcodec/codec/ccodec_flatemodule.h" |
| 17 #include "core/fxcodec/codec/ccodec_iccmodule.h" |
| 18 #include "core/fxcodec/codec/ccodec_jbig2module.h" |
| 19 #include "core/fxcodec/codec/ccodec_jpegmodule.h" |
| 20 #include "core/fxcodec/codec/ccodec_jpxmodule.h" |
| 21 #include "core/fxcodec/codec/ccodec_scanlinedecoder.h" |
| 22 #include "core/fxcodec/include/fx_codec_def.h" |
| 14 #include "core/fxcrt/include/fx_basic.h" | 23 #include "core/fxcrt/include/fx_basic.h" |
| 15 #include "core/fxcrt/include/fx_coordinates.h" // For FX_RECT. | 24 #include "core/fxcrt/include/fx_coordinates.h" |
| 16 #include "core/fxcodec/include/fx_codec_def.h" | |
| 17 | 25 |
| 18 class CFX_DIBSource; | 26 class CFX_DIBSource; |
| 19 class CJPX_Decoder; | 27 class CJPX_Decoder; |
| 20 class CPDF_ColorSpace; | 28 class CPDF_ColorSpace; |
| 21 class CPDF_StreamAcc; | 29 class CPDF_StreamAcc; |
| 22 class ICodec_BasicModule; | |
| 23 class ICodec_FaxModule; | |
| 24 class ICodec_FlateModule; | |
| 25 class ICodec_IccModule; | |
| 26 class ICodec_Jbig2Module; | |
| 27 class ICodec_JpegModule; | |
| 28 class ICodec_JpxModule; | |
| 29 class ICodec_ScanlineDecoder; | |
| 30 | 30 |
| 31 #ifdef PDF_ENABLE_XFA | 31 #ifdef PDF_ENABLE_XFA |
| 32 class ICodec_BmpModule; | 32 #include "core/fxcodec/codec/ccodec_bmpmodule.h" |
| 33 class ICodec_GifModule; | 33 #include "core/fxcodec/codec/ccodec_gifmodule.h" |
| 34 class ICodec_PngModule; | 34 #include "core/fxcodec/codec/ccodec_pngmodule.h" |
| 35 class ICodec_ProgressiveDecoder; | 35 #include "core/fxcodec/codec/ccodec_tiffmodule.h" |
| 36 class ICodec_TiffModule; | |
| 37 #endif // PDF_ENABLE_XFA | |
| 38 | 36 |
| 39 #ifdef PDF_ENABLE_XFA | 37 class CCodec_ProgressiveDecoder; |
| 38 |
| 40 class CFX_DIBAttribute { | 39 class CFX_DIBAttribute { |
| 41 public: | 40 public: |
| 42 CFX_DIBAttribute(); | 41 CFX_DIBAttribute(); |
| 43 ~CFX_DIBAttribute(); | 42 ~CFX_DIBAttribute(); |
| 44 | 43 |
| 45 int32_t m_nXDPI; | 44 int32_t m_nXDPI; |
| 46 int32_t m_nYDPI; | 45 int32_t m_nYDPI; |
| 47 FX_FLOAT m_fAspectRatio; | 46 FX_FLOAT m_fAspectRatio; |
| 48 uint16_t m_wDPIUnit; | 47 uint16_t m_wDPIUnit; |
| 49 CFX_ByteString m_strAuthor; | 48 CFX_ByteString m_strAuthor; |
| 50 uint8_t m_strTime[20]; | 49 uint8_t m_strTime[20]; |
| 51 int32_t m_nGifLeft; | 50 int32_t m_nGifLeft; |
| 52 int32_t m_nGifTop; | 51 int32_t m_nGifTop; |
| 53 uint32_t* m_pGifLocalPalette; | 52 uint32_t* m_pGifLocalPalette; |
| 54 uint32_t m_nGifLocalPalNum; | 53 uint32_t m_nGifLocalPalNum; |
| 55 int32_t m_nBmpCompressType; | 54 int32_t m_nBmpCompressType; |
| 56 std::map<uint32_t, void*> m_Exif; | 55 std::map<uint32_t, void*> m_Exif; |
| 57 }; | 56 }; |
| 58 #endif // PDF_ENABLE_XFA | 57 #endif // PDF_ENABLE_XFA |
| 59 | 58 |
| 60 class CCodec_ModuleMgr { | 59 class CCodec_ModuleMgr { |
| 61 public: | 60 public: |
| 62 CCodec_ModuleMgr(); | 61 CCodec_ModuleMgr(); |
| 63 | 62 |
| 64 ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } | 63 CCodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } |
| 65 ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } | 64 CCodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } |
| 66 ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } | 65 CCodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } |
| 67 ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } | 66 CCodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } |
| 68 ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } | 67 CCodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } |
| 69 ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } | 68 CCodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } |
| 70 ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } | 69 CCodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } |
| 71 | 70 |
| 72 #ifdef PDF_ENABLE_XFA | 71 #ifdef PDF_ENABLE_XFA |
| 73 ICodec_ProgressiveDecoder* CreateProgressiveDecoder(); | 72 CCodec_ProgressiveDecoder* CreateProgressiveDecoder(); |
| 74 ICodec_PngModule* GetPngModule() const { return m_pPngModule.get(); } | 73 CCodec_PngModule* GetPngModule() const { return m_pPngModule.get(); } |
| 75 ICodec_GifModule* GetGifModule() const { return m_pGifModule.get(); } | 74 CCodec_GifModule* GetGifModule() const { return m_pGifModule.get(); } |
| 76 ICodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); } | 75 CCodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); } |
| 77 ICodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); } | 76 CCodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); } |
| 78 #endif // PDF_ENABLE_XFA | 77 #endif // PDF_ENABLE_XFA |
| 79 | 78 |
| 80 protected: | 79 protected: |
| 81 std::unique_ptr<ICodec_BasicModule> m_pBasicModule; | 80 std::unique_ptr<CCodec_BasicModule> m_pBasicModule; |
| 82 std::unique_ptr<ICodec_FaxModule> m_pFaxModule; | 81 std::unique_ptr<CCodec_FaxModule> m_pFaxModule; |
| 83 std::unique_ptr<ICodec_JpegModule> m_pJpegModule; | 82 std::unique_ptr<CCodec_JpegModule> m_pJpegModule; |
| 84 std::unique_ptr<ICodec_JpxModule> m_pJpxModule; | 83 std::unique_ptr<CCodec_JpxModule> m_pJpxModule; |
| 85 std::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module; | 84 std::unique_ptr<CCodec_Jbig2Module> m_pJbig2Module; |
| 86 std::unique_ptr<ICodec_IccModule> m_pIccModule; | 85 std::unique_ptr<CCodec_IccModule> m_pIccModule; |
| 87 #ifdef PDF_ENABLE_XFA | |
| 88 std::unique_ptr<ICodec_PngModule> m_pPngModule; | |
| 89 std::unique_ptr<ICodec_GifModule> m_pGifModule; | |
| 90 std::unique_ptr<ICodec_BmpModule> m_pBmpModule; | |
| 91 std::unique_ptr<ICodec_TiffModule> m_pTiffModule; | |
| 92 #endif // PDF_ENABLE_XFA | |
| 93 std::unique_ptr<ICodec_FlateModule> m_pFlateModule; | |
| 94 }; | |
| 95 class ICodec_BasicModule { | |
| 96 public: | |
| 97 virtual ~ICodec_BasicModule() {} | |
| 98 virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, | |
| 99 uint32_t src_size, | |
| 100 uint8_t*& dest_buf, | |
| 101 uint32_t& dest_size) = 0; | |
| 102 virtual FX_BOOL A85Encode(const uint8_t* src_buf, | |
| 103 uint32_t src_size, | |
| 104 uint8_t*& dest_buf, | |
| 105 uint32_t& dest_size) = 0; | |
| 106 virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, | |
| 107 uint32_t src_size, | |
| 108 int width, | |
| 109 int height, | |
| 110 int nComps, | |
| 111 int bpc) = 0; | |
| 112 }; | |
| 113 | |
| 114 class ICodec_ScanlineDecoder { | |
| 115 public: | |
| 116 virtual ~ICodec_ScanlineDecoder() {} | |
| 117 | |
| 118 virtual uint32_t GetSrcOffset() = 0; | |
| 119 | |
| 120 virtual const uint8_t* GetScanline(int line) = 0; | |
| 121 | |
| 122 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; | |
| 123 | |
| 124 virtual int GetWidth() = 0; | |
| 125 | |
| 126 virtual int GetHeight() = 0; | |
| 127 | |
| 128 virtual int CountComps() = 0; | |
| 129 | |
| 130 virtual int GetBPC() = 0; | |
| 131 }; | |
| 132 | |
| 133 class ICodec_FlateModule { | |
| 134 public: | |
| 135 virtual ~ICodec_FlateModule() {} | |
| 136 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | |
| 137 uint32_t src_size, | |
| 138 int width, | |
| 139 int height, | |
| 140 int nComps, | |
| 141 int bpc, | |
| 142 int predictor, | |
| 143 int Colors, | |
| 144 int BitsPerComponent, | |
| 145 int Columns) = 0; | |
| 146 virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW, | |
| 147 const uint8_t* src_buf, | |
| 148 uint32_t src_size, | |
| 149 FX_BOOL bEarlyChange, | |
| 150 int predictor, | |
| 151 int Colors, | |
| 152 int BitsPerComponent, | |
| 153 int Columns, | |
| 154 uint32_t estimated_size, | |
| 155 uint8_t*& dest_buf, | |
| 156 uint32_t& dest_size) = 0; | |
| 157 virtual FX_BOOL Encode(const uint8_t* src_buf, | |
| 158 uint32_t src_size, | |
| 159 int predictor, | |
| 160 int Colors, | |
| 161 int BitsPerComponent, | |
| 162 int Columns, | |
| 163 uint8_t*& dest_buf, | |
| 164 uint32_t& dest_size) = 0; | |
| 165 virtual FX_BOOL Encode(const uint8_t* src_buf, | |
| 166 uint32_t src_size, | |
| 167 uint8_t*& dest_buf, | |
| 168 uint32_t& dest_size) = 0; | |
| 169 }; | |
| 170 class ICodec_FaxModule { | |
| 171 public: | |
| 172 virtual ~ICodec_FaxModule() {} | |
| 173 | |
| 174 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | |
| 175 uint32_t src_size, | |
| 176 int width, | |
| 177 int height, | |
| 178 int K, | |
| 179 FX_BOOL EndOfLine, | |
| 180 FX_BOOL EncodedByteAlign, | |
| 181 FX_BOOL BlackIs1, | |
| 182 int Columns, | |
| 183 int Rows) = 0; | |
| 184 | |
| 185 virtual FX_BOOL Encode(const uint8_t* src_buf, | |
| 186 int width, | |
| 187 int height, | |
| 188 int pitch, | |
| 189 uint8_t*& dest_buf, | |
| 190 uint32_t& dest_size) = 0; | |
| 191 }; | |
| 192 class ICodec_JpegModule { | |
| 193 public: | |
| 194 virtual ~ICodec_JpegModule() {} | |
| 195 | |
| 196 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | |
| 197 uint32_t src_size, | |
| 198 int width, | |
| 199 int height, | |
| 200 int nComps, | |
| 201 FX_BOOL ColorTransform) = 0; | |
| 202 | |
| 203 virtual FX_BOOL LoadInfo(const uint8_t* src_buf, | |
| 204 uint32_t src_size, | |
| 205 int& width, | |
| 206 int& height, | |
| 207 int& num_components, | |
| 208 int& bits_per_components, | |
| 209 FX_BOOL& color_transform, | |
| 210 uint8_t** icc_buf_ptr = NULL, | |
| 211 uint32_t* icc_length = NULL) = 0; | |
| 212 | |
| 213 virtual FX_BOOL Encode(const class CFX_DIBSource* pSource, | |
| 214 uint8_t*& dest_buf, | |
| 215 FX_STRSIZE& dest_size, | |
| 216 int quality = 75, | |
| 217 const uint8_t* icc_buf = NULL, | |
| 218 uint32_t icc_length = 0) = 0; | |
| 219 | |
| 220 virtual void* Start() = 0; | |
| 221 | |
| 222 virtual void Finish(void* pContext) = 0; | |
| 223 | |
| 224 virtual void Input(void* pContext, | |
| 225 const uint8_t* src_buf, | |
| 226 uint32_t src_size) = 0; | |
| 227 | 86 |
| 228 #ifdef PDF_ENABLE_XFA | 87 #ifdef PDF_ENABLE_XFA |
| 229 virtual int ReadHeader(void* pContext, | 88 std::unique_ptr<CCodec_PngModule> m_pPngModule; |
| 230 int* width, | 89 std::unique_ptr<CCodec_GifModule> m_pGifModule; |
| 231 int* height, | 90 std::unique_ptr<CCodec_BmpModule> m_pBmpModule; |
| 232 int* nComps, | 91 std::unique_ptr<CCodec_TiffModule> m_pTiffModule; |
| 233 CFX_DIBAttribute* pAttribute) = 0; | |
| 234 #else // PDF_ENABLE_XFA | |
| 235 virtual int ReadHeader(void* pContext, | |
| 236 int* width, | |
| 237 int* height, | |
| 238 int* nComps) = 0; | |
| 239 #endif // PDF_ENABLE_XFA | 92 #endif // PDF_ENABLE_XFA |
| 240 | 93 |
| 241 virtual int StartScanline(void* pContext, int down_scale) = 0; | 94 std::unique_ptr<CCodec_FlateModule> m_pFlateModule; |
| 242 | |
| 243 virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; | |
| 244 | |
| 245 virtual uint32_t GetAvailInput(void* pContext, | |
| 246 uint8_t** avail_buf_ptr = NULL) = 0; | |
| 247 }; | |
| 248 | |
| 249 class ICodec_JpxModule { | |
| 250 public: | |
| 251 virtual ~ICodec_JpxModule() {} | |
| 252 | |
| 253 virtual CJPX_Decoder* CreateDecoder(const uint8_t* src_buf, | |
| 254 uint32_t src_size, | |
| 255 CPDF_ColorSpace* cs) = 0; | |
| 256 | |
| 257 virtual void GetImageInfo(CJPX_Decoder* pDecoder, | |
| 258 uint32_t* width, | |
| 259 uint32_t* height, | |
| 260 uint32_t* components) = 0; | |
| 261 | |
| 262 virtual bool Decode(CJPX_Decoder* pDecoder, | |
| 263 uint8_t* dest_data, | |
| 264 int pitch, | |
| 265 const std::vector<uint8_t>& offsets) = 0; | |
| 266 | |
| 267 virtual void DestroyDecoder(CJPX_Decoder* pDecoder) = 0; | |
| 268 }; | |
| 269 #ifdef PDF_ENABLE_XFA | |
| 270 class ICodec_PngModule { | |
| 271 public: | |
| 272 virtual ~ICodec_PngModule() {} | |
| 273 | |
| 274 virtual void* Start(void* pModule) = 0; | |
| 275 | |
| 276 virtual void Finish(void* pContext) = 0; | |
| 277 | |
| 278 virtual FX_BOOL Input(void* pContext, | |
| 279 const uint8_t* src_buf, | |
| 280 uint32_t src_size, | |
| 281 CFX_DIBAttribute* pAttribute) = 0; | |
| 282 | |
| 283 FX_BOOL (*ReadHeaderCallback)(void* pModule, | |
| 284 int width, | |
| 285 int height, | |
| 286 int bpc, | |
| 287 int pass, | |
| 288 int* color_type, | |
| 289 double* gamma); | |
| 290 | |
| 291 FX_BOOL (*AskScanlineBufCallback)(void* pModule, int line, uint8_t*& src_buf); | |
| 292 | |
| 293 void (*FillScanlineBufCompletedCallback)(void* pModule, int pass, int line); | |
| 294 }; | |
| 295 class ICodec_GifModule { | |
| 296 public: | |
| 297 virtual ~ICodec_GifModule() {} | |
| 298 | |
| 299 virtual void* Start(void* pModule) = 0; | |
| 300 | |
| 301 virtual void Finish(void* pContext) = 0; | |
| 302 | |
| 303 virtual uint32_t GetAvailInput(void* pContext, | |
| 304 uint8_t** avail_buf_ptr = NULL) = 0; | |
| 305 | |
| 306 virtual void Input(void* pContext, | |
| 307 const uint8_t* src_buf, | |
| 308 uint32_t src_size) = 0; | |
| 309 | |
| 310 virtual int32_t ReadHeader(void* pContext, | |
| 311 int* width, | |
| 312 int* height, | |
| 313 int* pal_num, | |
| 314 void** pal_pp, | |
| 315 int* bg_index, | |
| 316 CFX_DIBAttribute* pAttribute) = 0; | |
| 317 | |
| 318 virtual int32_t LoadFrameInfo(void* pContext, int* frame_num) = 0; | |
| 319 | |
| 320 void (*RecordCurrentPositionCallback)(void* pModule, uint32_t& cur_pos); | |
| 321 | |
| 322 uint8_t* (*AskLocalPaletteBufCallback)(void* pModule, | |
| 323 int32_t frame_num, | |
| 324 int32_t pal_size); | |
| 325 | |
| 326 virtual int32_t LoadFrame(void* pContext, | |
| 327 int frame_num, | |
| 328 CFX_DIBAttribute* pAttribute) = 0; | |
| 329 | |
| 330 FX_BOOL (*InputRecordPositionBufCallback)(void* pModule, | |
| 331 uint32_t rcd_pos, | |
| 332 const FX_RECT& img_rc, | |
| 333 int32_t pal_num, | |
| 334 void* pal_ptr, | |
| 335 int32_t delay_time, | |
| 336 FX_BOOL user_input, | |
| 337 int32_t trans_index, | |
| 338 int32_t disposal_method, | |
| 339 FX_BOOL interlace); | |
| 340 | |
| 341 void (*ReadScanlineCallback)(void* pModule, | |
| 342 int32_t row_num, | |
| 343 uint8_t* row_buf); | |
| 344 }; | |
| 345 class ICodec_BmpModule { | |
| 346 public: | |
| 347 virtual ~ICodec_BmpModule() {} | |
| 348 | |
| 349 virtual void* Start(void* pModule) = 0; | |
| 350 | |
| 351 virtual void Finish(void* pContext) = 0; | |
| 352 | |
| 353 virtual uint32_t GetAvailInput(void* pContext, | |
| 354 uint8_t** avail_buf_ptr = NULL) = 0; | |
| 355 | |
| 356 virtual void Input(void* pContext, | |
| 357 const uint8_t* src_buf, | |
| 358 uint32_t src_size) = 0; | |
| 359 | |
| 360 virtual int32_t ReadHeader(void* pContext, | |
| 361 int32_t* width, | |
| 362 int32_t* height, | |
| 363 FX_BOOL* tb_flag, | |
| 364 int32_t* components, | |
| 365 int* pal_num, | |
| 366 uint32_t** pal_pp, | |
| 367 CFX_DIBAttribute* pAttribute) = 0; | |
| 368 | |
| 369 virtual int32_t LoadImage(void* pContext) = 0; | |
| 370 | |
| 371 FX_BOOL (*InputImagePositionBufCallback)(void* pModule, uint32_t rcd_pos); | |
| 372 | |
| 373 void (*ReadScanlineCallback)(void* pModule, | |
| 374 int32_t row_num, | |
| 375 uint8_t* row_buf); | |
| 376 }; | |
| 377 class ICodec_TiffModule { | |
| 378 public: | |
| 379 virtual ~ICodec_TiffModule() {} | |
| 380 | |
| 381 virtual void* CreateDecoder(IFX_FileRead* file_ptr) = 0; | |
| 382 | |
| 383 virtual void GetFrames(void* ctx, int32_t& frames) = 0; | |
| 384 | |
| 385 virtual FX_BOOL LoadFrameInfo(void* ctx, | |
| 386 int32_t frame, | |
| 387 uint32_t& width, | |
| 388 uint32_t& height, | |
| 389 uint32_t& comps, | |
| 390 uint32_t& bpc, | |
| 391 CFX_DIBAttribute* pAttribute) = 0; | |
| 392 | |
| 393 virtual FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) = 0; | |
| 394 | |
| 395 virtual void DestroyDecoder(void* ctx) = 0; | |
| 396 }; | |
| 397 #endif | |
| 398 | |
| 399 class ICodec_Jbig2Module { | |
| 400 public: | |
| 401 virtual ~ICodec_Jbig2Module() {} | |
| 402 | |
| 403 virtual void* CreateJbig2Context() = 0; | |
| 404 | |
| 405 virtual FXCODEC_STATUS StartDecode(void* pJbig2Context, | |
| 406 CFX_PrivateData* pPrivateData, | |
| 407 uint32_t width, | |
| 408 uint32_t height, | |
| 409 CPDF_StreamAcc* src_stream, | |
| 410 CPDF_StreamAcc* global_stream, | |
| 411 uint8_t* dest_buf, | |
| 412 uint32_t dest_pitch, | |
| 413 IFX_Pause* pPause) = 0; | |
| 414 | |
| 415 virtual FXCODEC_STATUS ContinueDecode(void* pJbig2Content, | |
| 416 IFX_Pause* pPause) = 0; | |
| 417 virtual void DestroyJbig2Context(void* pJbig2Content) = 0; | |
| 418 }; | |
| 419 #ifdef PDF_ENABLE_XFA | |
| 420 class ICodec_ProgressiveDecoder { | |
| 421 public: | |
| 422 virtual ~ICodec_ProgressiveDecoder() {} | |
| 423 | |
| 424 virtual FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, | |
| 425 FXCODEC_IMAGE_TYPE imageType, | |
| 426 CFX_DIBAttribute* pAttribute) = 0; | |
| 427 | |
| 428 virtual FXCODEC_IMAGE_TYPE GetType() const = 0; | |
| 429 virtual int32_t GetWidth() const = 0; | |
| 430 virtual int32_t GetHeight() const = 0; | |
| 431 virtual int32_t GetNumComponents() const = 0; | |
| 432 virtual int32_t GetBPC() const = 0; | |
| 433 | |
| 434 virtual void SetClipBox(FX_RECT* clip) = 0; | |
| 435 | |
| 436 virtual FXCODEC_STATUS GetFrames(int32_t& frames, | |
| 437 IFX_Pause* pPause = NULL) = 0; | |
| 438 | |
| 439 virtual FXCODEC_STATUS StartDecode(class CFX_DIBitmap* pDIBitmap, | |
| 440 int32_t start_x, | |
| 441 int32_t start_y, | |
| 442 int32_t size_x, | |
| 443 int32_t size_y, | |
| 444 int32_t frames = 0, | |
| 445 FX_BOOL bInterpol = TRUE) = 0; | |
| 446 | |
| 447 virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0; | |
| 448 }; | |
| 449 #endif // PDF_ENABLE_XFA | |
| 450 | |
| 451 class ICodec_IccModule { | |
| 452 public: | |
| 453 enum IccCS { | |
| 454 IccCS_Unknown = 0, | |
| 455 IccCS_XYZ, | |
| 456 IccCS_Lab, | |
| 457 IccCS_Luv, | |
| 458 IccCS_YCbCr, | |
| 459 IccCS_Yxy, | |
| 460 IccCS_Hsv, | |
| 461 IccCS_Hls, | |
| 462 IccCS_Gray, | |
| 463 IccCS_Rgb, | |
| 464 IccCS_Cmyk, | |
| 465 IccCS_Cmy | |
| 466 }; | |
| 467 | |
| 468 struct IccParam { | |
| 469 uint32_t Version; | |
| 470 IccCS ColorSpace; | |
| 471 uint32_t dwProfileType; | |
| 472 uint32_t dwFormat; | |
| 473 uint8_t* pProfileData; | |
| 474 uint32_t dwProfileSize; | |
| 475 double Gamma; | |
| 476 }; | |
| 477 | |
| 478 virtual ~ICodec_IccModule() {} | |
| 479 | |
| 480 virtual IccCS GetProfileCS(const uint8_t* pProfileData, | |
| 481 unsigned int dwProfileSize) = 0; | |
| 482 | |
| 483 virtual IccCS GetProfileCS(IFX_FileRead* pFile) = 0; | |
| 484 | |
| 485 virtual void* CreateTransform( | |
| 486 ICodec_IccModule::IccParam* pInputParam, | |
| 487 ICodec_IccModule::IccParam* pOutputParam, | |
| 488 ICodec_IccModule::IccParam* pProofParam = NULL, | |
| 489 uint32_t dwIntent = Icc_INTENT_PERCEPTUAL, | |
| 490 uint32_t dwFlag = Icc_FLAGS_DEFAULT, | |
| 491 uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, | |
| 492 uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) = 0; | |
| 493 | |
| 494 virtual void* CreateTransform_sRGB( | |
| 495 const uint8_t* pProfileData, | |
| 496 uint32_t dwProfileSize, | |
| 497 uint32_t& nComponents, | |
| 498 int32_t intent = 0, | |
| 499 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) = 0; | |
| 500 | |
| 501 virtual void* CreateTransform_CMYK( | |
| 502 const uint8_t* pSrcProfileData, | |
| 503 uint32_t dwSrcProfileSize, | |
| 504 uint32_t& nSrcComponents, | |
| 505 const uint8_t* pDstProfileData, | |
| 506 uint32_t dwDstProfileSize, | |
| 507 int32_t intent = 0, | |
| 508 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT, | |
| 509 uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) = 0; | |
| 510 | |
| 511 virtual void DestroyTransform(void* pTransform) = 0; | |
| 512 | |
| 513 virtual void Translate(void* pTransform, | |
| 514 FX_FLOAT* pSrcValues, | |
| 515 FX_FLOAT* pDestValues) = 0; | |
| 516 | |
| 517 virtual void TranslateScanline(void* pTransform, | |
| 518 uint8_t* pDest, | |
| 519 const uint8_t* pSrc, | |
| 520 int pixels) = 0; | |
| 521 virtual void SetComponents(uint32_t nComponents) = 0; | |
| 522 }; | 95 }; |
| 523 | 96 |
| 524 void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); | 97 void ReverseRGB(uint8_t* pDestBuf, const uint8_t* pSrcBuf, int pixels); |
| 525 void sRGB_to_AdobeCMYK(FX_FLOAT R, | 98 void sRGB_to_AdobeCMYK(FX_FLOAT R, |
| 526 FX_FLOAT G, | 99 FX_FLOAT G, |
| 527 FX_FLOAT B, | 100 FX_FLOAT B, |
| 528 FX_FLOAT& c, | 101 FX_FLOAT& c, |
| 529 FX_FLOAT& m, | 102 FX_FLOAT& m, |
| 530 FX_FLOAT& y, | 103 FX_FLOAT& y, |
| 531 FX_FLOAT& k); | 104 FX_FLOAT& k); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 546 FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]); | 119 FX_BOOL MD5ComputeID(const void* buf, uint32_t dwSize, uint8_t ID[16]); |
| 547 void FaxG4Decode(const uint8_t* src_buf, | 120 void FaxG4Decode(const uint8_t* src_buf, |
| 548 uint32_t src_size, | 121 uint32_t src_size, |
| 549 int* pbitpos, | 122 int* pbitpos, |
| 550 uint8_t* dest_buf, | 123 uint8_t* dest_buf, |
| 551 int width, | 124 int width, |
| 552 int height, | 125 int height, |
| 553 int pitch); | 126 int pitch); |
| 554 | 127 |
| 555 #endif // CORE_FXCODEC_INCLUDE_FX_CODEC_H_ | 128 #endif // CORE_FXCODEC_INCLUDE_FX_CODEC_H_ |
| OLD | NEW |