FreeImagePlus  FreeImage 3.18.0
FreeImagePlus.h
1 // ==========================================================
2 // FreeImagePlus 3
3 //
4 // Design and implementation by
5 // - Hervé Drolon (drolon@infonie.fr)
6 //
7 // This file is part of FreeImage 3
8 //
9 // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
10 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
11 // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
12 // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
13 // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
14 // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
15 // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
16 // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
17 // THIS DISCLAIMER.
18 //
19 // Use at your own risk!
20 // ==========================================================
21 
22 #ifndef FREEIMAGEPLUS_H
23 #define FREEIMAGEPLUS_H
24 
25 #ifdef _WIN32
26 #include <windows.h>
27 #endif // _WIN32
28 #include "FreeImage.h"
29 
30 
31 // Compiler options ---------------------------------------------------------
32 
33 #if defined(FREEIMAGE_LIB)
34  #define FIP_API
35  #define FIP_CALLCONV
36 #else
37  #if defined(_WIN32) || defined(__WIN32__)
38  #define WIN32_LEAN_AND_MEAN
39  #define FIP_CALLCONV __stdcall
40  // The following ifdef block is the standard way of creating macros which make exporting
41  // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS
42  // symbol defined on the command line. this symbol should not be defined on any project
43  // that uses this DLL. This way any other project whose source files include this file see
44  // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols
45  // defined with this macro as being exported.
46  #ifdef FIP_EXPORTS
47  #define FIP_API __declspec(dllexport)
48  #else
49  #define FIP_API __declspec(dllimport)
50  #endif // FIP_EXPORTS
51  #else
52  // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
53  #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
54  #ifndef GCC_HASCLASSVISIBILITY
55  #define GCC_HASCLASSVISIBILITY
56  #endif
57  #endif
58  #define FIP_CALLCONV
59  #if defined(GCC_HASCLASSVISIBILITY)
60  #define FIP_API __attribute__ ((visibility("default")))
61  #else
62  #define FIP_API
63  #endif
64  #endif // WIN32 / !WIN32
65 #endif // FREEIMAGE_LIB
66 
68 
69 // ----------------------------------------------------------
70 
76 class FIP_API fipObject
77 {
78 public:
80  virtual ~fipObject(){};
81 
84  virtual BOOL isValid() const = 0;
87 };
88 
89 // ----------------------------------------------------------
90 
91 class fipMemoryIO;
92 class fipMultiPage;
93 class fipTag;
94 
103 class FIP_API fipImage : public fipObject
104 {
105 protected:
107  FIBITMAP *_dib;
109  FREE_IMAGE_FORMAT _fif;
111  mutable BOOL _bHasChanged;
112 
113 public:
114  friend class fipMultiPage;
115 
116 public:
117 
124  fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
126  virtual ~fipImage();
131  BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0);
133  virtual void clear();
135 
142  fipImage(const fipImage& src);
153  fipImage& operator=(FIBITMAP *dib);
154 
155 
168  BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const;
169 
183  BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256);
184 
195  BOOL crop(int left, int top, int right, int bottom);
196 
215  BOOL createView(fipImage& dynamicView, unsigned left, unsigned top, unsigned right, unsigned bottom);
216 
218 
228  static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName);
229 
234  static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName);
235 
243  static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle);
244 
251  static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem);
252 
254 
255 
268  BOOL load(const char* lpszPathName, int flag = 0);
269 
278  BOOL load(FREE_IMAGE_FORMAT fif, const char* lpszPathName, int flag = 0);
279 
284  BOOL loadU(const wchar_t* lpszPathName, int flag = 0);
285 
290  BOOL loadU(FREE_IMAGE_FORMAT fif, const wchar_t* lpszPathName, int flag = 0);
291 
300  BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0);
301 
309  BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0);
310 
319  BOOL loadFromMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0);
320 
329  BOOL save(const char* lpszPathName, int flag = 0);
330 
339  BOOL save(FREE_IMAGE_FORMAT fif, const char* lpszPathName, int flag = 0);
340 
345  BOOL saveU(const wchar_t* lpszPathName, int flag = 0);
346 
351  BOOL saveU(FREE_IMAGE_FORMAT fif, const wchar_t* lpszPathName, int flag = 0);
352 
362  BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0);
363 
372  BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0);
373 
375 
380 
385  FREE_IMAGE_TYPE getImageType() const;
386 
390  FREE_IMAGE_FORMAT getFIF() const;
391 
396  unsigned getWidth() const;
397 
402  unsigned getHeight() const;
403 
408  unsigned getScanWidth() const;
409 
422  operator FIBITMAP*() {
423  return _dib;
424  }
425 
427  BOOL isValid() const;
428 
433  const BITMAPINFO* getInfo() const;
434 
440 
446  unsigned getImageSize() const;
447 
452  unsigned getImageMemorySize() const;
453 
459  unsigned getBitsPerPixel() const;
460 
466  unsigned getLine() const;
467 
472  double getHorizontalResolution() const;
473 
478  double getVerticalResolution() const;
479 
484  void setHorizontalResolution(double value);
485 
490  void setVerticalResolution(double value);
491 
493 
500  RGBQUAD* getPalette() const;
501 
506  unsigned getPaletteSize() const;
507 
512  unsigned getColorsUsed() const;
513 
518  FREE_IMAGE_COLOR_TYPE getColorType() const;
519 
524  BOOL isGrayscale() const;
526 
529 
535  BOOL getThumbnail(fipImage& image) const;
536 
542  BOOL setThumbnail(const fipImage& image);
543 
549  BOOL hasThumbnail() const;
550 
557 
559 
562 
571  BYTE* accessPixels() const;
572 
578  BYTE* getScanLine(unsigned scanline) const;
579 
588  BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const;
589 
598  BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const;
599 
608  BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value);
609 
618  BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value);
619 
621 
633  BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE);
634 
641  BOOL threshold(BYTE T);
642 
649  BOOL dither(FREE_IMAGE_DITHER algorithm);
650 
657 
664 
672 
680  BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm);
681 
688 
695 
702 
709 
716 
723 
730 
737 
744 
751 
762  BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
763 
765 
768 
773  BOOL isTransparent() const;
774 
780  unsigned getTransparencyCount() const;
781 
787  BYTE* getTransparencyTable() const;
788 
793  void setTransparencyTable(BYTE *table, int count);
794 
799  BOOL hasFileBkColor() const;
800 
809  BOOL getFileBkColor(RGBQUAD *bkcolor) const;
810 
819  BOOL setFileBkColor(RGBQUAD *bkcolor);
821 
830  BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const;
831 
839  BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel);
840 
849  BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel);
850 
858  BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue);
860 
874  BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
875 
883  BOOL rotate(double angle, const void *bkcolor = NULL);
884 
890 
895  BOOL flipVertical();
897 
905  BOOL invert();
906 
920  BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
921 
928  BOOL adjustGamma(double gamma);
929 
937  BOOL adjustBrightness(double percentage);
938 
946  BOOL adjustContrast(double percentage);
947 
958  BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma);
959 
970  BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const;
972 
975 
984  BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter);
985 
993  BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE);
995 
1005  void setModified(BOOL bStatus = TRUE) {
1006  _bHasChanged = bStatus;
1007  }
1008 
1014  BOOL isModified() {
1015  return _bHasChanged;
1016  }
1018 
1026  unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const;
1035  BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const;
1055  BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag);
1056 
1062 
1063  protected:
1066  BOOL replace(FIBITMAP *new_dib);
1068 
1069 };
1070 
1071 // ----------------------------------------------------------
1072 
1084 #ifdef _WIN32
1085 
1086 class FIP_API fipWinImage : public fipImage
1087 {
1088 public:
1091  fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
1093 
1095  virtual ~fipWinImage();
1096 
1098  virtual void clear();
1099 
1101  BOOL isValid() const;
1103 
1106 
1114 
1122 
1129  HANDLE copyToHandle() const;
1130 
1137  BOOL copyFromHandle(HANDLE hMem);
1138 
1143  BOOL copyFromBitmap(HBITMAP hbmp);
1145 
1154  BOOL copyToClipboard(HWND hWndNewOwner) const;
1155 
1162 
1170  BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow);
1172 
1173 
1176 
1185  void draw(HDC hDC, RECT& rcDest) const {
1186  drawEx(hDC, rcDest, FALSE, NULL, NULL);
1187  }
1188 
1206  void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const;
1207 
1218  void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
1219 
1229  void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const;
1230 
1232 
1233 protected:
1235  mutable FIBITMAP *_display_dib;
1237  mutable BOOL _bDeleteMe;
1239  FREE_IMAGE_TMO _tmo;
1248 };
1249 
1250 #endif // _WIN32
1251 
1252 // ----------------------------------------------------------
1253 
1260 class FIP_API fipMemoryIO : public fipObject
1261 {
1262 protected:
1264  FIMEMORY *_hmem;
1265 
1266 public :
1276  fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0);
1277 
1282  virtual ~fipMemoryIO();
1283 
1288  void close();
1289 
1292  BOOL isValid() const;
1293 
1297  FREE_IMAGE_FORMAT getFileType() const;
1298 
1303  operator FIMEMORY*() {
1304  return _hmem;
1305  }
1306 
1316  FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const;
1324  FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const;
1333  BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0);
1342  BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0);
1351  unsigned read(void *buffer, unsigned size, unsigned count) const;
1360  unsigned write(const void *buffer, unsigned size, unsigned count);
1365  long tell() const;
1370  BOOL seek(long offset, int origin);
1377  BOOL acquire(BYTE **data, DWORD *size_in_bytes);
1379 
1380 private:
1382  fipMemoryIO(const fipMemoryIO& src);
1384  fipMemoryIO& operator=(const fipMemoryIO& src);
1385 
1386 };
1387 
1388 // ----------------------------------------------------------
1389 
1395 class FIP_API fipMultiPage : public fipObject
1396 {
1397 protected:
1399  FIMULTIBITMAP *_mpage;
1402 
1403 public:
1408  fipMultiPage(BOOL keep_cache_in_memory = FALSE);
1409 
1414  virtual ~fipMultiPage();
1415 
1417  BOOL isValid() const;
1418 
1423  operator FIMULTIBITMAP*() {
1424  return _mpage;
1425  }
1426 
1436  BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0);
1437 
1445  BOOL open(fipMemoryIO& memIO, int flags = 0);
1446 
1455  BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0);
1456 
1463  BOOL close(int flags = 0);
1464 
1474  BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const;
1475 
1484  BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const;
1485 
1490  int getPageCount() const;
1491 
1497  void appendPage(fipImage& image);
1498 
1505  void insertPage(int page, fipImage& image);
1506 
1512  void deletePage(int page);
1513 
1521  BOOL movePage(int target, int source);
1522 
1540  FIBITMAP* lockPage(int page);
1541 
1548  void unlockPage(fipImage& image, BOOL changed);
1549 
1558  BOOL getLockedPageNumbers(int *pages, int *count) const;
1559 };
1560 
1561 // ----------------------------------------------------------
1562 
1568 class FIP_API fipTag : public fipObject
1569 {
1570 protected:
1572  FITAG *_tag;
1573 
1574 public:
1586  virtual ~fipTag();
1595  BOOL setKeyValue(const char *key, const char *value);
1596 
1598 
1605  fipTag(const fipTag& tag);
1610  fipTag& operator=(const fipTag& tag);
1616  fipTag& operator=(FITAG *tag);
1618 
1624  operator FITAG*() {
1625  return _tag;
1626  }
1627 
1629  BOOL isValid() const;
1630 
1637  const char *getKey() const;
1642  const char *getDescription() const;
1647  WORD getID() const;
1652  FREE_IMAGE_MDTYPE getType() const;
1657  DWORD getCount() const;
1662  DWORD getLength() const;
1667  const void *getValue() const;
1673  BOOL setKey(const char *key);
1679  BOOL setDescription(const char *description);
1685  BOOL setID(WORD id);
1691  BOOL setType(FREE_IMAGE_MDTYPE type);
1697  BOOL setCount(DWORD count);
1703  BOOL setLength(DWORD length);
1709  BOOL setValue(const void *value);
1710 
1712 
1718  const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const;
1719 
1720 };
1721 
1748 class FIP_API fipMetadataFind : public fipObject
1749 {
1750 protected:
1752  FIMETADATA *_mdhandle;
1753 
1754 public:
1756  BOOL isValid() const;
1757 
1764  virtual ~fipMetadataFind();
1774  BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag);
1783 
1784 };
1785 
1786 #endif // FREEIMAGEPLUS_H
fipMemoryIO::~fipMemoryIO
virtual ~fipMemoryIO()
Destructor.
fipImage::getPixelColor
BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const
Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow acc...
fipMemoryIO::load
FIBITMAP * load(FREE_IMAGE_FORMAT fif, int flags=0) const
Loads a dib from a memory stream.
fipMemoryIO
Memory handle.
Definition: FreeImagePlus.h:1261
fipImage::rescale
BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter)
Rescale the image to a new width / height.
fipTag::fipTag
fipTag(const fipTag &tag)
Copy constructor.
fipImage::loadU
BOOL loadU(FREE_IMAGE_FORMAT fif, const wchar_t *lpszPathName, int flag=0)
UNICODE version of load (this function only works under WIN32 and does nothing on other OS)
fipMultiPage::saveToMemory
BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flags=0) const
Saves a multi-page image using the specified memory stream and an optional flag.
fipMultiPage::_mpage
FIMULTIBITMAP * _mpage
Pointer to a multi-page file stream.
Definition: FreeImagePlus.h:1399
fipTag::setKeyValue
BOOL setKeyValue(const char *key, const char *value)
Construct a FIDT_ASCII tag (ASCII string).
fipWinImage::operator=
fipWinImage & operator=(const fipImage &src)
Copy constructor.
fipMemoryIO::_hmem
FIMEMORY * _hmem
Pointer to a memory stream.
Definition: FreeImagePlus.h:1264
fipImage::setVerticalResolution
void setVerticalResolution(double value)
set the bitmap resolution along the Y axis, in pixels / cm
fipMetadataFind::_mdhandle
FIMETADATA * _mdhandle
Pointer to a search handle.
Definition: FreeImagePlus.h:1752
fipImage::operator=
fipImage & operator=(FIBITMAP *dib)
Assignement operator Copy the input pointer and manage its destruction
fipImage::getScanWidth
unsigned getScanWidth() const
Returns the width of the bitmap in bytes rounded to the nearest DWORD.
fipImage::invert
BOOL invert()
Inverts each pixel data.
fipImage::clearThumbnail
BOOL clearThumbnail()
Clear the thumbnail possibly attached to the bitmap.
fipWinImage::_tmo_param_1
double _tmo_param_1
first tone mapping algorithm parameter
Definition: FreeImagePlus.h:1241
fipImage::isModified
BOOL isModified()
Get the image status.
Definition: FreeImagePlus.h:1014
fipImage::rotateEx
BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask)
Image translation and rotation using B-Splines.
fipImage::getImageSize
unsigned getImageSize() const
Returns the size of the bitmap in bytes.
fipImage::saveU
BOOL saveU(FREE_IMAGE_FORMAT fif, const wchar_t *lpszPathName, int flag=0)
UNICODE version of save (this function only works under WIN32 and does nothing on other OS)
fipImage::_dib
FIBITMAP * _dib
DIB data.
Definition: FreeImagePlus.h:107
fipTag::getValue
const void * getValue() const
Returns the tag value.
fipImage::getInfoHeader
const BITMAPINFOHEADER * getInfoHeader() const
Returns a pointer to the bitmap's BITMAPINFOHEADER.
fipMultiPage::getLockedPageNumbers
BOOL getLockedPageNumbers(int *pages, int *count) const
Returns an array of page-numbers that are currently locked in memory.
fipImage::getPaletteSize
unsigned getPaletteSize() const
Returns the palette size in bytes.
fipWinImage::setToneMappingOperator
void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
Select a tone mapping algorithm used for drawing and set the image as modified so that the display wi...
fipMemoryIO::tell
long tell() const
Gets the current position of a memory pointer.
fipImage::setMetadata
BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)
Attach a new FreeImage tag to the dib.
fipImage::flipHorizontal
BOOL flipHorizontal()
Flip the image horizontally along the vertical axis.
fipImage::convertTo4Bits
BOOL convertTo4Bits()
Converts the bitmap to 4 bits.
fipImage::hasThumbnail
BOOL hasThumbnail() const
Check if the image has an embedded thumbnail.
fipWinImage::isValid
BOOL isValid() const
Returns TRUE if the image is allocated, FALSE otherwise.
fipMultiPage
Multi-page file stream.
Definition: FreeImagePlus.h:1396
fipImage::getFIF
FREE_IMAGE_FORMAT getFIF() const
Return the original (or last saved) fif format if available, returns FIF_UNKNOWN otherwise.
fipTag::setType
BOOL setType(FREE_IMAGE_MDTYPE type)
Set the tag data type.
fipImage::convertToRGB16
BOOL convertToRGB16()
Converts the bitmap to a 48-bit RGB16 image.
fipTag::getLength
DWORD getLength() const
Returns the length of the tag value in bytes.
fipImage::identifyFIFFromMemory
static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem)
Identifies an image using the specified memory stream.
fipImage::isValid
BOOL isValid() const
Returns TRUE if the image is allocated, FALSE otherwise.
fipMultiPage::movePage
BOOL movePage(int target, int source)
Moves the source page to the position of the target page.
fipImage::getVerticalResolution
double getVerticalResolution() const
Returns the bitmap resolution along the Y axis, in pixels / cm.
fipImage::getScanLine
BYTE * getScanLine(unsigned scanline) const
Returns a pointer to the start of the given scanline in the bitmap’s data-bits.
fipImage::loadU
BOOL loadU(const wchar_t *lpszPathName, int flag=0)
UNICODE version of load (this function only works under WIN32 and does nothing on other OS)
fipObject
Abstract base class for all objects used by the library.
Definition: FreeImagePlus.h:77
fipImage::adjustCurve
BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel)
Perfoms an histogram transformation on a 8, 24 or 32-bit image according to the values of a lookup ta...
fipMetadataFind::findFirstMetadata
BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage &image, fipTag &tag)
Provides information about the first instance of a tag that matches the metadata model specified in t...
fipWinImage::clear
virtual void clear()
Destroy image data.
fipImage::saveU
BOOL saveU(const wchar_t *lpszPathName, int flag=0)
UNICODE version of save (this function only works under WIN32 and does nothing on other OS)
fipWinImage::_tmo
FREE_IMAGE_TMO _tmo
tone mapping operator
Definition: FreeImagePlus.h:1239
fipImage::convertToType
BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)
Converts an image to a type supported by FreeImage.
fipImage::adjustBrightness
BOOL adjustBrightness(double percentage)
Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.
fipWinImage::_display_dib
FIBITMAP * _display_dib
DIB used for display (this allow to display non-standard bitmaps)
Definition: FreeImagePlus.h:1235
fipImage::convertToRGBAF
BOOL convertToRGBAF()
Converts the bitmap to a 128-bit RGBAF image.
fipMemoryIO::saveMultiPage
BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags=0)
Saves a multi-page bitmap to a memory stream.
fipImage::colorQuantize
BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm)
Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
fipImage::getFileBkColor
BOOL getFileBkColor(RGBQUAD *bkcolor) const
Retrieves the file background color of an image.
fipMetadataFind::findNextMetadata
BOOL findNextMetadata(fipTag &tag)
Find the next tag, if any, that matches the metadata model argument in a previous call to findFirstMe...
fipWinImage::copyToClipboard
BOOL copyToClipboard(HWND hWndNewOwner) const
Clipboard copy.
fipObject::~fipObject
virtual ~fipObject()
Destructor.
Definition: FreeImagePlus.h:80
fipMultiPage::open
BOOL open(FreeImageIO *io, fi_handle handle, int flags=0)
Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle,...
fipImage::setChannel
BOOL setChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)
Insert a 8-bit dib into a 24- or 32-bit image.
fipTag::operator=
fipTag & operator=(FITAG *tag)
Assignement operator Copy the input pointer and manage its destruction
fipImage::isGrayscale
BOOL isGrayscale() const
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
fipImage::fipImage
fipImage(const fipImage &src)
Copy constructor.
fipTag::setValue
BOOL setValue(const void *value)
Set the tag value.
fipTag::fipTag
fipTag()
Constructor.
fipWinImage::operator=
fipWinImage & operator=(const fipWinImage &src)
Copy constructor Delete internal _display_dib data and copy tone mapping parameters.
fipMemoryIO::isValid
BOOL isValid() const
Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise.
fipImage::~fipImage
virtual ~fipImage()
Destructor.
fipMemoryIO::loadMultiPage
FIMULTIBITMAP * loadMultiPage(FREE_IMAGE_FORMAT fif, int flags=0) const
Loads a multi-page bitmap from a memory stream.
fipMultiPage::open
BOOL open(fipMemoryIO &memIO, int flags=0)
Open a multi-page memory stream as read/write.
fipImage::getHorizontalResolution
double getHorizontalResolution() const
Returns the bitmap resolution along the X axis, in pixels / cm.
fipMultiPage::open
BOOL open(const char *lpszPathName, BOOL create_new, BOOL read_only, int flags=0)
Open a multi-page file stream.
fipTag::getID
WORD getID() const
Returns the tag ID if available, returns 0 otherwise.
fipTag::setLength
BOOL setLength(DWORD length)
Set the length of the tag value, in bytes.
fipImage::toneMapping
BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image.
fipImage::setHorizontalResolution
void setHorizontalResolution(double value)
set the bitmap resolution along the X axis, in pixels / cm
fipMultiPage::appendPage
void appendPage(fipImage &image)
Appends a new page to the end of the bitmap.
fipTag::setID
BOOL setID(WORD id)
Set the (usually optional) tad ID.
fipImage::adjustGamma
BOOL adjustGamma(double gamma)
Performs gamma correction on a 8, 24 or 32-bit image.
fipImage::getHistogram
BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const
Computes image histogram.
fipWinImage::_bDeleteMe
BOOL _bDeleteMe
remember to delete _display_dib
Definition: FreeImagePlus.h:1237
fipImage::getInfo
const BITMAPINFO * getInfo() const
Returns a pointer to the bitmap's BITMAPINFO header.
fipWinImage::copyToHandle
HANDLE copyToHandle() const
Clone function used for clipboard copy.
fipImage::getPalette
RGBQUAD * getPalette() const
Returns a pointer to the bitmap's palette.
fipImage::isTransparent
BOOL isTransparent() const
Returns TRUE if the image is transparent, returns FALSE otherwise.
fipMemoryIO::getFileType
FREE_IMAGE_FORMAT getFileType() const
Returns the buffer image format.
fipMemoryIO::save
BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0)
Saves a dib to a memory stream.
fipMemoryIO::fipMemoryIO
fipMemoryIO(BYTE *data=NULL, DWORD size_in_bytes=0)
Constructor.
fipImage::getHeight
unsigned getHeight() const
Returns the image height in pixels.
fipImage::convertTo24Bits
BOOL convertTo24Bits()
Converts the bitmap to 24 bits.
fipWinImage::copyFromBitmap
BOOL copyFromBitmap(HBITMAP hbmp)
Copy constructor.
fipImage::save
BOOL save(FREE_IMAGE_FORMAT fif, const char *lpszPathName, int flag=0)
Saves an image to disk, given its format, file name and an optional flag.
fipImage::setModified
void setModified(BOOL bStatus=TRUE)
Set the image status as 'modified'.
Definition: FreeImagePlus.h:1005
fipImage::fipImage
fipImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)
Constructor.
fipImage::adjustContrast
BOOL adjustContrast(double percentage)
Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.
fipTag::getDescription
const char * getDescription() const
Returns the tag description if available, returns NULL otherwise.
fipImage::operator=
fipImage & operator=(const fipImage &src)
Copy constructor.
fipImage::convertToRGBA16
BOOL convertToRGBA16()
Converts the bitmap to a 64-bit RGBA16 image.
fipImage::setPixelColor
BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value)
Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow acc...
fipImage::load
BOOL load(const char *lpszPathName, int flag=0)
Loads an image from disk, given its file name and an optional flag.
fipImage::getBitsPerPixel
unsigned getBitsPerPixel() const
Returns the bitdepth of the bitmap.
fipImage::hasFileBkColor
BOOL hasFileBkColor() const
Returns TRUE when the image has a file background color, FALSE otherwise.
fipImage::makeThumbnail
BOOL makeThumbnail(unsigned max_size, BOOL convert=TRUE)
Creates a thumbnail image keeping aspect ratio.
fipImage::_fif
FREE_IMAGE_FORMAT _fif
Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.
Definition: FreeImagePlus.h:109
fipImage::getThumbnail
BOOL getThumbnail(fipImage &image) const
Retrieves a copy the thumbnail possibly attached to the bitmap.
fipImage::convertToUINT16
BOOL convertToUINT16()
Converts the bitmap to a 16-bit unsigned short image.
fipTag::getType
FREE_IMAGE_MDTYPE getType() const
Returns the tag data type.
fipImage::flipVertical
BOOL flipVertical()
Flip the image vertically along the horizontal axis.
fipImage::getTransparencyTable
BYTE * getTransparencyTable() const
8-bit transparency : get the bitmap’s transparency table.
fipWinImage::_tmo_param_2
double _tmo_param_2
second tone mapping algorithm parameter
Definition: FreeImagePlus.h:1243
fipImage::load
BOOL load(FREE_IMAGE_FORMAT fif, const char *lpszPathName, int flag=0)
Loads an image from disk, given its format, file name and an optional flag.
fipMemoryIO::close
void close()
Destructor.
fipWinImage
A class designed for MS Windows (TM) platforms.
Definition: FreeImagePlus.h:1087
fipMemoryIO::seek
BOOL seek(long offset, int origin)
Moves the memory pointer to a specified location.
fipWinImage::copyFromHandle
BOOL copyFromHandle(HANDLE hMem)
Copy constructor used for clipboard paste.
fipImage::createView
BOOL createView(fipImage &dynamicView, unsigned left, unsigned top, unsigned right, unsigned bottom)
Returns a reference (a.k.a.
fipTag
FreeImage Tag.
Definition: FreeImagePlus.h:1569
fipImage::convertTo32Bits
BOOL convertTo32Bits()
Converts the bitmap to 32 bits.
fipImage::getColorType
FREE_IMAGE_COLOR_TYPE getColorType() const
Investigates the colour type of the bitmap.
fipImage::saveToHandle
BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0)
Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag.
fipWinImage::~fipWinImage
virtual ~fipWinImage()
Destructor.
fipImage::convertToGrayscale
BOOL convertToGrayscale()
Converts the bitmap to 8 bits.
fipImage::pasteSubImage
BOOL pasteSubImage(fipImage &src, int left, int top, int alpha=256)
fipImage::identifyFIF
static FREE_IMAGE_FORMAT identifyFIF(const char *lpszPathName)
Identifies an image from disk, given its file name.
fipMultiPage::deletePage
void deletePage(int page)
Deletes the page on the given position.
fipMemoryIO::acquire
BOOL acquire(BYTE **data, DWORD *size_in_bytes)
Provides a direct buffer access to a memory stream.
fipImage::getColorsUsed
unsigned getColorsUsed() const
Retrieves the number of colours used in the bitmap.
fipWinImage::draw
void draw(HDC hDC, RECT &rcDest) const
Draw (stretch) the image on a HDC, using StretchDIBits.
Definition: FreeImagePlus.h:1185
fipTag::setKey
BOOL setKey(const char *key)
Set the tag field name.
fipImage::convertTo16Bits555
BOOL convertTo16Bits555()
Converts the bitmap to 16 bits.
fipMultiPage::unlockPage
void unlockPage(fipImage &image, BOOL changed)
Unlocks a previously locked page and gives it back to the multi-page engine.
fipMultiPage::insertPage
void insertPage(int page, fipImage &image)
Inserts a new page before the given position in the bitmap.
fipImage::identifyFIFFromHandle
static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle)
Identifies an image using the specified FreeImageIO struct and fi_handle.
fipTag::getCount
DWORD getCount() const
Returns the number of components in the tag (in tag type units)
fipImage::loadFromMemory
BOOL loadFromMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0)
Loads an image using the specified fif and memory stream and an optional flag.
fipImage::loadFromHandle
BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag=0)
Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag.
fipMultiPage::fipMultiPage
fipMultiPage(BOOL keep_cache_in_memory=FALSE)
Constructor.
fipMultiPage::~fipMultiPage
virtual ~fipMultiPage()
Destructor Close the file stream if not already done.
fipImage::crop
BOOL crop(int left, int top, int right, int bottom)
Crop a sub part of the current image and update it accordingly.
fipImage::convertToFloat
BOOL convertToFloat()
Converts the bitmap to a 32-bit float image.
fipImage::convertTo8Bits
BOOL convertTo8Bits()
Converts the bitmap to 8 bits.
fipImage::clearMetadata
void clearMetadata()
Clear all metadata contained in the dib.
fipMetadataFind::isValid
BOOL isValid() const
Returns TRUE if the search handle is allocated, FALSE otherwise.
fipMultiPage::_bMemoryCache
BOOL _bMemoryCache
TRUE when using a memory cache, FALSE otherwise.
Definition: FreeImagePlus.h:1401
fipImage::dither
BOOL dither(FREE_IMAGE_DITHER algorithm)
Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.
fipImage::getTransparencyCount
unsigned getTransparencyCount() const
8-bit transparency : get the number of transparent colors.
fipTag::getKey
const char * getKey() const
Returns the tag field name (unique inside a metadata model).
fipImage::loadFromMemory
BOOL loadFromMemory(fipMemoryIO &memIO, int flag=0)
Loads an image using the specified memory stream and an optional flag.
fipImage::threshold
BOOL threshold(BYTE T)
Converts the bitmap to 1 bit using a threshold T.
fipImage::convertTo16Bits565
BOOL convertTo16Bits565()
Converts the bitmap to 16 bits.
fipWinImage::captureWindow
BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow)
Capture a window and convert it to an image.
fipWinImage::getToneMappingOperator
void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const
Get the tone mapping algorithm used for drawing, with its parameters.
fipImage::getPixelIndex
BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const
Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (...
fipMultiPage::close
BOOL close(int flags=0)
Close a file stream.
tagBITMAPINFO
Definition: FreeImage.h:224
fipImage::adjustBrightnessContrastGamma
BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma)
Adjusts an image's brightness, contrast and gamma within a single operation.
fipImage::saveToMemory
BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0)
Saves an image using the specified memory stream and an optional flag.
fipTag::isValid
BOOL isValid() const
Returns TRUE if the tag is allocated, FALSE otherwise.
fipImage::setTransparencyTable
void setTransparencyTable(BYTE *table, int count)
8-bit transparency : set the bitmap’s transparency table.
fipTag::setDescription
BOOL setDescription(const char *description)
Set the (usually optional) tag description.
fipImage::getWidth
unsigned getWidth() const
Returns the image width in pixels.
fipImage::getImageMemorySize
unsigned getImageMemorySize() const
Returns the memory footprint of a bitmap, in bytes.
fipImage::setFileBkColor
BOOL setFileBkColor(RGBQUAD *bkcolor)
Set the file background color of an image.
fipImage::identifyFIFU
static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t *lpszPathName)
UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS)
fipImage::splitChannels
BOOL splitChannels(fipImage &RedChannel, fipImage &GreenChannel, fipImage &BlueChannel)
Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels.
fipImage::save
BOOL save(const char *lpszPathName, int flag=0)
Saves an image to disk, given its file name and an optional flag.
fipMultiPage::saveToHandle
BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags=0) const
Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag.
fipImage::setSize
BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask=0, unsigned green_mask=0, unsigned blue_mask=0)
Image allocator.
fipImage::getChannel
BOOL getChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) const
Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image.
fipImage::clear
virtual void clear()
Destroy image data.
fipImage::setThumbnail
BOOL setThumbnail(const fipImage &image)
Attach a thumbnail to the bitmap.
fipMultiPage::lockPage
FIBITMAP * lockPage(int page)
Locks a page in memory for editing.
tagRGBQUAD
Definition: FreeImage.h:179
fipImage::getMetadata
BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const
Retrieve a metadata attached to the dib.
fipMemoryIO::read
unsigned read(void *buffer, unsigned size, unsigned count) const
Reads data from a memory stream.
fipTag::operator=
fipTag & operator=(const fipTag &tag)
Copy constructor.
fipMetadataFind::fipMetadataFind
fipMetadataFind()
Constructor.
fipImage::getMetadataCount
unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const
Returns the number of tags contained in the model metadata model attached to the dib.
fipImage::getLine
unsigned getLine() const
Returns the width of the bitmap in bytes.
tagBITMAPINFOHEADER
Definition: FreeImage.h:210
fipMetadataFind::~fipMetadataFind
virtual ~fipMetadataFind()
Destructor.
fipImage::accessPixels
BYTE * accessPixels() const
Returns a pointer to the bitmap bits.
fipImage::_bHasChanged
BOOL _bHasChanged
TRUE whenever the display need to be refreshed.
Definition: FreeImagePlus.h:111
fipTag::setCount
BOOL setCount(DWORD count)
Set the number of data in the tag.
fipTag::~fipTag
virtual ~fipTag()
Destructor.
fipTag::_tag
FITAG * _tag
Pointer to a FreeImage tag.
Definition: FreeImagePlus.h:1572
fipImage::setPixelIndex
BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value)
Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (...
fipWinImage::pasteFromClipboard
BOOL pasteFromClipboard()
Retrieves data from the clipboard.
fipMetadataFind
Metadata iterator.
Definition: FreeImagePlus.h:1749
fipMultiPage::getPageCount
int getPageCount() const
Returns the number of pages currently available in the multi-paged bitmap.
fipImage::copySubImage
BOOL copySubImage(fipImage &dst, int left, int top, int right, int bottom) const
Copy a sub part of the current image and returns it as a fipImage object.
fipMultiPage::isValid
BOOL isValid() const
Returns TRUE if the multi-page stream is opened.
fipMemoryIO::write
unsigned write(const void *buffer, unsigned size, unsigned count)
Writes data to a memory stream.
fipImage::getImageType
FREE_IMAGE_TYPE getImageType() const
Returns the data type of the image.
fipImage::combineChannels
BOOL combineChannels(fipImage &red, fipImage &green, fipImage &blue)
Builds a 24-bit RGB image given its red, green and blue channel.
fipWinImage::drawEx
void drawEx(HDC hDC, RECT &rcDest, BOOL useFileBkg=FALSE, RGBQUAD *appBkColor=NULL, FIBITMAP *bg=NULL) const
Draw (stretch) the image on a HDC, using StretchDIBits.
fipImage
A class used to manage all photo related images and all image types used by the library.
Definition: FreeImagePlus.h:104
fipWinImage::_tmo_param_3
double _tmo_param_3
third tone mapping algorithm parameter
Definition: FreeImagePlus.h:1245
fipWinImage::_tmo_param_4
double _tmo_param_4
fourth tone mapping algorithm parameter
Definition: FreeImagePlus.h:1247
fipImage::convertToRGBF
BOOL convertToRGBF()
Converts the bitmap to a 96-bit RGBF image.
fipTag::toString
const char * toString(FREE_IMAGE_MDMODEL model, char *Make=NULL) const
Converts a FreeImage tag structure to a string that represents the interpreted tag value.
fipImage::rotate
BOOL rotate(double angle, const void *bkcolor=NULL)
Image rotation by means of three shears.