- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# fipWinImage Class Reference

`#include <FreeImagePlus.h>`

Inheritance diagram for fipWinImage:

List of all members.

## Detailed Description

A class designed for MS Windows (TM) platforms.

fipWinImage provides methods used to :

- Display a DIB on the screen
- Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard)
- Capture a window (HWND) and convert it to an image

Version:
  FreeImage 3

Author:
  Hervé Drolon

## Public Member Functions
Creation & Destruction
| fipWinImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, WORD width=0, WORD height=0, WORD 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.
Painting operations
void | draw (HDC hDC, RECT &rcDest) const
void | drawEx (HDC hDC, RECT &rcDest, BOOL useFileBkg=FALSE, RGBQUAD *appBkColor=NULL, FIBITMAP *bg=NULL) const
void | setToneMappingOperator (FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
| 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.
## Protected Attributes
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

## Constructor & Destructor Documentation

fipWinImage::fipWinImage | ( | FREE_IMAGE_TYPE | image_type = `FIT_BITMAP`,
|  | WORD | width = `0`,
|  | WORD | height = `0`,
|  | WORD | bpp = `0` |
| ) |  |  |

Constructor.

virtual fipWinImage::~fipWinImage | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual void fipWinImage::clear | ( |  | ) | `[virtual]`

Destroy image data.

Reimplemented from fipImage.

BOOL fipWinImage::isValid | ( |  | ) | const`[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.

See also:
  FreeImage_Clone

Reimplemented from fipImage.

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.

See also:
  FreeImage_Clone

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.

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.

Returns:
  Returns TRUE if successful, returns FALSE otherwise

BOOL fipWinImage::copyFromBitmap | ( | HBITMAP | hbmp | ) |

Copy constructor.

Converts a HBITMAP object to a FIBITMAP.

Returns:
  Returns TRUE if successful, returns FALSE otherwise

BOOL fipWinImage::copyToClipboard | ( | HWND | hWndNewOwner | ) | const

Clipboard copy.

Parameters:

  | hWndNewOwner | Handle to the window to be associated with the open clipboard. In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd().

Returns:
  Returns TRUE if successful, returns FALSE otherwise

BOOL fipWinImage::pasteFromClipboard | ( |  | ) |

Retrieves data from the clipboard.

The clipboard format must be CF_DIB.

Returns:
  Returns TRUE if successful, returns FALSE otherwise

BOOL fipWinImage::captureWindow | ( | HWND | hWndApplicationWindow,
|  | HWND | hWndSelectedWindow |
| ) |  |  |

Capture a window and convert it to an image.

Parameters:

  | hWndApplicationWindow | Handle to the application main window
  | hWndSelectedWindow | Handle to the window to be captured

Returns:
  Returns TRUE if successful, returns FALSE otherwise

void fipWinImage::draw | ( | HDC | hDC,
|  | RECT & | rcDest |
| ) |  |  | const`[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.

Parameters:

  | hDC | Handle to the device context
  | rcDest | Destination rectangle

See also:
  FreeImage_Composite

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.

Parameters:

  | 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

See also:
  FreeImage_Composite

  setToneMappingOperator

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.

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

See also:
  FreeImage_ToneMapping

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.

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

See also:
  FreeImage_ToneMapping

## Member Data Documentation

FIBITMAP* fipWinImage::_display_dib`[mutable, protected]`

DIB used for display (this allow to display non-standard bitmaps).

BOOL fipWinImage::_bDeleteMe`[mutable, protected]`

remember to delete _display_dib

FREE_IMAGE_TMO fipWinImage::_tmo`[protected]`

tone mapping operator

double fipWinImage::_tmo_param_1`[protected]`

first tone mapping algorithm parameter

double fipWinImage::_tmo_param_2`[protected]`

second tone mapping algorithm parameter

double fipWinImage::_tmo_param_3`[protected]`

third tone mapping algorithm parameter

double fipWinImage::_tmo_param_4`[protected]`

fourth tone mapping algorithm parameter

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

- FreeImagePlus.h