FreeImagePlus FreeImage 3.18.0
|
A class designed for MS Windows (TM) platforms. More...
#include <FreeImagePlus.h>
Public Member Functions | |
Creation & Destruction | |
fipWinImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0) | |
Constructor. | |
virtual | ~fipWinImage () |
Destructor. | |
virtual void | clear () |
Destroy image data. | |
BOOL | isValid () const |
Returns TRUE if the image is allocated, FALSE otherwise. | |
Copying | |
fipWinImage & | operator= (const fipImage &src) |
Copy constructor. | |
fipWinImage & | operator= (const fipWinImage &src) |
Copy constructor Delete internal _display_dib data and copy tone mapping parameters. | |
HANDLE | copyToHandle () const |
Clone function used for clipboard copy. | |
BOOL | copyFromHandle (HANDLE hMem) |
Copy constructor used for clipboard paste. | |
BOOL | copyFromBitmap (HBITMAP hbmp) |
Copy constructor. | |
Clipboard operations | |
BOOL | copyToClipboard (HWND hWndNewOwner) const |
Clipboard copy. | |
BOOL | pasteFromClipboard () |
Retrieves data from the clipboard. | |
Screen capture | |
BOOL | captureWindow (HWND hWndApplicationWindow, HWND hWndSelectedWindow) |
Capture a window and convert it to an image. | |
![]() | |
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. | |
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) |
BOOL | crop (int left, int top, int right, int bottom) |
Crop a sub part of the current image and update it accordingly. | |
BOOL | createView (fipImage &dynamicView, unsigned left, unsigned top, unsigned right, unsigned bottom) |
Returns a reference (a.k.a. | |
BOOL | load (const char *lpszPathName, int flag=0) |
Loads an image from disk, given its file name and an optional flag. | |
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. | |
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 | 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) | |
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 | loadFromMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) |
Loads an image using the specified fif and memory stream and an optional flag. | |
BOOL | save (const char *lpszPathName, int flag=0) |
Saves an image to disk, given its file name and an optional flag. | |
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. | |
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) | |
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) | |
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. | |
BOOL | saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) |
Saves an image using the specified memory stream and an optional flag. | |
FREE_IMAGE_TYPE | getImageType () const |
Returns the data type of the image. | |
FREE_IMAGE_FORMAT | getFIF () const |
Return the original (or last saved) fif format if available, returns FIF_UNKNOWN otherwise. | |
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. | |
const BITMAPINFO * | getInfo () const |
Returns a pointer to the bitmap's BITMAPINFO header. | |
const 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 | |
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. | |
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. | |
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 bitmaps 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). | |
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. | |
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 bitmaps transparency table. | |
void | setTransparencyTable (BYTE *table, int count) |
8-bit transparency : set the bitmaps 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. | |
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. | |
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. | |
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. | |
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. | |
void | setModified (BOOL bStatus=TRUE) |
Set the image status as 'modified'. | |
BOOL | isModified () |
Get the image status. | |
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. | |
void | clearMetadata () |
Clear all metadata contained in the dib. | |
![]() | |
virtual | ~fipObject () |
Destructor. | |
Painting operations | |
FIBITMAP * | _display_dib |
DIB used for display (this allow to display non-standard bitmaps) | |
BOOL | _bDeleteMe |
remember to delete _display_dib | |
FREE_IMAGE_TMO | _tmo |
tone mapping operator | |
double | _tmo_param_1 |
first tone mapping algorithm parameter | |
double | _tmo_param_2 |
second tone mapping algorithm parameter | |
double | _tmo_param_3 |
third tone mapping algorithm parameter | |
double | _tmo_param_4 |
fourth tone mapping algorithm parameter | |
void | draw (HDC hDC, RECT &rcDest) const |
Draw (stretch) the image on a HDC, using StretchDIBits. | |
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. | |
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 will be refreshed. | |
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. | |
Additional Inherited Members | |
![]() | |
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. | |
![]() | |
BOOL | replace (FIBITMAP *new_dib) |
![]() | |
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. | |
A class designed for MS Windows (TM) platforms.
fipWinImage provides methods used to :
fipWinImage::fipWinImage | ( | FREE_IMAGE_TYPE | image_type = FIT_BITMAP, |
unsigned | width = 0, | ||
unsigned | height = 0, | ||
unsigned | bpp = 0 ) |
Constructor.
|
virtual |
Destructor.
BOOL fipWinImage::captureWindow | ( | HWND | hWndApplicationWindow, |
HWND | hWndSelectedWindow ) |
Capture a window and convert it to an image.
hWndApplicationWindow | Handle to the application main window |
hWndSelectedWindow | Handle to the window to be captured |
|
virtual |
Destroy image data.
Reimplemented from fipImage.
BOOL fipWinImage::copyFromBitmap | ( | HBITMAP | hbmp | ) |
Copy constructor.
Converts a HBITMAP object to a FIBITMAP.
BOOL fipWinImage::copyFromHandle | ( | HANDLE | hMem | ) |
Copy constructor used for clipboard paste.
Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], the bitmap is recognized as non standard and correctly copied.
BOOL fipWinImage::copyToClipboard | ( | HWND | hWndNewOwner | ) | const |
Clipboard copy.
hWndNewOwner | Handle to the window to be associated with the open clipboard. In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). |
HANDLE fipWinImage::copyToHandle | ( | ) | const |
Clone function used for clipboard copy.
Convert the FIBITMAP image to a DIB, and transfer the DIB in a global bitmap handle.
For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), in order to recognize the bitmap as non standard.
|
inline |
Draw (stretch) the image on a HDC, using StretchDIBits.
When the image is transparent or has a file background, this function composite the foreground image against a checkerboard background image.
hDC | Handle to the device context |
rcDest | Destination rectangle |
void fipWinImage::drawEx | ( | HDC | hDC, |
RECT & | rcDest, | ||
BOOL | useFileBkg = FALSE, | ||
RGBQUAD * | appBkColor = NULL, | ||
FIBITMAP * | bg = NULL ) const |
Draw (stretch) the image on a HDC, using StretchDIBits.
When the image is transparent or has a file background, this function can composite the foreground image against a checkerboard background image, against a single background color or against a user background image.
When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a tone mapping operator before drawing the image.
The original image (located in the fipImage class) will not be affected by any of the operations that could be done in order to display it.
hDC | Handle to the device context |
rcDest | Destination rectangle |
useFileBkg | When set to TRUE, the function uses the file color background if there is one |
appBkColor | When a color is given, the function uses it as the background color |
bg | When a FIBITMAP is given, the function uses it as the background image |
void fipWinImage::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.
tmo | Tone mapping operator |
first_param | First tone mapping algorithm parameter |
second_param | Second tone mapping algorithm parameter |
third_param | Third tone mapping algorithm parameter |
fourth_param | Fourth tone mapping algorithm parameter |
|
virtual |
Returns TRUE if the image is allocated, FALSE otherwise.
Reimplemented from fipImage.
fipWinImage & fipWinImage::operator= | ( | const fipImage & | src | ) |
Copy constructor.
Delete internal _display_dib data and copy the base class image data. Tone mapping parameters are left unchanged.
fipWinImage & fipWinImage::operator= | ( | const fipWinImage & | src | ) |
Copy constructor Delete internal _display_dib data and copy tone mapping parameters.
Copy also the base class image data.
BOOL fipWinImage::pasteFromClipboard | ( | ) |
Retrieves data from the clipboard.
The clipboard format must be CF_DIB.
void fipWinImage::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 will be refreshed.
tmo | Tone mapping operator |
first_param | First tone mapping algorithm parameter |
second_param | Second tone mapping algorithm parameter |
third_param | Third tone mapping algorithm parameter |
fourth_param | Fourth tone mapping algorithm parameter |
|
mutableprotected |
remember to delete _display_dib
|
mutableprotected |
DIB used for display (this allow to display non-standard bitmaps)
|
protected |
tone mapping operator
|
protected |
first tone mapping algorithm parameter
|
protected |
second tone mapping algorithm parameter
|
protected |
third tone mapping algorithm parameter
|
protected |
fourth tone mapping algorithm parameter