PGF Console  6.21.2
CImage.h
Go to the documentation of this file.
1 /*
2  * PGFConsole: A PGF-codec demonstration
3  * $Date: 2006-05-09 20:13:33 +0200 (Di, 09 Mai 2006) $
4  * $Revision: 187 $
5 
6  * This file Copyright (C) 2006 xeraina GmbH, Switzerland
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */
22 
23 // CImage.h : FreeImagePlus wrapper for loading and saving images
24 
25 #pragma once
26 
27 // <FreeImagePlus.h> must not be included because of type conflicts
28 #define __PNMEXSUPPORT__ // modifies FreeImage to support PNM with more than 8 and less than 16 bit per channel
29 
30 //-------------------------------------------------------------------------------
31 // Defines -- Adobe image modes.
32 //-------------------------------------------------------------------------------
33 #define ImageModeBitmap 0
34 #define ImageModeGrayScale 1
35 #define ImageModeIndexedColor 2
36 #define ImageModeRGBColor 3
37 #define ImageModeCMYKColor 4
38 #define ImageModeHSLColor 5
39 #define ImageModeHSBColor 6
40 #define ImageModeMultichannel 7
41 #define ImageModeDuotone 8
42 #define ImageModeLabColor 9
43 #define ImageModeGray16 10
44 #define ImageModeRGB48 11
45 #define ImageModeLab48 12
46 #define ImageModeCMYK64 13
47 #define ImageModeDeepMultichannel 14
48 #define ImageModeDuotone16 15
49 // pgf extension
50 #define ImageModeRGBA 17
51 #define ImageModeGray31 18
52 #define ImageModeRGB12 19
53 #define ImageModeRGB16 20
54 #define ImageModeUnknown 255
55 
56 class fipImage;
57 
58 class CImage {
59  fipImage *m_image; // must be a pointer because of class prototyping
60 
61 public:
62  CImage();
63  virtual ~CImage();
64 
65  bool Create(int width, int height, int bpp);
66  bool Create(int width, int height, unsigned char type);
67  unsigned char* GetBits() const;
68  int GetPitch() const;
69  unsigned char GetBPP() const;
70  unsigned int GetHeight() const;
71  unsigned int GetWidth() const;
72  bool Save(const char* dest);
73  bool Load(const char* source);
75  bool IsIndexed();
77  void GetColorTable(int firstColor, int numColors, void* prgbColors);
78  void SetColorTable(int firstColor, int numColors, const void* prgbColors);
79  unsigned char GetColorType() const;
80  int GetChannelDepth() const;
81  int GetChannels() const;
82 
83 #ifdef __PNMEXSUPPORT__
84  void SetMaxValue(int maxValue);
85  int GetMaxValue() const;
86 
87  static void RegisterPNM();
88 #endif
89 
90 };
Definition: CImage.h:58
fipImage * m_image
Definition: CImage.h:59
bool Load(const char *source)
Definition: CImage.cpp:127
bool IsIndexed()
Definition: CImage.cpp:144
static void RegisterPNM()
Definition: CImage.cpp:303
unsigned char GetBPP() const
Definition: CImage.cpp:107
unsigned char * GetBits() const
Definition: CImage.cpp:97
unsigned char GetColorType() const
Definition: CImage.cpp:178
bool Create(int width, int height, int bpp)
Definition: CImage.cpp:43
CImage()
Definition: CImage.cpp:28
bool IsTransparencySupported()
Definition: CImage.cpp:139
virtual ~CImage()
Definition: CImage.cpp:37
void GetColorTable(int firstColor, int numColors, void *prgbColors)
Definition: CImage.cpp:156
void SetColorTable(int firstColor, int numColors, const void *prgbColors)
Definition: CImage.cpp:167
bool Save(const char *dest)
Definition: CImage.cpp:122
int GetMaxColorTableEntries()
Definition: CImage.cpp:151
int GetMaxValue() const
Definition: CImage.cpp:323
int GetPitch() const
Definition: CImage.cpp:102
unsigned int GetHeight() const
Definition: CImage.cpp:112
int GetChannelDepth() const
Definition: CImage.cpp:250
int GetChannels() const
Definition: CImage.cpp:276
unsigned int GetWidth() const
Definition: CImage.cpp:117
void SetMaxValue(int maxValue)
Definition: CImage.cpp:319