FreeImagePlus.h
// ==========================================================
// FreeImagePlus 3
//
// Design and implementation by
// - Hervé Drolon (drolon@infonie.fr)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
#ifndef FREEIMAGEPLUS_H
#define FREEIMAGEPLUS_H
#ifdef _WIN32
#include <windows.h>
#endif // _WIN32
#include "FreeImage.h"
// Compiler options ---------------------------------------------------------
#if defined(FREEIMAGE_LIB)
#define FIP_API
#define FIP_CALLCONV
#else
#if defined(_WIN32) || defined(__WIN32__)
#define WIN32_LEAN_AND_MEAN
#define FIP_CALLCONV __stdcall
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// FIP_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef FIP_EXPORTS
#define FIP_API __declspec(dllexport)
#else
#define FIP_API __declspec(dllimport)
#endif // FIP_EXPORTS
#else
// try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#ifndef GCC_HASCLASSVISIBILITY
#define GCC_HASCLASSVISIBILITY
#endif
#endif
#define FIP_CALLCONV
#if defined(GCC_HASCLASSVISIBILITY)
#define FIP_API __attribute__ ((visibility("default")))
#else
#define FIP_API
#endif
#endif // WIN32 / !WIN32
#endif // FREEIMAGE_LIB
// ----------------------------------------------------------
class FIP_API fipObject
{
public:
virtual ~fipObject(){};
virtual BOOL isValid() const = 0;
};
// ----------------------------------------------------------
class fipMemoryIO;
class fipMultiPage;
class fipTag;
class FIP_API fipImage : public fipObject
{
protected:
FIBITMAP *_dib;
FREE_IMAGE_FORMAT _fif;
mutable BOOL _bHasChanged;
public:
friend class fipMultiPage;
public:
fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
virtual ~fipImage();
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);
virtual void clear();
fipImage(const fipImage& src);
fipImage& operator=(const fipImage& src);
fipImage& operator=(FIBITMAP *dib);
BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const;
BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256);
BOOL crop(int left, int top, int right, int bottom);
BOOL createView(fipImage& dynamicView, unsigned left, unsigned top, unsigned right, unsigned bottom);
static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName);
static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName);
static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle);
static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem);
BOOL load(const char* lpszPathName, int flag = 0);
BOOL load(FREE_IMAGE_FORMAT fif, const char* lpszPathName, int flag = 0);
BOOL loadU(const wchar_t* lpszPathName, int flag = 0);
BOOL loadU(FREE_IMAGE_FORMAT fif, const wchar_t* lpszPathName, int flag = 0);
BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0);
BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0);
BOOL loadFromMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0);
BOOL save(const char* lpszPathName, int flag = 0);
BOOL save(FREE_IMAGE_FORMAT fif, const char* lpszPathName, int flag = 0);
BOOL saveU(const wchar_t* lpszPathName, int flag = 0);
BOOL saveU(FREE_IMAGE_FORMAT fif, const wchar_t* lpszPathName, int flag = 0);
BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0);
BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0);
FREE_IMAGE_TYPE getImageType() const;
FREE_IMAGE_FORMAT getFIF() const;
unsigned getWidth() const;
unsigned getHeight() const;
unsigned getScanWidth() const;
operator FIBITMAP*() {
return _dib;
}
BOOL isValid() const;
const BITMAPINFO* getInfo() const;
const BITMAPINFOHEADER* getInfoHeader() const;
unsigned getImageSize() const;
unsigned getImageMemorySize() const;
unsigned getBitsPerPixel() const;
unsigned getLine() const;
double getHorizontalResolution() const;
double getVerticalResolution() const;
void setHorizontalResolution(double value);
void setVerticalResolution(double value);
RGBQUAD* getPalette() const;
unsigned getPaletteSize() const;
unsigned getColorsUsed() const;
FREE_IMAGE_COLOR_TYPE getColorType() const;
BOOL isGrayscale() const;
BOOL getThumbnail(fipImage& image) const;
BOOL setThumbnail(const fipImage& image);
BOOL hasThumbnail() const;
BOOL clearThumbnail();
BYTE* accessPixels() const;
BYTE* getScanLine(unsigned scanline) const;
BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const;
BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const;
BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value);
BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value);
BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE);
BOOL threshold(BYTE T);
BOOL dither(FREE_IMAGE_DITHER algorithm);
BOOL convertTo4Bits();
BOOL convertTo8Bits();
BOOL convertToGrayscale();
BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm);
BOOL convertTo16Bits555();
BOOL convertTo16Bits565();
BOOL convertTo24Bits();
BOOL convertTo32Bits();
BOOL convertToFloat();
BOOL convertToRGBF();
BOOL convertToRGBAF();
BOOL convertToUINT16();
BOOL convertToRGB16();
BOOL convertToRGBA16();
BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
BOOL isTransparent() const;
unsigned getTransparencyCount() const;
BYTE* getTransparencyTable() const;
void setTransparencyTable(BYTE *table, int count);
BOOL hasFileBkColor() const;
BOOL getFileBkColor(RGBQUAD *bkcolor) const;
BOOL setFileBkColor(RGBQUAD *bkcolor);
BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const;
BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel);
BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel);
BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue);
BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
BOOL rotate(double angle, const void *bkcolor = NULL);
BOOL flipHorizontal();
BOOL flipVertical();
BOOL invert();
BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
BOOL adjustGamma(double gamma);
BOOL adjustBrightness(double percentage);
BOOL adjustContrast(double percentage);
BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma);
BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const;
BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter);
BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE);
void setModified(BOOL bStatus = TRUE) {
_bHasChanged = bStatus;
}
BOOL isModified() {
return _bHasChanged;
}
unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const;
BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const;
BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag);
void clearMetadata();
protected:
BOOL replace(FIBITMAP *new_dib);
};
// ----------------------------------------------------------
#ifdef _WIN32
class FIP_API fipWinImage : public fipImage
{
public:
fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
virtual ~fipWinImage();
virtual void clear();
BOOL isValid() const;
fipWinImage& operator=(const fipImage& src);
fipWinImage& operator=(const fipWinImage& src);
HANDLE copyToHandle() const;
BOOL copyFromHandle(HANDLE hMem);
BOOL copyFromBitmap(HBITMAP hbmp);
BOOL copyToClipboard(HWND hWndNewOwner) const;
BOOL pasteFromClipboard();
BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow);
void draw(HDC hDC, RECT& rcDest) const {
drawEx(hDC, rcDest, FALSE, NULL, NULL);
}
void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const;
void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const;
protected:
mutable FIBITMAP *_display_dib;
mutable BOOL _bDeleteMe;
FREE_IMAGE_TMO _tmo;
double _tmo_param_1;
double _tmo_param_2;
double _tmo_param_3;
double _tmo_param_4;
};
#endif // _WIN32
// ----------------------------------------------------------
class FIP_API fipMemoryIO : public fipObject
{
protected:
FIMEMORY *_hmem;
public :
fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0);
virtual ~fipMemoryIO();
void close();
BOOL isValid() const;
FREE_IMAGE_FORMAT getFileType() const;
operator FIMEMORY*() {
return _hmem;
}
FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const;
FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const;
BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0);
BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0);
unsigned read(void *buffer, unsigned size, unsigned count) const;
unsigned write(const void *buffer, unsigned size, unsigned count);
long tell() const;
BOOL seek(long offset, int origin);
BOOL acquire(BYTE **data, DWORD *size_in_bytes);
private:
fipMemoryIO(const fipMemoryIO& src);
fipMemoryIO& operator=(const fipMemoryIO& src);
};
// ----------------------------------------------------------
class FIP_API fipMultiPage : public fipObject
{
protected:
FIMULTIBITMAP *_mpage;
BOOL _bMemoryCache;
public:
fipMultiPage(BOOL keep_cache_in_memory = FALSE);
virtual ~fipMultiPage();
BOOL isValid() const;
operator FIMULTIBITMAP*() {
return _mpage;
}
BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0);
BOOL open(fipMemoryIO& memIO, int flags = 0);
BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0);
BOOL close(int flags = 0);
BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const;
BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const;
int getPageCount() const;
void appendPage(fipImage& image);
void insertPage(int page, fipImage& image);
void deletePage(int page);
BOOL movePage(int target, int source);
FIBITMAP* lockPage(int page);
void unlockPage(fipImage& image, BOOL changed);
BOOL getLockedPageNumbers(int *pages, int *count) const;
};
// ----------------------------------------------------------
class FIP_API fipTag : public fipObject
{
protected:
FITAG *_tag;
public:
fipTag();
virtual ~fipTag();
BOOL setKeyValue(const char *key, const char *value);
fipTag(const fipTag& tag);
fipTag& operator=(const fipTag& tag);
fipTag& operator=(FITAG *tag);
operator FITAG*() {
return _tag;
}
BOOL isValid() const;
const char *getKey() const;
const char *getDescription() const;
WORD getID() const;
FREE_IMAGE_MDTYPE getType() const;
DWORD getCount() const;
DWORD getLength() const;
const void *getValue() const;
BOOL setKey(const char *key);
BOOL setDescription(const char *description);
BOOL setID(WORD id);
BOOL setType(FREE_IMAGE_MDTYPE type);
BOOL setCount(DWORD count);
BOOL setLength(DWORD length);
BOOL setValue(const void *value);
const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const;
};
class FIP_API fipMetadataFind : public fipObject
{
protected:
FIMETADATA *_mdhandle;
public:
BOOL isValid() const;
fipMetadataFind();
virtual ~fipMetadataFind();
BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag);
BOOL findNextMetadata(fipTag& tag);
};
#endif // FREEIMAGEPLUS_H
fipImage
A class used to manage all photo related images and all image types used by the library.
Definition FreeImagePlus.h:104
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::_dib
FIBITMAP * _dib
DIB data.
Definition FreeImagePlus.h:107
fipImage::combineChannels
BOOL combineChannels(fipImage &red, fipImage &green, fipImage &blue)
Builds a 24-bit RGB image given its red, green and blue channel.
fipImage::getPalette
RGBQUAD * getPalette() const
Returns a pointer to the bitmap's palette.
fipImage::fipImage
fipImage(const fipImage &src)
Copy constructor.
fipImage::getImageMemorySize
unsigned getImageMemorySize() const
Returns the memory footprint of a bitmap, in bytes.
fipImage::clearMetadata
void clearMetadata()
Clear all metadata contained in the dib.
fipImage::makeThumbnail
BOOL makeThumbnail(unsigned max_size, BOOL convert=TRUE)
Creates a thumbnail image keeping aspect ratio.
fipImage::clearThumbnail
BOOL clearThumbnail()
Clear the thumbnail possibly attached to the bitmap.
fipImage::setFileBkColor
BOOL setFileBkColor(RGBQUAD *bkcolor)
Set the file background color of an image.
fipImage::save
BOOL save(const char *lpszPathName, int flag=0)
Saves an image to disk, given its file name and an optional flag.
fipImage::getFileBkColor
BOOL getFileBkColor(RGBQUAD *bkcolor) const
Retrieves the file background color of an image.
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).
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::dither
BOOL dither(FREE_IMAGE_DITHER algorithm)
Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.
fipImage::getMetadata
BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const
Retrieve a metadata attached to the dib.
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::convertTo32Bits
BOOL convertTo32Bits()
Converts the bitmap to 32 bits.
fipImage::getScanLine
BYTE * getScanLine(unsigned scanline) const
Returns a pointer to the start of the given scanline in the bitmap’s data-bits.
fipImage::rescale
BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter)
Rescale the image to a new width / height.
fipImage::getScanWidth
unsigned getScanWidth() const
Returns the width of the bitmap in bytes rounded to the nearest DWORD.
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::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 (...
fipImage::getFIF
FREE_IMAGE_FORMAT getFIF() const
Return the original (or last saved) fif format if available, returns FIF_UNKNOWN otherwise.
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::getPaletteSize
unsigned getPaletteSize() const
Returns the palette size in bytes.
fipImage::convertToUINT16
BOOL convertToUINT16()
Converts the bitmap to a 16-bit unsigned short image.
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::pasteSubImage
BOOL pasteSubImage(fipImage &src, int left, int top, int alpha=256)
fipImage::isGrayscale
BOOL isGrayscale() const
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
fipImage::load
BOOL load(const char *lpszPathName, int flag=0)
Loads an image from disk, given its file name and an optional flag.
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::operator=
fipImage & operator=(FIBITMAP *dib)
Assignement operator Copy the input pointer and manage its destruction
fipImage::convertTo8Bits
BOOL convertTo8Bits()
Converts the bitmap to 8 bits.
fipImage::colorQuantize
BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm)
Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
fipImage::isValid
BOOL isValid() const
Returns TRUE if the image is allocated, FALSE otherwise.
fipImage::setHorizontalResolution
void setHorizontalResolution(double value)
set the bitmap resolution along the X axis, in pixels / cm
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::crop
BOOL crop(int left, int top, int right, int bottom)
Crop a sub part of the current image and update it accordingly.
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::convertToType
BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)
Converts an image to a type supported by FreeImage.
fipImage::flipVertical
BOOL flipVertical()
Flip the image vertically along the horizontal axis.
fipImage::setThumbnail
BOOL setThumbnail(const fipImage &image)
Attach a thumbnail to the bitmap.
fipImage::getHorizontalResolution
double getHorizontalResolution() const
Returns the bitmap resolution along the X axis, in pixels / cm.
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).
fipImage::getHistogram
BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const
Computes image histogram.
fipImage::getHeight
unsigned getHeight() const
Returns the image height in pixels.
fipImage::~fipImage
virtual ~fipImage()
Destructor.
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::setTransparencyTable
void setTransparencyTable(BYTE *table, int count)
8-bit transparency : set the bitmap’s transparency table.
fipImage::clear
virtual void clear()
Destroy image data.
fipImage::identifyFIFFromMemory
static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem)
Identifies an image using the specified memory stream.
fipImage::getImageType
FREE_IMAGE_TYPE getImageType() const
Returns the data type of the image.
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 (...
fipImage::adjustGamma
BOOL adjustGamma(double gamma)
Performs gamma correction on a 8, 24 or 32-bit image.
fipImage::convertToGrayscale
BOOL convertToGrayscale()
Converts the bitmap to 8 bits.
fipImage::operator=
fipImage & operator=(const fipImage &src)
Copy constructor.
fipImage::setVerticalResolution
void setVerticalResolution(double value)
set the bitmap resolution along the Y axis, in pixels / cm
fipImage::convertTo4Bits
BOOL convertTo4Bits()
Converts the bitmap to 4 bits.
fipImage::convertToRGBA16
BOOL convertToRGBA16()
Converts the bitmap to a 64-bit RGBA16 image.
fipImage::hasThumbnail
BOOL hasThumbnail() const
Check if the image has an embedded thumbnail.
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.
fipImage::flipHorizontal
BOOL flipHorizontal()
Flip the image horizontally along the vertical axis.
fipImage::identifyFIFFromHandle
static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle)
Identifies an image using the specified FreeImageIO struct and fi_handle.
fipImage::getVerticalResolution
double getVerticalResolution() const
Returns the bitmap resolution along the Y axis, in pixels / cm.
fipImage::_bHasChanged
BOOL _bHasChanged
TRUE whenever the display need to be refreshed.
Definition FreeImagePlus.h:111
fipImage::getTransparencyTable
BYTE * getTransparencyTable() const
8-bit transparency : get the bitmap’s transparency table.
fipImage::getTransparencyCount
unsigned getTransparencyCount() const
8-bit transparency : get the number of transparent colors.
fipImage::accessPixels
BYTE * accessPixels() const
Returns a pointer to the bitmap bits.
fipImage::getImageSize
unsigned getImageSize() const
Returns the size of the bitmap in bytes.
fipImage::rotate
BOOL rotate(double angle, const void *bkcolor=NULL)
Image rotation by means of three shears.
fipImage::convertToRGBF
BOOL convertToRGBF()
Converts the bitmap to a 96-bit RGBF image.
fipImage::threshold
BOOL threshold(BYTE T)
Converts the bitmap to 1 bit using a threshold T.
fipImage::setModified
void setModified(BOOL bStatus=TRUE)
Set the image status as 'modified'.
Definition FreeImagePlus.h:1005
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...
fipImage::convertToFloat
BOOL convertToFloat()
Converts the bitmap to a 32-bit float image.
fipImage::identifyFIF
static FREE_IMAGE_FORMAT identifyFIF(const char *lpszPathName)
Identifies an image from disk, given its file name.
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.
fipImage::adjustBrightnessContrastGamma
BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma)
Adjusts an image's brightness, contrast and gamma within a single operation.
fipImage::_fif
FREE_IMAGE_FORMAT _fif
Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.
Definition FreeImagePlus.h:109
fipImage::fipImage
fipImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)
Constructor.
fipImage::setMetadata
BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)
Attach a new FreeImage tag to the dib.
fipImage::getThumbnail
BOOL getThumbnail(fipImage &image) const
Retrieves a copy the thumbnail possibly attached to the bitmap.
fipImage::getInfo
const BITMAPINFO * getInfo() const
Returns a pointer to the bitmap's BITMAPINFO header.
fipImage::getColorType
FREE_IMAGE_COLOR_TYPE getColorType() const
Investigates the colour type of the bitmap.
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...
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.
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::convertToRGBAF
BOOL convertToRGBAF()
Converts the bitmap to a 128-bit RGBAF image.
fipImage::adjustBrightness
BOOL adjustBrightness(double percentage)
Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.
fipImage::getInfoHeader
const BITMAPINFOHEADER * getInfoHeader() const
Returns a pointer to the bitmap's BITMAPINFOHEADER.
fipImage::isModified
BOOL isModified()
Get the image status.
Definition FreeImagePlus.h:1014
fipImage::convertTo16Bits555
BOOL convertTo16Bits555()
Converts the bitmap to 16 bits.
fipImage::adjustContrast
BOOL adjustContrast(double percentage)
Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.
fipImage::convertTo24Bits
BOOL convertTo24Bits()
Converts the bitmap to 24 bits.
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.
fipImage::getColorsUsed
unsigned getColorsUsed() const
Retrieves the number of colours used in the bitmap.
fipImage::getWidth
unsigned getWidth() const
Returns the image width in pixels.
fipImage::convertToRGB16
BOOL convertToRGB16()
Converts the bitmap to a 48-bit RGB16 image.
fipImage::createView
BOOL createView(fipImage &dynamicView, unsigned left, unsigned top, unsigned right, unsigned bottom)
Returns a reference (a.k.a.
fipImage::convertTo16Bits565
BOOL convertTo16Bits565()
Converts the bitmap to 16 bits.
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.
fipImage::isTransparent
BOOL isTransparent() const
Returns TRUE if the image is transparent, returns FALSE otherwise.
fipImage::setChannel
BOOL setChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)
Insert a 8-bit dib into a 24- or 32-bit image.
fipImage::getLine
unsigned getLine() const
Returns the width of the bitmap in bytes.
fipImage::invert
BOOL invert()
Inverts each pixel 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).
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::loadFromMemory
BOOL loadFromMemory(fipMemoryIO &memIO, int flag=0)
Loads an image using the specified memory stream and an optional flag.
fipMemoryIO
Memory handle.
Definition FreeImagePlus.h:1261
fipMemoryIO::_hmem
FIMEMORY * _hmem
Pointer to a memory stream.
Definition FreeImagePlus.h:1264
fipMemoryIO::seek
BOOL seek(long offset, int origin)
Moves the memory pointer to a specified location.
fipMemoryIO::~fipMemoryIO
virtual ~fipMemoryIO()
Destructor.
fipMemoryIO::getFileType
FREE_IMAGE_FORMAT getFileType() const
Returns the buffer image format.
fipMemoryIO::read
unsigned read(void *buffer, unsigned size, unsigned count) const
Reads data from a memory stream.
fipMemoryIO::isValid
BOOL isValid() const
Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise.
fipMemoryIO::close
void close()
Destructor.
fipMemoryIO::tell
long tell() const
Gets the current position of a memory pointer.
fipMemoryIO::save
BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0)
Saves a dib to a memory stream.
fipMemoryIO::write
unsigned write(const void *buffer, unsigned size, unsigned count)
Writes data to a memory stream.
fipMemoryIO::saveMultiPage
BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags=0)
Saves a multi-page bitmap to a memory stream.
fipMemoryIO::fipMemoryIO
fipMemoryIO(BYTE *data=NULL, DWORD size_in_bytes=0)
Constructor.
fipMemoryIO::acquire
BOOL acquire(BYTE **data, DWORD *size_in_bytes)
Provides a direct buffer access to a memory stream.
fipMemoryIO::load
FIBITMAP * load(FREE_IMAGE_FORMAT fif, int flags=0) const
Loads a dib from a memory stream.
fipMemoryIO::loadMultiPage
FIMULTIBITMAP * loadMultiPage(FREE_IMAGE_FORMAT fif, int flags=0) const
Loads a multi-page bitmap from a memory stream.
fipMetadataFind::~fipMetadataFind
virtual ~fipMetadataFind()
Destructor.
fipMetadataFind::findNextMetadata
BOOL findNextMetadata(fipTag &tag)
Find the next tag, if any, that matches the metadata model argument in a previous call to findFirstMe...
fipMetadataFind::_mdhandle
FIMETADATA * _mdhandle
Pointer to a search handle.
Definition FreeImagePlus.h:1752
fipMetadataFind::fipMetadataFind
fipMetadataFind()
Constructor.
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...
fipMetadataFind::isValid
BOOL isValid() const
Returns TRUE if the search handle is allocated, FALSE otherwise.
fipMultiPage
Multi-page file stream.
Definition FreeImagePlus.h:1396
fipMultiPage::unlockPage
void unlockPage(fipImage &image, BOOL changed)
Unlocks a previously locked page and gives it back to the multi-page engine.
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::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,...
fipMultiPage::lockPage
FIBITMAP * lockPage(int page)
Locks a page in memory for editing.
fipMultiPage::appendPage
void appendPage(fipImage &image)
Appends a new page to the end of the bitmap.
fipMultiPage::open
BOOL open(fipMemoryIO &memIO, int flags=0)
Open a multi-page memory stream as read/write.
fipMultiPage::~fipMultiPage
virtual ~fipMultiPage()
Destructor Close the file stream if not already done.
fipMultiPage::deletePage
void deletePage(int page)
Deletes the page on the given position.
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.
fipMultiPage::fipMultiPage
fipMultiPage(BOOL keep_cache_in_memory=FALSE)
Constructor.
fipMultiPage::close
BOOL close(int flags=0)
Close a file stream.
fipMultiPage::_bMemoryCache
BOOL _bMemoryCache
TRUE when using a memory cache, FALSE otherwise.
Definition FreeImagePlus.h:1401
fipMultiPage::getPageCount
int getPageCount() const
Returns the number of pages currently available in the multi-paged bitmap.
fipMultiPage::getLockedPageNumbers
BOOL getLockedPageNumbers(int *pages, int *count) const
Returns an array of page-numbers that are currently locked in memory.
fipMultiPage::isValid
BOOL isValid() const
Returns TRUE if the multi-page stream is opened.
fipMultiPage::open
BOOL open(const char *lpszPathName, BOOL create_new, BOOL read_only, int flags=0)
Open a multi-page file stream.
fipMultiPage::movePage
BOOL movePage(int target, int source)
Moves the source page to the position of the target page.
fipMultiPage::_mpage
FIMULTIBITMAP * _mpage
Pointer to a multi-page file stream.
Definition FreeImagePlus.h:1399
fipMultiPage::insertPage
void insertPage(int page, fipImage &image)
Inserts a new page before the given position in the bitmap.
fipObject
Abstract base class for all objects used by the library.
Definition FreeImagePlus.h:77
fipObject::isValid
virtual BOOL isValid() const =0
Returns TRUE if the object is allocated, FALSE otherwise.
fipObject::~fipObject
virtual ~fipObject()
Destructor.
Definition FreeImagePlus.h:80
fipTag
FreeImage Tag.
Definition FreeImagePlus.h:1569
fipTag::~fipTag
virtual ~fipTag()
Destructor.
fipTag::setType
BOOL setType(FREE_IMAGE_MDTYPE type)
Set the tag data type.
fipTag::getLength
DWORD getLength() const
Returns the length of the tag value in bytes.
fipTag::getID
WORD getID() const
Returns the tag ID if available, returns 0 otherwise.
fipTag::setDescription
BOOL setDescription(const char *description)
Set the (usually optional) tag description.
fipTag::setKeyValue
BOOL setKeyValue(const char *key, const char *value)
Construct a FIDT_ASCII tag (ASCII string).
fipTag::operator=
fipTag & operator=(FITAG *tag)
Assignement operator Copy the input pointer and manage its destruction
fipTag::fipTag
fipTag()
Constructor.
fipTag::_tag
FITAG * _tag
Pointer to a FreeImage tag.
Definition FreeImagePlus.h:1572
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.
fipTag::getKey
const char * getKey() const
Returns the tag field name (unique inside a metadata model).
fipTag::operator=
fipTag & operator=(const fipTag &tag)
Copy constructor.
fipTag::setID
BOOL setID(WORD id)
Set the (usually optional) tad ID.
fipTag::setKey
BOOL setKey(const char *key)
Set the tag field name.
fipTag::fipTag
fipTag(const fipTag &tag)
Copy constructor.
fipTag::getDescription
const char * getDescription() const
Returns the tag description if available, returns NULL otherwise.
fipTag::getValue
const void * getValue() const
Returns the tag value.
fipTag::setValue
BOOL setValue(const void *value)
Set the tag value.
fipTag::setLength
BOOL setLength(DWORD length)
Set the length of the tag value, in bytes.
fipTag::setCount
BOOL setCount(DWORD count)
Set the number of data in the tag.
fipTag::getType
FREE_IMAGE_MDTYPE getType() const
Returns the tag data type.
fipTag::isValid
BOOL isValid() const
Returns TRUE if the tag is allocated, FALSE otherwise.
fipTag::getCount
DWORD getCount() const
Returns the number of components in the tag (in tag type units).
fipWinImage::_display_dib
FIBITMAP * _display_dib
DIB used for display (this allow to display non-standard bitmaps).
Definition FreeImagePlus.h:1235
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.
fipWinImage::clear
virtual void clear()
Destroy image data.
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.
fipWinImage::~fipWinImage
virtual ~fipWinImage()
Destructor.
fipWinImage::_tmo_param_3
double _tmo_param_3
third tone mapping algorithm parameter
Definition FreeImagePlus.h:1245
fipWinImage::draw
void draw(HDC hDC, RECT &rcDest) const
Draw (stretch) the image on a HDC, using StretchDIBits.
Definition FreeImagePlus.h:1185
fipWinImage::_tmo
FREE_IMAGE_TMO _tmo
tone mapping operator
Definition FreeImagePlus.h:1239
fipWinImage::_tmo_param_2
double _tmo_param_2
second tone mapping algorithm parameter
Definition FreeImagePlus.h:1243
fipWinImage::copyFromBitmap
BOOL copyFromBitmap(HBITMAP hbmp)
Copy constructor.
fipWinImage::copyToHandle
HANDLE copyToHandle() const
Clone function used for clipboard copy.
fipWinImage::_tmo_param_1
double _tmo_param_1
first tone mapping algorithm parameter
Definition FreeImagePlus.h:1241
fipWinImage::captureWindow
BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow)
Capture a window and convert it to an image.
fipWinImage::_tmo_param_4
double _tmo_param_4
fourth tone mapping algorithm parameter
Definition FreeImagePlus.h:1247
fipWinImage::copyToClipboard
BOOL copyToClipboard(HWND hWndNewOwner) const
Clipboard copy.
fipWinImage::_bDeleteMe
BOOL _bDeleteMe
remember to delete _display_dib
Definition FreeImagePlus.h:1237
fipWinImage::pasteFromClipboard
BOOL pasteFromClipboard()
Retrieves data from the clipboard.
fipWinImage::copyFromHandle
BOOL copyFromHandle(HANDLE hMem)
Copy constructor used for clipboard paste.
fipWinImage::operator=
fipWinImage & operator=(const fipImage &src)
Copy constructor.
fipWinImage::isValid
BOOL isValid() const
Returns TRUE if the image is allocated, FALSE otherwise.
fipWinImage::fipWinImage
fipWinImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)
Constructor.
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...
fipWinImage::operator=
fipWinImage & operator=(const fipWinImage &src)
Copy constructor Delete internal _display_dib data and copy tone mapping parameters.