#include <FreeImagePlus.h>
Inheritance diagram for fipImage:
fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for loading / saving images and for bit depth conversion.
Public Member Functions | |
Creation & Destruction | |
fipImage (WORD width=0, WORD height=0, WORD bpp=0) | |
Constructor. | |
~fipImage () | |
Destructor. | |
BOOL | setSize (WORD width, WORD height, WORD bpp) |
Image allocator. | |
Copying | |
fipImage (const fipImage &src) | |
Copy constructor. | |
fipImage (const FIBITMAP *dib) | |
Copy constructor. | |
fipImage & | operator= (const fipImage &src) |
Copy constructor. | |
fipImage & | operator= (FIBITMAP *dib) |
Assignement operator. | |
BOOL | copySubImage (fipImage &dst, int left, int top, int right, int bottom) |
The bit depth of the bitmap must be equal to 1, 4, 8, 16, 24 or 32. | |
BOOL | pasteSubImage (fipImage &src, int left, int top, int alpha=256) |
Alpha blend or combine a sub part image with the current image. | |
Loading & Saving | |
Loading and saving is handled by the FreeImage library. | |
BOOL | load (const char *lpszPathName, int flag=0) |
BOOL | loadFromHandle (FreeImageIO *io, fi_handle handle, int flag=0) |
BOOL | save (const char *lpszPathName, int flag=0) |
BOOL | saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) |
Information functions | |
Accessors to the DIB BITMAPINFO structure. | |
FIBITMAP * | getFIBITMAP () |
Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions. | |
BOOL | isValid () |
Returns TRUE if the image is allocated, FALSE otherwise. | |
BITMAPINFO * | getInfo () |
Returns a pointer to the bitmap's BITMAPINFO header. | |
BITMAPINFOHEADER * | getInfoHeader () |
Returns a pointer to the bitmap's BITMAPINFOHEADER. | |
LONG | getImageSize () |
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. | |
WORD | getBitsPerPixel () |
Returns the bitdepth of the bitmap. | |
WORD | getLine () |
Returns the width of the bitmap in bytes. | |
WORD | getHorizontalResolution () |
Returns the bitmap resolution along the X axis, in pixels / cm. | |
WORD | getVerticalResolution () |
Returns the bitmap resolution along the Y axis, in pixels / cm. | |
void | setHorizontalResolution (LONG value) |
set the bitmap resolution along the X axis, in pixels / cm | |
void | setVerticalResolution (LONG value) |
set the bitmap resolution along the Y axis, in pixels / cm | |
Palette operations | |
RGBQUAD * | getPalette () |
Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. | |
WORD | getPaletteSize () |
Returns the palette size in bytes. | |
WORD | getColorsUsed () |
Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. | |
FREE_IMAGE_COLOR_TYPE | getColorType () |
Investigates the colour type of the bitmap. | |
BOOL | isGrayscale () |
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise. | |
Pixel access | |
BYTE * | accessPixels () |
Returns a pointer to the bitmap bits. | |
BYTE * | getScanLine (int scanline) |
Returns a pointer to the start of the given scanline in the bitmap’s data-bits. | |
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 | threshold (BYTE T) |
Converts the bitmap to 1 bit using a threshold T. | |
BOOL | convertTo8Bits () |
Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. | |
BOOL | 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 | 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 | convertTo24Bits () |
Converts the bitmap to 24 bits. | |
BOOL | convertTo32Bits () |
Converts the bitmap to 32 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 | dither (FREE_IMAGE_DITHER algorithm) |
Converts a 8-bit image to a monochrome image using a dithering algorithm. | |
Channel processing support | |
BOOL | getChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) |
Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] 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 | getRedChannel (fipImage &red) |
Retrieves the red channel of a 24-bit RGB image. | |
BOOL | getGreenChannel (fipImage &green) |
Retrieves the green channel of a 24-bit RGB image. | |
BOOL | getBlueChannel (fipImage &blue) |
Retrieves the blue channel of a 24-bit RGB image. | |
BOOL | getAlphaChannel (fipImage &alpha) |
Retrieves the alpha channel of a 32-bit RGB image. | |
BOOL | setAlphaChannel (fipImage &alpha) |
Set the alpha channel of a 32-bit RGB image. | |
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) |
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 | getHistogram (DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) |
Computes image histogram. | |
Upsampling / downsampling | |
BOOL | rescale (WORD new_width, WORD new_height, FREE_IMAGE_FILTER filter) |
Rescale the image to a new width / height. | |
Protected Member Functions | |
Internal use | |
void | updateInfo () |
BOOL | replace (FIBITMAP *new_dib) |
BOOL | replace (fipImage &img) |
Protected Attributes | |
FIBITMAP * | m_dib |
DIB data. | |
BYTE * | m_bits |
Pointer to DIB pixels. |
|
Constructor.
|
|
Destructor.
|
|
Copy constructor.
|
|
Copy constructor.
|
|
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.
|
|
Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.
|
|
Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.
|
|
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.
|
|
Performs gamma correction on a 8, 24 or 32-bit image.
|
|
Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap. The quantize parameter specifies which colour reduction algorithm should be used.
|
|
Builds a 24-bit RGB image given its red, green and blue channel.
|
|
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.
|
|
Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue.
|
|
Converts the bitmap to 24 bits.
|
|
Converts the bitmap to 32 bits.
|
|
Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale.
|
|
Converts the bitmap to 8 bits. For palletized bitmaps, the color map is converted to a greyscale ramp.
|
|
The bit depth of the bitmap must be equal to 1, 4, 8, 16, 24 or 32.
|
|
Converts a 8-bit image to a monochrome image using a dithering algorithm.
|
|
Flip the image horizontally along the vertical axis.
|
|
Flip the image vertically along the horizontal axis.
|
|
Retrieves the alpha channel of a 32-bit RGB image.
|
|
Returns the bitdepth of the bitmap.
|
|
Retrieves the blue channel of a 24-bit RGB image.
|
|
Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image.
|
|
Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned.
|
|
Investigates the colour type of the bitmap.
|
|
Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions.
|
|
Retrieves the green channel of a 24-bit RGB image.
|
|
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.
|
|
Returns the bitmap resolution along the X axis, in pixels / cm.
|
|
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.
|
|
Returns a pointer to the bitmap's BITMAPINFO header.
|
|
Returns a pointer to the bitmap's BITMAPINFOHEADER.
|
|
Returns the width of the bitmap in bytes.
|
|
Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL.
|
|
Returns the palette size in bytes.
|
|
Retrieves the red channel of a 24-bit RGB image.
|
|
Returns a pointer to the start of the given scanline in the bitmap’s data-bits.
|
|
Returns the bitmap resolution along the Y axis, in pixels / cm.
|
|
Inverts each pixel data.
|
|
Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
|
|
Returns TRUE if the image is allocated, FALSE otherwise.
Implements fipGenericImage. |
|
|
|
|
|
Assignement operator.
|
|
Copy constructor.
|
|
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 8, 16, 24 or 32.
|
|
Rescale the image to a new width / height.
|
|
Image rotation by means of three shears.
|
|
Image translation and rotation using B-Splines.
|
|
|
|
|
|
Set the alpha channel of a 32-bit RGB image.
|
|
set the bitmap resolution along the X axis, in pixels / cm
|
|
Image allocator.
|
|
set the bitmap resolution along the Y axis, in pixels / cm
|
|
Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels.
|
|
Converts the bitmap to 1 bit using a threshold T.
|
|
Pointer to DIB pixels.
|
|
DIB data.
|