FreeImagePlus - FreeImage 3.17.0
|
A class used to manage all photo related images and all image types used by the library. More...
#include <FreeImagePlus.h>
Public Member Functions | |
Creation & Destruction | |
fipImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0) | |
Constructor. | |
virtual | ~fipImage () |
Destructor. | |
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. | |
virtual void | clear () |
Destroy image data. | |
Copying | |
fipImage (const fipImage &src) | |
Copy constructor. | |
fipImage & | operator= (const fipImage &src) |
Copy constructor. | |
fipImage & | operator= (FIBITMAP *dib) |
Assignement operator Copy the input pointer and manage its destruction | |
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. | |
BOOL | pasteSubImage (fipImage &src, int left, int top, int alpha=256) |
Alpha blend or combine a sub part image with the current image. | |
BOOL | crop (int left, int top, int right, int bottom) |
Crop a sub part of the current image and update it accordingly. | |
Loading & Saving | |
Loading and saving is handled by the FreeImage library. | |
BOOL | load (const char *lpszPathName, int flag=0) |
Loads an image from disk, given its file name and an optional flag. | |
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) | |
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. | |
BOOL | loadFromMemory (fipMemoryIO &memIO, int flag=0) |
Loads an image using the specified memory stream and an optional flag. | |
BOOL | save (const char *lpszPathName, int flag=0) const |
Saves an image to disk, given its file name and an optional flag. | |
BOOL | saveU (const wchar_t *lpszPathName, int flag=0) const |
UNICODE version of save (this function only works under WIN32 and does nothing on other OS) | |
BOOL | saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) const |
Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. | |
BOOL | saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) const |
Saves an image using the specified memory stream and an optional flag. | |
Information functions | |
Accessors to the DIB BITMAPINFO structure. | |
FREE_IMAGE_TYPE | getImageType () const |
Returns the data type of the image. | |
unsigned | getWidth () const |
Returns the image width in pixels. | |
unsigned | getHeight () const |
Returns the image height in pixels. | |
unsigned | getScanWidth () const |
Returns the width of the bitmap in bytes rounded to the nearest DWORD. | |
operator FIBITMAP * () | |
Returns a pointer to the FIBITMAP data. | |
BOOL | isValid () const |
Returns TRUE if the image is allocated, FALSE otherwise. | |
BITMAPINFO * | getInfo () const |
Returns a pointer to the bitmap's BITMAPINFO header. | |
BITMAPINFOHEADER * | getInfoHeader () const |
Returns a pointer to the bitmap's BITMAPINFOHEADER. | |
unsigned | getImageSize () const |
Returns the size of the bitmap in bytes. | |
unsigned | getImageMemorySize () const |
Returns the memory footprint of a bitmap, in bytes. | |
unsigned | getBitsPerPixel () const |
Returns the bitdepth of the bitmap. | |
unsigned | getLine () const |
Returns the width of the bitmap in bytes. | |
double | getHorizontalResolution () const |
Returns the bitmap resolution along the X axis, in pixels / cm. | |
double | getVerticalResolution () const |
Returns the bitmap resolution along the Y axis, in pixels / cm. | |
void | setHorizontalResolution (double value) |
set the bitmap resolution along the X axis, in pixels / cm | |
void | setVerticalResolution (double value) |
set the bitmap resolution along the Y axis, in pixels / cm | |
Palette operations | |
RGBQUAD * | getPalette () const |
Returns a pointer to the bitmap's palette. | |
unsigned | getPaletteSize () const |
Returns the palette size in bytes. | |
unsigned | getColorsUsed () const |
Retrieves the number of colours used in the bitmap. | |
FREE_IMAGE_COLOR_TYPE | getColorType () const |
Investigates the colour type of the bitmap. | |
BOOL | isGrayscale () const |
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise. | |
Thumbnail access | |
BOOL | getThumbnail (fipImage &image) const |
Retrieves a copy the thumbnail possibly attached to the bitmap. | |
BOOL | setThumbnail (const fipImage &image) |
Attach a thumbnail to the bitmap. | |
BOOL | hasThumbnail () const |
Check if the image has an embedded thumbnail. | |
BOOL | clearThumbnail () |
Clear the thumbnail possibly attached to the bitmap. | |
Pixel access | |
BYTE * | accessPixels () const |
Returns a pointer to the bitmap bits. | |
BYTE * | getScanLine (unsigned scanline) const |
Returns a pointer to the start of the given scanline in the bitmap’s data-bits. | |
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 (slow access). | |
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 access). | |
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 (slow access). | |
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 access). | |
Conversion routines | |
Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. | |
BOOL | convertToType (FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE) |
Converts an image to a type supported by FreeImage. | |
BOOL | threshold (BYTE T) |
Converts the bitmap to 1 bit using a threshold T. | |
BOOL | dither (FREE_IMAGE_DITHER algorithm) |
Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. | |
BOOL | convertTo4Bits () |
Converts the bitmap to 4 bits. | |
BOOL | convertTo8Bits () |
Converts the bitmap to 8 bits. | |
BOOL | convertToGrayscale () |
Converts the bitmap to 8 bits. | |
BOOL | colorQuantize (FREE_IMAGE_QUANTIZE algorithm) |
Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap. | |
BOOL | convertTo16Bits555 () |
Converts the bitmap to 16 bits. | |
BOOL | convertTo16Bits565 () |
Converts the bitmap to 16 bits. | |
BOOL | convertTo24Bits () |
Converts the bitmap to 24 bits. | |
BOOL | convertTo32Bits () |
Converts the bitmap to 32 bits. | |
BOOL | convertToFloat () |
Converts the bitmap to a 32-bit float image. | |
BOOL | convertToRGBF () |
Converts the bitmap to a 96-bit RGBF image. | |
BOOL | convertToRGBAF () |
Converts the bitmap to a 128-bit RGBAF image. | |
BOOL | convertToUINT16 () |
Converts the bitmap to a 16-bit unsigned short image. | |
BOOL | convertToRGB16 () |
Converts the bitmap to a 48-bit RGB16 image. | |
BOOL | convertToRGBA16 () |
Converts the bitmap to a 64-bit RGBA16 image. | |
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. | |
Transparency support: background colour and alpha channel | |
BOOL | isTransparent () const |
Returns TRUE if the image is transparent, returns FALSE otherwise. | |
unsigned | getTransparencyCount () const |
8-bit transparency : get the number of transparent colors. | |
BYTE * | getTransparencyTable () const |
8-bit transparency : get the bitmap’s transparency table. | |
void | setTransparencyTable (BYTE *table, int count) |
8-bit transparency : set the bitmap’s transparency table. | |
BOOL | hasFileBkColor () const |
Returns TRUE when the image has a file background color, FALSE otherwise. | |
BOOL | getFileBkColor (RGBQUAD *bkcolor) const |
Retrieves the file background color of an image. | |
BOOL | setFileBkColor (RGBQUAD *bkcolor) |
Set the file background color of an image. | |
Channel processing support | |
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. | |
BOOL | setChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) |
Insert a 8-bit dib into a 24- or 32-bit image. | |
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. | |
BOOL | combineChannels (fipImage &red, fipImage &green, fipImage &blue) |
Builds a 24-bit RGB image given its red, green and blue channel. | |
Rotation and flipping | |
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. | |
BOOL | rotate (double angle, const void *bkcolor=NULL) |
Image rotation by means of three shears. | |
BOOL | flipHorizontal () |
Flip the image horizontally along the vertical axis. | |
BOOL | flipVertical () |
Flip the image vertically along the horizontal axis. | |
Color manipulation routines | |
BOOL | invert () |
Inverts each pixel data. | |
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 table (LUT). | |
BOOL | adjustGamma (double gamma) |
Performs gamma correction on a 8, 24 or 32-bit image. | |
BOOL | adjustBrightness (double percentage) |
Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. | |
BOOL | adjustContrast (double percentage) |
Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. | |
BOOL | adjustBrightnessContrastGamma (double brightness, double contrast, double gamma) |
Adjusts an image's brightness, contrast and gamma within a single operation. | |
BOOL | getHistogram (DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const |
Computes image histogram. | |
Upsampling / downsampling | |
BOOL | rescale (unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter) |
Rescale the image to a new width / height. | |
BOOL | makeThumbnail (unsigned max_size, BOOL convert=TRUE) |
Creates a thumbnail image keeping aspect ratio. | |
Image status | |
void | setModified (BOOL bStatus=TRUE) |
Set the image status as 'modified'. | |
BOOL | isModified () |
Get the image status. | |
Metadata | |
unsigned | getMetadataCount (FREE_IMAGE_MDMODEL model) const |
Returns the number of tags contained in the model metadata model attached to the dib. | |
BOOL | getMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const |
Retrieve a metadata attached to the dib. | |
BOOL | setMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) |
Attach a new FreeImage tag to the dib. | |
Static Public Member Functions | |
File type identification | |
static FREE_IMAGE_FORMAT | identifyFIF (const char *lpszPathName) |
Identifies an image from disk, given its file name. | |
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) | |
static FREE_IMAGE_FORMAT | identifyFIFFromHandle (FreeImageIO *io, fi_handle handle) |
Identifies an image using the specified FreeImageIO struct and fi_handle. | |
static FREE_IMAGE_FORMAT | identifyFIFFromMemory (FIMEMORY *hmem) |
Identifies an image using the specified memory stream. | |
Protected Member Functions | |
Internal use | |
BOOL | replace (FIBITMAP *new_dib) |
Protected Attributes | |
FIBITMAP * | _dib |
DIB data. | |
FREE_IMAGE_FORMAT | _fif |
Original (or last saved) fif format if available, FIF_UNKNOWN otherwise. | |
BOOL | _bHasChanged |
TRUE whenever the display need to be refreshed. | |
Friends | |
class | fipMultiPage |
A class used to manage all photo related images and all image types used by the library.
fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for loading / saving images and for bit depth conversion.
fipImage::fipImage | ( | FREE_IMAGE_TYPE | image_type = FIT_BITMAP , |
unsigned | width = 0 , |
||
unsigned | height = 0 , |
||
unsigned | bpp = 0 |
||
) |
Constructor.
virtual fipImage::~fipImage | ( | ) | [virtual] |
Destructor.
fipImage::fipImage | ( | const fipImage & | src | ) |
Copy constructor.
BYTE* fipImage::accessPixels | ( | ) | const |
Returns a pointer to the bitmap bits.
It is up to you to interpret these bytes correctly, according to the results of FreeImage_GetBPP and GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
Use this function with getScanWidth to iterates through the pixels.
BOOL fipImage::adjustBrightness | ( | double | percentage | ) |
Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.
percentage | Where -100 <= percentage <= 100 A value 0 means no change, less than 0 will make the image darker and greater than 0 will make the image brighter. |
BOOL fipImage::adjustBrightnessContrastGamma | ( | double | brightness, |
double | contrast, | ||
double | gamma | ||
) |
Adjusts an image's brightness, contrast and gamma within a single operation.
If more than one of these image display properties need to be adjusted, using this function should be preferred over calling each adjustment function separately. That's particularly true for huge images or if performance is an issue.
BOOL fipImage::adjustContrast | ( | double | percentage | ) |
Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.
percentage | Where -100 <= percentage <= 100 A value 0 means no change, less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. |
BOOL fipImage::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 table (LUT).
The transformation is done as follows.
Image 8-bit : if the image has a color palette, the LUT is applied to this palette, otherwise, it is applied to the grey values.
Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only.
LUT | Lookup table. The size of 'LUT' is assumed to be 256. |
channel | The color channel to be processed (only used with 24 & 32-bit DIB). |
BOOL fipImage::adjustGamma | ( | double | gamma | ) |
Performs gamma correction on a 8, 24 or 32-bit image.
gamma | Gamma value to use. A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. |
virtual void fipImage::clear | ( | ) | [virtual] |
Destroy image data.
Reimplemented in fipWinImage.
BOOL fipImage::clearThumbnail | ( | ) |
Clear the thumbnail possibly attached to the bitmap.
BOOL fipImage::colorQuantize | ( | FREE_IMAGE_QUANTIZE | algorithm | ) |
Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
The quantize parameter specifies which colour reduction algorithm should be used.
algorithm | Color quantization algorithm to use. |
Builds a 24-bit RGB image given its red, green and blue channel.
red | Input red channel. |
green | Input green channel. |
blue | Input blue channel. |
BOOL fipImage::convertTo16Bits555 | ( | ) |
Converts the bitmap to 16 bits.
The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit.
BOOL fipImage::convertTo16Bits565 | ( | ) |
Converts the bitmap to 16 bits.
The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue.
BOOL fipImage::convertTo24Bits | ( | ) |
Converts the bitmap to 24 bits.
BOOL fipImage::convertTo32Bits | ( | ) |
Converts the bitmap to 32 bits.
BOOL fipImage::convertTo4Bits | ( | ) |
Converts the bitmap to 4 bits.
Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale.
BOOL fipImage::convertTo8Bits | ( | ) |
Converts the bitmap to 8 bits.
If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale.
BOOL fipImage::convertToFloat | ( | ) |
Converts the bitmap to a 32-bit float image.
BOOL fipImage::convertToGrayscale | ( | ) |
Converts the bitmap to 8 bits.
For palletized bitmaps, the color map is converted to a greyscale ramp.
BOOL fipImage::convertToRGB16 | ( | ) |
Converts the bitmap to a 48-bit RGB16 image.
BOOL fipImage::convertToRGBA16 | ( | ) |
Converts the bitmap to a 64-bit RGBA16 image.
BOOL fipImage::convertToRGBAF | ( | ) |
Converts the bitmap to a 128-bit RGBAF image.
BOOL fipImage::convertToRGBF | ( | ) |
Converts the bitmap to a 96-bit RGBF image.
BOOL fipImage::convertToType | ( | FREE_IMAGE_TYPE | image_type, |
BOOL | scale_linear = TRUE |
||
) |
Converts an image to a type supported by FreeImage.
image_type | New image type |
scale_linear | TRUE if image pixels must be scaled linearly when converting to a standard bitmap |
BOOL fipImage::convertToUINT16 | ( | ) |
Converts the bitmap to a 16-bit unsigned short image.
BOOL fipImage::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.
This method works with any bitmap type.
dst | Output subimage |
left | Specifies the left position of the cropped rectangle. |
top | Specifies the top position of the cropped rectangle. |
right | Specifies the right position of the cropped rectangle. |
bottom | Specifies the bottom position of the cropped rectangle. |
BOOL fipImage::crop | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Crop a sub part of the current image and update it accordingly.
This method works with any bitmap type.
left | Specifies the left position of the cropped rectangle. |
top | Specifies the top position of the cropped rectangle. |
right | Specifies the right position of the cropped rectangle. |
bottom | Specifies the bottom position of the cropped rectangle. |
BOOL fipImage::dither | ( | FREE_IMAGE_DITHER | algorithm | ) |
Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.
algorithm | Dithering algorithm to use. |
BOOL fipImage::flipHorizontal | ( | ) |
Flip the image horizontally along the vertical axis.
BOOL fipImage::flipVertical | ( | ) |
Flip the image vertically along the horizontal axis.
unsigned fipImage::getBitsPerPixel | ( | ) | const |
Returns the bitdepth of the bitmap.
When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32.
BOOL fipImage::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.
image | Output image to be extracted |
channel | Color channel to extract |
unsigned fipImage::getColorsUsed | ( | ) | const |
Retrieves the number of colours used in the bitmap.
If the bitmap is non-palletised, 0 is returned.
FREE_IMAGE_COLOR_TYPE fipImage::getColorType | ( | ) | const |
Investigates the colour type of the bitmap.
BOOL fipImage::getFileBkColor | ( | RGBQUAD * | bkcolor | ) | const |
Retrieves the file background color of an image.
For 8-bit images, the color index in the palette is returned in the rgbReserved member of the bkcolor parameter.
unsigned fipImage::getHeight | ( | ) | const |
Returns the image height in pixels.
BOOL fipImage::getHistogram | ( | DWORD * | histo, |
FREE_IMAGE_COLOR_CHANNEL | channel = FICC_BLACK |
||
) | const |
Computes image histogram.
For 24-bit and 32-bit images, histogram can be computed from red, green, blue and black channels. For 8-bit images, histogram is computed from the black channel. Other bit depth is not supported.
histo | pointer to an histogram array. Size of this array is assumed to be 256. |
channel | Color channel to use |
double fipImage::getHorizontalResolution | ( | ) | const |
Returns the bitmap resolution along the X axis, in pixels / cm.
unsigned fipImage::getImageMemorySize | ( | ) | const |
Returns the memory footprint of a bitmap, in bytes.
unsigned fipImage::getImageSize | ( | ) | const |
Returns the size of the bitmap in bytes.
The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data.
FREE_IMAGE_TYPE fipImage::getImageType | ( | ) | const |
Returns the data type of the image.
BITMAPINFO* fipImage::getInfo | ( | ) | const |
Returns a pointer to the bitmap's BITMAPINFO header.
BITMAPINFOHEADER* fipImage::getInfoHeader | ( | ) | const |
Returns a pointer to the bitmap's BITMAPINFOHEADER.
unsigned fipImage::getLine | ( | ) | const |
Returns the width of the bitmap in bytes.
This is not the size of the scanline.
BOOL fipImage::getMetadata | ( | FREE_IMAGE_MDMODEL | model, |
const char * | key, | ||
fipTag & | tag | ||
) | const |
Retrieve a metadata attached to the dib.
model | Metadata model to look for |
key | Metadata field name |
tag | Returned tag |
unsigned fipImage::getMetadataCount | ( | FREE_IMAGE_MDMODEL | model | ) | const |
Returns the number of tags contained in the model metadata model attached to the dib.
model | Metadata model to look for |
RGBQUAD* fipImage::getPalette | ( | ) | const |
Returns a pointer to the bitmap's palette.
If the bitmap doesn't have a palette, getPalette returns NULL.
unsigned fipImage::getPaletteSize | ( | ) | const |
Returns the palette size in bytes.
BOOL fipImage::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 access).
x | Pixel position in horizontal direction |
y | Pixel position in vertical direction |
value | Pixel color (returned value) |
BOOL fipImage::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 (slow access).
x | Pixel position in horizontal direction |
y | Pixel position in vertical direction |
value | Pixel index (returned value) |
BYTE* fipImage::getScanLine | ( | unsigned | scanline | ) | const |
Returns a pointer to the start of the given scanline in the bitmap’s data-bits.
This pointer can be cast according to the result returned by getImageType.
Use this function with getScanWidth to iterates through the pixels.
unsigned fipImage::getScanWidth | ( | ) | const |
Returns the width of the bitmap in bytes rounded to the nearest DWORD.
BOOL fipImage::getThumbnail | ( | fipImage & | image | ) | const |
Retrieves a copy the thumbnail possibly attached to the bitmap.
unsigned fipImage::getTransparencyCount | ( | ) | const |
8-bit transparency : get the number of transparent colors.
BYTE* fipImage::getTransparencyTable | ( | ) | const |
8-bit transparency : get the bitmap’s transparency table.
double fipImage::getVerticalResolution | ( | ) | const |
Returns the bitmap resolution along the Y axis, in pixels / cm.
unsigned fipImage::getWidth | ( | ) | const |
Returns the image width in pixels.
BOOL fipImage::hasFileBkColor | ( | ) | const |
Returns TRUE when the image has a file background color, FALSE otherwise.
BOOL fipImage::hasThumbnail | ( | ) | const |
Check if the image has an embedded thumbnail.
static FREE_IMAGE_FORMAT fipImage::identifyFIF | ( | const char * | lpszPathName | ) | [static] |
Identifies an image from disk, given its file name.
lpszPathName | Path and file name of the image to identify. |
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle | ( | FreeImageIO * | io, |
fi_handle | handle | ||
) | [static] |
Identifies an image using the specified FreeImageIO struct and fi_handle.
io | FreeImageIO structure |
handle | FreeImage fi_handle |
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory | ( | FIMEMORY * | hmem | ) | [static] |
Identifies an image using the specified memory stream.
hmem | FreeImage memory stream |
static FREE_IMAGE_FORMAT fipImage::identifyFIFU | ( | const wchar_t * | lpszPathName | ) | [static] |
UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS)
BOOL fipImage::invert | ( | ) |
Inverts each pixel data.
BOOL fipImage::isGrayscale | ( | ) | const |
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
BOOL fipImage::isModified | ( | ) | [inline] |
Get the image status.
BOOL fipImage::isTransparent | ( | ) | const |
Returns TRUE if the image is transparent, returns FALSE otherwise.
BOOL fipImage::isValid | ( | ) | const [virtual] |
Returns TRUE if the image is allocated, FALSE otherwise.
Implements fipObject.
Reimplemented in fipWinImage.
BOOL fipImage::load | ( | const char * | lpszPathName, |
int | flag = 0 |
||
) |
Loads an image from disk, given its file name and an optional flag.
lpszPathName | Path and file name of the image to load. |
flag | The signification of this flag depends on the image to be read. |
BOOL fipImage::loadFromHandle | ( | FreeImageIO * | io, |
fi_handle | handle, | ||
int | flag = 0 |
||
) |
Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag.
io | FreeImageIO structure |
handle | FreeImage fi_handle |
flag | The signification of this flag depends on the image to be read. |
BOOL fipImage::loadFromMemory | ( | fipMemoryIO & | memIO, |
int | flag = 0 |
||
) |
Loads an image using the specified memory stream and an optional flag.
memIO | FreeImage memory stream |
flag | The signification of this flag depends on the image to be read. |
BOOL fipImage::loadU | ( | const wchar_t * | lpszPathName, |
int | flag = 0 |
||
) |
UNICODE version of load (this function only works under WIN32 and does nothing on other OS)
BOOL fipImage::makeThumbnail | ( | unsigned | max_size, |
BOOL | convert = TRUE |
||
) |
Creates a thumbnail image keeping aspect ratio.
max_size | Maximum width or height in pixel units |
convert | When set to TRUE, converts the image to a standard type |
fipImage::operator FIBITMAP * | ( | ) | [inline] |
Returns a pointer to the FIBITMAP data.
Used for direct access from FREEIMAGE functions or from your own low level C functions.
Sample use :
fipImage src, dst; src.load("test.png"); dst = FreeImage_ConvertTo8Bits(src); FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
fipImage& fipImage::operator= | ( | FIBITMAP * | dib | ) |
Assignement operator
Copy the input pointer and manage its destruction
BOOL fipImage::pasteSubImage | ( | fipImage & | src, |
int | left, | ||
int | top, | ||
int | alpha = 256 |
||
) |
Alpha blend or combine a sub part image with the current image.
The bit depth of dst bitmap must be greater than or equal to the bit depth of src. Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32.
src | Source subimage |
left | Specifies the left position of the sub image. |
top | Specifies the top position of the sub image. |
alpha | Alpha blend factor. The source and destination images are alpha blended if alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. |
BOOL fipImage::rescale | ( | unsigned | new_width, |
unsigned | new_height, | ||
FREE_IMAGE_FILTER | filter | ||
) |
Rescale the image to a new width / height.
new_width | New image width |
new_height | New image height |
filter | The filter parameter specifies which resampling filter should be used. |
BOOL fipImage::rotate | ( | double | angle, |
const void * | bkcolor = NULL |
||
) |
Image rotation by means of three shears.
angle | Image rotation angle, in degree |
bkcolor | Background color (image type dependent), default to black background |
BOOL fipImage::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.
angle | Image rotation angle, in degree |
x_shift | Image horizontal shift |
y_shift | Image vertical shift |
x_origin | Origin of the x-axis |
y_origin | Origin of the y-axis |
use_mask | Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE |
BOOL fipImage::save | ( | const char * | lpszPathName, |
int | flag = 0 |
||
) | const |
Saves an image to disk, given its file name and an optional flag.
lpszPathName | Path and file name of the image to save. |
flag | The signification of this flag depends on the image to be saved. |
BOOL fipImage::saveToHandle | ( | FREE_IMAGE_FORMAT | fif, |
FreeImageIO * | io, | ||
fi_handle | handle, | ||
int | flag = 0 |
||
) | const |
Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag.
fif | Format identifier (FreeImage format) |
io | FreeImageIO structure |
handle | FreeImage fi_handle |
flag | The signification of this flag depends on the image to be saved. |
BOOL fipImage::saveToMemory | ( | FREE_IMAGE_FORMAT | fif, |
fipMemoryIO & | memIO, | ||
int | flag = 0 |
||
) | const |
Saves an image using the specified memory stream and an optional flag.
fif | Format identifier (FreeImage format) |
memIO | FreeImage memory stream |
flag | The signification of this flag depends on the image to be saved. |
BOOL fipImage::saveU | ( | const wchar_t * | lpszPathName, |
int | flag = 0 |
||
) | const |
UNICODE version of save (this function only works under WIN32 and does nothing on other OS)
BOOL fipImage::setChannel | ( | fipImage & | image, |
FREE_IMAGE_COLOR_CHANNEL | channel | ||
) |
Insert a 8-bit dib into a 24- or 32-bit image.
image | Input 8-bit image to insert |
channel | Color channel to replace |
BOOL fipImage::setFileBkColor | ( | RGBQUAD * | bkcolor | ) |
Set the file background color of an image.
When saving an image to PNG, this background color is transparently saved to the PNG file. When the bkcolor parameter is NULL, the background color is removed from the image.
void fipImage::setHorizontalResolution | ( | double | value | ) |
set the bitmap resolution along the X axis, in pixels / cm
BOOL fipImage::setMetadata | ( | FREE_IMAGE_MDMODEL | model, |
const char * | key, | ||
fipTag & | tag | ||
) |
Attach a new FreeImage tag to the dib.
Sample use :
fipImage image; ... fipTag tag; tag.setKeyValue("Caption/Abstract", "my caption"); image.setMetadata(FIMD_IPTC, tag.getKey(), tag); tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression"); image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
model | Metadata model used to store the tag |
key | Tag field name |
tag | Tag to be attached |
void fipImage::setModified | ( | BOOL | bStatus = TRUE | ) | [inline] |
Set the image status as 'modified'.
When using the fipWinImage class, the image status is used to refresh the display. It is changed to FALSE whenever the display has just been refreshed.
bStatus | TRUE if the image should be marked as modified, FALSE otherwise |
BOOL fipImage::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 access).
x | Pixel position in horizontal direction |
y | Pixel position in vertical direction |
value | Pixel color |
BOOL fipImage::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 (slow access).
x | Pixel position in horizontal direction |
y | Pixel position in vertical direction |
value | Pixel index |
BOOL fipImage::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.
BOOL fipImage::setThumbnail | ( | const fipImage & | image | ) |
Attach a thumbnail to the bitmap.
void fipImage::setTransparencyTable | ( | BYTE * | table, |
int | count | ||
) |
8-bit transparency : set the bitmap’s transparency table.
void fipImage::setVerticalResolution | ( | double | value | ) |
set the bitmap resolution along the Y axis, in pixels / cm
BOOL fipImage::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.
RedChannel | Output red channel. |
GreenChannel | Output green channel. |
BlueChannel | Output blue channel. |
BOOL fipImage::threshold | ( | BYTE | T | ) |
Converts the bitmap to 1 bit using a threshold T.
T | Threshold value in [0..255] |
BOOL fipImage::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.
tmo | Tone mapping operator |
first_param | First tone mapping algorithm parameter (algorithm dependant) |
second_param | Second tone mapping algorithm parameter (algorithm dependant) |
third_param | Third tone mapping algorithm parameter (algorithm dependant) |
fourth_param | Fourth tone mapping algorithm parameter (algorithm dependant) |
BOOL fipImage::_bHasChanged [mutable, protected] |
TRUE whenever the display need to be refreshed.
FIBITMAP* fipImage::_dib [protected] |
DIB data.
FREE_IMAGE_FORMAT fipImage::_fif [protected] |
Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.