FreeImagePlus - FreeImage 3.17.0
Protected Attributes | Friends
fipImage Class Reference

A class used to manage all photo related images and all image types used by the library. More...

#include <FreeImagePlus.h>

Inheritance diagram for fipImage:
fipObject fipWinImage

List of all members.

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.
fipImageoperator= (const fipImage &src)
 Copy constructor.
fipImageoperator= (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.
BITMAPINFOgetInfo () const
 Returns a pointer to the bitmap's BITMAPINFO header.
BITMAPINFOHEADERgetInfoHeader () 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
RGBQUADgetPalette () 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

Detailed Description

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.

Version:
FreeImage 3
Author:
Hervé Drolon

Constructor & Destructor Documentation

fipImage::fipImage ( FREE_IMAGE_TYPE  image_type = FIT_BITMAP,
unsigned  width = 0,
unsigned  height = 0,
unsigned  bpp = 0 
)

Constructor.

See also:
FreeImage_AllocateT
virtual fipImage::~fipImage ( ) [virtual]

Destructor.

fipImage::fipImage ( const fipImage src)

Copy constructor.

See also:
FreeImage_Clone

Member Function Documentation

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.

See also:
FreeImage_GetBits
BOOL fipImage::adjustBrightness ( double  percentage)

Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.

Parameters:
percentageWhere -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.
Returns:
Returns TRUE if the operation was succesful, FALSE otherwise
See also:
FreeImage_AdjustBrightness, adjustCurve
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.

See also:
adjustBrightness
adjustContrast
adjustGamma
FreeImage_AdjustColors
BOOL fipImage::adjustContrast ( double  percentage)

Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.

Parameters:
percentageWhere -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.
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
See also:
FreeImage_AdjustContrast, adjustCurve
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.

Parameters:
LUTLookup table. The size of 'LUT' is assumed to be 256.
channelThe color channel to be processed (only used with 24 & 32-bit DIB).
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
See also:
FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL
BOOL fipImage::adjustGamma ( double  gamma)

Performs gamma correction on a 8, 24 or 32-bit image.

Parameters:
gammaGamma value to use. A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it.
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
See also:
FreeImage_AdjustGamma, adjustCurve
virtual void fipImage::clear ( ) [virtual]

Destroy image data.

Reimplemented in fipWinImage.

BOOL fipImage::clearThumbnail ( )

Clear the thumbnail possibly attached to the bitmap.

Returns:
Returns TRUE if successful, returns FALSe otherwise
See also:
FreeImage_SetThumbnail
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.

Parameters:
algorithmColor quantization algorithm to use.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE
BOOL fipImage::combineChannels ( fipImage red,
fipImage green,
fipImage blue 
)

Builds a 24-bit RGB image given its red, green and blue channel.

Parameters:
redInput red channel.
greenInput green channel.
blueInput blue channel.
Returns:
Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise.
See also:
FreeImage_SetChannel
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.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo16Bits555
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.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo16Bits565
BOOL fipImage::convertTo24Bits ( )

Converts the bitmap to 24 bits.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo24Bits
BOOL fipImage::convertTo32Bits ( )

Converts the bitmap to 32 bits.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo32Bits
BOOL fipImage::convertTo4Bits ( )

Converts the bitmap to 4 bits.

Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo4Bits
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.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertTo8Bits
BOOL fipImage::convertToFloat ( )

Converts the bitmap to a 32-bit float image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToFloat
BOOL fipImage::convertToGrayscale ( )

Converts the bitmap to 8 bits.


For palletized bitmaps, the color map is converted to a greyscale ramp.

See also:
FreeImage_ConvertToGreyscale
Returns:
Returns TRUE if successful, FALSE otherwise.
BOOL fipImage::convertToRGB16 ( )

Converts the bitmap to a 48-bit RGB16 image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToRGB16
BOOL fipImage::convertToRGBA16 ( )

Converts the bitmap to a 64-bit RGBA16 image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToRGBA16
BOOL fipImage::convertToRGBAF ( )

Converts the bitmap to a 128-bit RGBAF image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToRGBAF
BOOL fipImage::convertToRGBF ( )

Converts the bitmap to a 96-bit RGBF image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToRGBF
BOOL fipImage::convertToType ( FREE_IMAGE_TYPE  image_type,
BOOL  scale_linear = TRUE 
)

Converts an image to a type supported by FreeImage.

Parameters:
image_typeNew image type
scale_linearTRUE if image pixels must be scaled linearly when converting to a standard bitmap
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToType, FreeImage_ConvertToStandardType
BOOL fipImage::convertToUINT16 ( )

Converts the bitmap to a 16-bit unsigned short image.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ConvertToUINT16
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.

Parameters:
dstOutput subimage
leftSpecifies the left position of the cropped rectangle.
topSpecifies the top position of the cropped rectangle.
rightSpecifies the right position of the cropped rectangle.
bottomSpecifies the bottom position of the cropped rectangle.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Copy
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.

Parameters:
leftSpecifies the left position of the cropped rectangle.
topSpecifies the top position of the cropped rectangle.
rightSpecifies the right position of the cropped rectangle.
bottomSpecifies the bottom position of the cropped rectangle.
Returns:
Returns TRUE if successful, FALSE otherwise.
BOOL fipImage::dither ( FREE_IMAGE_DITHER  algorithm)

Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.

Parameters:
algorithmDithering algorithm to use.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Dither, FREE_IMAGE_DITHER
BOOL fipImage::flipHorizontal ( )

Flip the image horizontally along the vertical axis.

See also:
FreeImage_FlipHorizontal
BOOL fipImage::flipVertical ( )

Flip the image vertically along the horizontal axis.

See also:
FreeImage_FlipVertical
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.

See also:
FreeImage_GetBPP, getImageType
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.

Parameters:
imageOutput image to be extracted
channelColor channel to extract
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL
unsigned fipImage::getColorsUsed ( ) const

Retrieves the number of colours used in the bitmap.

If the bitmap is non-palletised, 0 is returned.

See also:
FreeImage_GetColorsUsed
FREE_IMAGE_COLOR_TYPE fipImage::getColorType ( ) const

Investigates the colour type of the bitmap.

See also:
FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE
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.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_GetBackgroundColor
unsigned fipImage::getHeight ( ) const

Returns the image height in pixels.

See also:
FreeImage_GetHeight
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.

Parameters:
histopointer to an histogram array. Size of this array is assumed to be 256.
channelColor channel to use
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
See also:
FreeImage_GetHistogram
double fipImage::getHorizontalResolution ( ) const

Returns the bitmap resolution along the X axis, in pixels / cm.

See also:
FreeImage_GetDotsPerMeterX
unsigned fipImage::getImageMemorySize ( ) const

Returns the memory footprint of a bitmap, in bytes.

See also:
FreeImage_GetMemorySize
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.

See also:
FreeImage_GetDIBSize
FREE_IMAGE_TYPE fipImage::getImageType ( ) const

Returns the data type of the image.

See also:
FreeImage_GetImageType
BITMAPINFO* fipImage::getInfo ( ) const

Returns a pointer to the bitmap's BITMAPINFO header.

See also:
FreeImage_GetInfo
BITMAPINFOHEADER* fipImage::getInfoHeader ( ) const

Returns a pointer to the bitmap's BITMAPINFOHEADER.

See also:
FreeImage_GetInfoHeader
unsigned fipImage::getLine ( ) const

Returns the width of the bitmap in bytes.


This is not the size of the scanline.

See also:
FreeImage_GetLine, getScanWidth
BOOL fipImage::getMetadata ( FREE_IMAGE_MDMODEL  model,
const char *  key,
fipTag tag 
) const

Retrieve a metadata attached to the dib.

Parameters:
modelMetadata model to look for
keyMetadata field name
tagReturned tag
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
See also:
FreeImage_GetMetadata
unsigned fipImage::getMetadataCount ( FREE_IMAGE_MDMODEL  model) const

Returns the number of tags contained in the model metadata model attached to the dib.

Parameters:
modelMetadata 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.

See also:
FreeImage_GetPalette
unsigned fipImage::getPaletteSize ( ) const

Returns the palette size in bytes.

See also:
FreeImage_GetColorsUsed
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).

Parameters:
xPixel position in horizontal direction
yPixel position in vertical direction
valuePixel color (returned value)
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_GetPixelColor
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).

Parameters:
xPixel position in horizontal direction
yPixel position in vertical direction
valuePixel index (returned value)
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_GetPixelIndex
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.

See also:
FreeImage_GetScanLine, FreeImage documentation
unsigned fipImage::getScanWidth ( ) const

Returns the width of the bitmap in bytes rounded to the nearest DWORD.

See also:
FreeImage_GetPitch
BOOL fipImage::getThumbnail ( fipImage image) const

Retrieves a copy the thumbnail possibly attached to the bitmap.

Returns:
Returns TRUE if the thumbnail is present in the bitmap and successfuly retrieved, returns FALSE otherwise
See also:
FreeImage_GetThumbnail
unsigned fipImage::getTransparencyCount ( ) const

8-bit transparency : get the number of transparent colors.

Returns:
Returns the number of transparent colors in a palletised bitmap.
See also:
FreeImage_GetTransparencyCount
BYTE* fipImage::getTransparencyTable ( ) const

8-bit transparency : get the bitmap’s transparency table.

Returns:
Returns a pointer to the bitmap’s transparency table.
See also:
FreeImage_GetTransparencyTable
double fipImage::getVerticalResolution ( ) const

Returns the bitmap resolution along the Y axis, in pixels / cm.

See also:
FreeImage_GetDotsPerMeterY
unsigned fipImage::getWidth ( ) const

Returns the image width in pixels.

See also:
FreeImage_GetWidth
BOOL fipImage::hasFileBkColor ( ) const

Returns TRUE when the image has a file background color, FALSE otherwise.

See also:
FreeImage_HasBackgroundColor
BOOL fipImage::hasThumbnail ( ) const

Check if the image has an embedded thumbnail.

Returns:
Returns TRUE if a thumbnail is present in the bitmap, returns FALSE otherwise
See also:
FreeImage_GetThumbnail
static FREE_IMAGE_FORMAT fipImage::identifyFIF ( const char *  lpszPathName) [static]

Identifies an image from disk, given its file name.

Parameters:
lpszPathNamePath and file name of the image to identify.
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
See also:
FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle ( FreeImageIO *  io,
fi_handle  handle 
) [static]

Identifies an image using the specified FreeImageIO struct and fi_handle.

Parameters:
ioFreeImageIO structure
handleFreeImage fi_handle
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
See also:
FreeImage_GetFileTypeFromHandle, FreeImage documentation
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory ( FIMEMORY *  hmem) [static]

Identifies an image using the specified memory stream.

Parameters:
hmemFreeImage memory stream
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
See also:
FreeImage_GetFileTypeFromMemory, FreeImage documentation
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)

See also:
FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation
BOOL fipImage::invert ( )

Inverts each pixel data.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Invert
BOOL fipImage::isGrayscale ( ) const

Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.

See also:
FreeImage_GetBPP, FreeImage_GetColorType
BOOL fipImage::isModified ( ) [inline]

Get the image status.

Returns:
Returns TRUE if the image is marked as modified, FALSE otherwise
See also:
setModified
BOOL fipImage::isTransparent ( ) const

Returns TRUE if the image is transparent, returns FALSE otherwise.

See also:
FreeImage_IsTransparent
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.

Parameters:
lpszPathNamePath and file name of the image to load.
flagThe signification of this flag depends on the image to be read.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Load, FreeImage documentation
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.

Parameters:
ioFreeImageIO structure
handleFreeImage fi_handle
flagThe signification of this flag depends on the image to be read.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_LoadFromHandle, FreeImage documentation
BOOL fipImage::loadFromMemory ( fipMemoryIO memIO,
int  flag = 0 
)

Loads an image using the specified memory stream and an optional flag.

Parameters:
memIOFreeImage memory stream
flagThe signification of this flag depends on the image to be read.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_LoadFromMemory, FreeImage documentation
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)

See also:
load
BOOL fipImage::makeThumbnail ( unsigned  max_size,
BOOL  convert = TRUE 
)

Creates a thumbnail image keeping aspect ratio.

Parameters:
max_sizeMaximum width or height in pixel units
convertWhen set to TRUE, converts the image to a standard type
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
See also:
FreeImage_MakeThumbnail
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);
	
See also:
operator=(FIBITMAP *dib)
fipImage& fipImage::operator= ( FIBITMAP *  dib)

Assignement operator
Copy the input pointer and manage its destruction

See also:
operator FIBITMAP*()
fipImage& fipImage::operator= ( const fipImage src)

Copy constructor.

See also:
FreeImage_Clone

Reimplemented in fipWinImage.

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.

Parameters:
srcSource subimage
leftSpecifies the left position of the sub image.
topSpecifies the top position of the sub image.
alphaAlpha 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.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Paste
BOOL fipImage::rescale ( unsigned  new_width,
unsigned  new_height,
FREE_IMAGE_FILTER  filter 
)

Rescale the image to a new width / height.

Parameters:
new_widthNew image width
new_heightNew image height
filterThe filter parameter specifies which resampling filter should be used.
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
See also:
FreeImage_Rescale, FREE_IMAGE_FILTER
BOOL fipImage::rotate ( double  angle,
const void *  bkcolor = NULL 
)

Image rotation by means of three shears.

Parameters:
angleImage rotation angle, in degree
bkcolorBackground color (image type dependent), default to black background
Returns:
Returns rotated dib if successful, returns NULL otherwise
See also:
FreeImage_Rotate
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.

Parameters:
angleImage rotation angle, in degree
x_shiftImage horizontal shift
y_shiftImage vertical shift
x_originOrigin of the x-axis
y_originOrigin of the y-axis
use_maskWhether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE
Returns:
Returns the translated & rotated dib if successful, returns NULL otherwise
See also:
FreeImage_RotateEx
BOOL fipImage::save ( const char *  lpszPathName,
int  flag = 0 
) const

Saves an image to disk, given its file name and an optional flag.

Parameters:
lpszPathNamePath and file name of the image to save.
flagThe signification of this flag depends on the image to be saved.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Save, FreeImage documentation
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.

Parameters:
fifFormat identifier (FreeImage format)
ioFreeImageIO structure
handleFreeImage fi_handle
flagThe signification of this flag depends on the image to be saved.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SaveToHandle, FreeImage documentation
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.

Parameters:
fifFormat identifier (FreeImage format)
memIOFreeImage memory stream
flagThe signification of this flag depends on the image to be saved.
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SaveToMemory, FreeImage documentation
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)

See also:
save
BOOL fipImage::setChannel ( fipImage image,
FREE_IMAGE_COLOR_CHANNEL  channel 
)

Insert a 8-bit dib into a 24- or 32-bit image.

Parameters:
imageInput 8-bit image to insert
channelColor channel to replace
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL
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.

Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SetBackgroundColor
void fipImage::setHorizontalResolution ( double  value)

set the bitmap resolution along the X axis, in pixels / cm

See also:
FreeImage_GetInfoHeader
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);
	
Parameters:
modelMetadata model used to store the tag
keyTag field name
tagTag to be attached
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
See also:
FreeImage_SetMetadata
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.

Parameters:
bStatusTRUE if the image should be marked as modified, FALSE otherwise
See also:
isModified
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).

Parameters:
xPixel position in horizontal direction
yPixel position in vertical direction
valuePixel color
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SetPixelColor
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).

Parameters:
xPixel position in horizontal direction
yPixel position in vertical direction
valuePixel index
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_SetPixelIndex
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.

See also:
FreeImage_AllocateT
BOOL fipImage::setThumbnail ( const fipImage image)

Attach a thumbnail to the bitmap.

Returns:
Returns TRUE if the thumbnail was successfuly set, returns FALSE otherwise
See also:
FreeImage_SetThumbnail
void fipImage::setTransparencyTable ( BYTE *  table,
int  count 
)

8-bit transparency : set the bitmap’s transparency table.

See also:
FreeImage_SetTransparencyTable
void fipImage::setVerticalResolution ( double  value)

set the bitmap resolution along the Y axis, in pixels / cm

See also:
FreeImage_GetInfoHeader
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.

Parameters:
RedChannelOutput red channel.
GreenChannelOutput green channel.
BlueChannelOutput blue channel.
Returns:
Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if one of the output channel can't be allocated. Returns TRUE otherwise.
See also:
FreeImage_GetChannel
BOOL fipImage::threshold ( BYTE  T)

Converts the bitmap to 1 bit using a threshold T.

Parameters:
TThreshold value in [0..255]
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_Threshold
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.

Parameters:
tmoTone mapping operator
first_paramFirst tone mapping algorithm parameter (algorithm dependant)
second_paramSecond tone mapping algorithm parameter (algorithm dependant)
third_paramThird tone mapping algorithm parameter (algorithm dependant)
fourth_paramFourth tone mapping algorithm parameter (algorithm dependant)
Returns:
Returns TRUE if successful, FALSE otherwise.
See also:
FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex

Member Data Documentation

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.


The documentation for this class was generated from the following file: