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 _FDE_IMAGE
8 #define _FDE_IMAGE
9 class IFDE_Image;
10 #define FDE_IMAGEFORMAT_Unknown -1
11 #define FDE_IMAGEFORMAT_BMP 0
12 #define FDE_IMAGEFORMAT_GIF 1
13 #define FDE_IMAGEFORMAT_JPEG 2
14 #define FDE_IMAGEFORMAT_PNG 3
15 #define FDE_IMAGEFORMAT_TIFF 4
16 #define FDE_IMAGEFORMAT_JPEG2000 5
17 #define FDE_IMAGEFORMAT_JBig2 6
18 class IFDE_Image {
19  public:
20   static IFDE_Image* Create(IFX_Stream* pStream,
21                             int32_t iFormat = FDE_IMAGEFORMAT_Unknown);
~IFDE_Image()22   virtual ~IFDE_Image() {}
23   virtual void Release() = 0;
24   virtual FX_BOOL LoadImage() = 0;
25   virtual void FreeImage() = 0;
26   virtual int32_t CountFrames() const = 0;
27   virtual FX_BOOL LoadFrame(int32_t index) = 0;
28   virtual CFX_DIBitmap* GetFrameImage() = 0;
29   virtual int32_t GetImageFormat() const = 0;
30   virtual int32_t GetImageWidth() const = 0;
31   virtual int32_t GetImageHeight() const = 0;
32   virtual int32_t GetDelayTime(int32_t iFrameIndex) const = 0;
33   virtual int32_t GetLoopCount() const = 0;
34   virtual FX_BOOL StartLoadImage(CFX_DIBitmap* pDIBitmap,
35                                  int32_t dibX,
36                                  int32_t dibY,
37                                  int32_t dibCX,
38                                  int32_t dibCY,
39                                  int32_t imgX,
40                                  int32_t imgY,
41                                  int32_t imgCX,
42                                  int32_t imgCY,
43                                  int32_t iFrameIndex = 0) = 0;
44   virtual int32_t DoLoadImage(IFX_Pause* pPause = NULL) = 0;
45   virtual void StopLoadImage() = 0;
46 };
47 #define FDE_IMAGEFILTER_Unknown -1
48 #define FDE_IMAGEFILTER_Opacity 0
49 #define FDE_IMAGEFILTER_GrayScale 1
50 #define FDE_IMAGEFILTER_BlackWhite 2
51 #define FDE_IMAGEFILTER_InvertColor 3
52 #define FDE_IMAGEFILTER_TransparentColor 4
53 #define FDE_IMAGEFILTER_MaskColor 5
54 #define FDE_IMAGEFILTER_Brightness 6
55 #define FDE_IMAGEFILTER_Contrast 7
56 typedef struct _FDE_IMAGEFILTERPARAMS : public CFX_Target {
57   int32_t iFilterType;
58 } FDE_IMAGEFILTERPARAMS, *FDE_LPIMAGEFILTERPARAMS;
59 typedef FDE_IMAGEFILTERPARAMS const* FDE_LPCIMAGEFILTERPARAMS;
60 typedef struct _FDE_OPACITYPARAMS : public FDE_IMAGEFILTERPARAMS {
61   int32_t iOpacity;
62 } FDE_OPACITYPARAMS, *FDE_LPOPACITYPARAMS;
63 typedef FDE_OPACITYPARAMS const* FDE_LPCOPACITYPARAMS;
64 typedef struct _FDE_BLACKWHITEPARAMS : public FDE_IMAGEFILTERPARAMS {
65   FX_ARGB dwBlackColor;
66   FX_ARGB dwWhiteColor;
67 } FDE_BLACKWHITEPARAMS, *FDE_LPBLACKWHITEPARAMS;
68 typedef FDE_BLACKWHITEPARAMS const* FDE_LPCBLACKWHITEPARAMS;
69 typedef struct _FDE_TRANSPARENTPARAMS : public FDE_IMAGEFILTERPARAMS {
70   FX_ARGB color;
71 } FDE_TRANSPARENTPARAMS, *FDE_LPTRANSPARENTPARAMS;
72 typedef FDE_TRANSPARENTPARAMS const* FDE_LPCTRANSPARENTPARAMS;
73 typedef struct _FDE_MASKCOLORPARAMS : public FDE_IMAGEFILTERPARAMS {
74   FX_ARGB color;
75 } FDE_MASKCOLORPARAMS, *FDE_LPMASKCOLORPARAMS;
76 typedef FDE_MASKCOLORPARAMS const* FDE_LPCMASKCOLORPARAMS;
77 typedef struct _FDE_BRIGHTNESSPARAMS : public FDE_IMAGEFILTERPARAMS {
78   int32_t iBrightness;
79 } FDE_BRIGHTNESSPARAMS, *FDE_LPBRIGHTNESSPARAMS;
80 typedef FDE_BRIGHTNESSPARAMS const* FDE_LPCBRIGHTNESSPARAMS;
81 typedef struct _FDE_CONTRASTPARAMS : public FDE_IMAGEFILTERPARAMS {
82   int32_t iContrast;
83 } FDE_CONTRASTPARAMS, *FDE_LPCONTRASTPARAMS;
84 typedef FDE_CONTRASTPARAMS const* FDE_LPCCONTRASTPARAMS;
85 #endif
86