- Main Page
- Modules
- Classes
- Files

# Painting

## Functions
int32_t | CxImage::Blt (HDC pDC, int32_t x=0, int32_t y=0)
HBITMAP | CxImage::Draw2HBITMAP (HDC hdc, int32_t x, int32_t y, int32_t cx, int32_t cy, RECT *pClipRect, bool bSmooth)
HBITMAP | CxImage::MakeBitmap (HDC hdc=NULL, bool bTransparency=false)
HICON | CxImage::MakeIcon (HDC hdc=NULL, bool bTransparency=false)
HANDLE | CxImage::CopyToHandle ()
bool | CxImage::CreateFromHANDLE (HANDLE hMem)
bool | CxImage::CreateFromHBITMAP (HBITMAP hbmp, HPALETTE hpal=0, bool bTransparency=false)
bool | CxImage::CreateFromHICON (HICON hico, bool bTransparency=false)
int32_t | CxImage::Draw (HDC hdc, int32_t x=0, int32_t y=0, int32_t cx=-1, int32_t cy=-1, RECT *pClipRect=0, bool bSmooth=false, bool bFlipY=false)
int32_t | CxImage::Draw (HDC hdc, const RECT &rect, RECT *pClipRect=NULL, bool bSmooth=false, bool bFlipY=false)
int32_t | CxImage::Stretch (HDC hdc, int32_t xoffset, int32_t yoffset, int32_t xsize, int32_t ysize, uint32_t dwRop=SRCCOPY)
int32_t | CxImage::Stretch (HDC hdc, const RECT &rect, uint32_t dwRop=SRCCOPY)
int32_t | CxImage::Tile (HDC hdc, RECT *rc)
int32_t | CxImage::Draw2 (HDC hdc, int32_t x=0, int32_t y=0, int32_t cx=-1, int32_t cy=-1)
int32_t | CxImage::Draw2 (HDC hdc, const RECT &rect)
int32_t | CxImage::DrawString (HDC hdc, int32_t x, int32_t y, const TCHAR *text, RGBQUAD color, const TCHAR *font, int32_t lSize=0, int32_t lWeight=400, uint8_t bItalic=0, uint8_t bUnderline=0, bool bSetAlpha=false)
int32_t | CxImage::DrawStringEx (HDC hdc, int32_t x, int32_t y, CXTEXTINFO *pTextType, bool bSetAlpha=false)
void | CxImage::InitTextInfo (CXTEXTINFO *txt)
bool | CxImage::IsHBITMAPAlphaValid (HBITMAP hbmp)

## Detailed Description

## Function Documentation

int32_t CxImage::Blt | ( | HDC | pDC,
|  | int32_t | x = `0`,
|  | int32_t | y = `0` |
| ) |  |  | `[inherited]`

HANDLE CxImage::CopyToHandle | ( |  | ) | `[inherited]`

Transfer the image in a global bitmap handle (clipboard copy)

bool CxImage::CreateFromHANDLE | ( | HANDLE | hMem | ) | `[inherited]`

Global object (clipboard paste) constructor

Parameters:

  | hMem,: | source bitmap object, the clipboard format must be CF_DIB

Returns:
  true if everything is ok

bool CxImage::CreateFromHBITMAP | ( | HBITMAP | hbmp,
|  | HPALETTE | hpal = `0`,
|  | bool | bTransparency = `false` |
| ) |  |  | `[inherited]`

Bitmap resource constructor

Parameters:

  | hbmp | : bitmap resource handle
  | hpal | : (optional) palette, useful for 8bpp DC
  | bTransparency | : (optional) for 32bpp images only, imports trancparency

Returns:
  true if everything is ok

Author:
  []; changes [brunom]

bool CxImage::CreateFromHICON | ( | HICON | hico,
|  | bool | bTransparency = `false` |
| ) |  |  | `[inherited]`

icon resource constructor

Parameters:

  | hico | : icon resource handle
  | bTransparency | : (optional) for 32bpp images only, imports trancparency

Returns:
  true if everything is ok

Author:
  []; changes [Arlen Albert Keshabian], [brunom]

int32_t CxImage::Draw | ( | HDC | hdc,
|  | const RECT & | rect,
|  | RECT * | pClipRect = `NULL`,
|  | bool | bSmooth = `false`,
|  | bool | bFlipY = `false` |
| ) |  |  | `[inherited]`

int32_t CxImage::Draw | ( | HDC | hdc,
|  | int32_t | x = `0`,
|  | int32_t | y = `0`,
|  | int32_t | cx = `-1`,
|  | int32_t | cy = `-1`,
|  | RECT * | pClipRect = `0`,
|  | bool | bSmooth = `false`,
|  | bool | bFlipY = `false` |
| ) |  |  | `[inherited]`

Draws the image in the specified device context, with support for alpha channel, alpha palette, transparency, opacity.

Parameters:

  | hdc | : destination device context
  | x,y | : (optional) offset
  | cx,cy | : (optional) size. If cx or cy are not specified (or less than 0), the normal width or height will be used If cx or cy are different than width or height, the image will be stretched
  | pClipRect | : limit the drawing operations inside a given rectangle in the output device context.
  | bSmooth | : activates a bilinear filter that will enhance the appearence for zommed pictures. Quite slow. Needs CXIMAGE_SUPPORT_INTERPOLATION.
  | bFlipY | : draws a mirror image along the y-axis

Returns:
  true if everything is ok

int32_t CxImage::Draw2 | ( | HDC | hdc,
|  | const RECT & | rect |
| ) |  |  | `[inherited]`

int32_t CxImage::Draw2 | ( | HDC | hdc,
|  | int32_t | x = `0`,
|  | int32_t | y = `0`,
|  | int32_t | cx = `-1`,
|  | int32_t | cy = `-1` |
| ) |  |  | `[inherited]`

Draws (stretch) the image with single transparency support

Parameters:

  | hdc | : destination device context
  | x,y | : (optional) offset
  | cx,cy | : (optional) size. If cx or cy are not specified (or less than 0), the normal width or height will be used If cx or cy are different than width or height, the image will be stretched

Returns:
  true if everything is ok

HBITMAP CxImage::Draw2HBITMAP | ( | HDC | hdc,
|  | int32_t | x,
|  | int32_t | y,
|  | int32_t | cx,
|  | int32_t | cy,
|  | RECT * | pClipRect,
|  | bool | bSmooth |
| ) |  |  | `[inherited]`

renders the image into a HBITMAP handle

Parameters:

  | hdc | : destination device context
  | x,y | : (optional) offset
  | cx,cy | : (optional) size. If cx or cy are not specified (or less than 0), the normal width or height will be used If cx or cy are different than width or height, the image will be stretched
  | pClipRect | : limit the drawing operations inside a given rectangle in the output device context.
  | bSmooth | : activates a bilinear filter that will enhance the appearence for zommed pictures. Quite slow. Needs CXIMAGE_SUPPORT_INTERPOLATION.

Returns:
  HBITMAP handle, NULL in case of error

See also:
  MakeBitmap

int32_t CxImage::DrawString | ( | HDC | hdc,
|  | int32_t | x,
|  | int32_t | y,
|  | const TCHAR * | text,
|  | RGBQUAD | color,
|  | const TCHAR * | font,
|  | int32_t | lSize = `0`,
|  | int32_t | lWeight = `400`,
|  | uint8_t | bItalic = `0`,
|  | uint8_t | bUnderline = `0`,
|  | bool | bSetAlpha = `false` |
| ) |  |  | `[inherited]`

int32_t CxImage::DrawStringEx | ( | HDC | hdc,
|  | int32_t | x,
|  | int32_t | y,
|  | CXTEXTINFO * | pTextType,
|  | bool | bSetAlpha = `false` |
| ) |  |  | `[inherited]`

void CxImage::InitTextInfo | ( | CXTEXTINFO * | txt | ) | `[inherited]`

bool CxImage::IsHBITMAPAlphaValid | ( | HBITMAP | hbmp | ) | `[protected, inherited]`

check if the bitmap contains transparency data

Parameters:

  | hbmp | : bitmap resource handle

Returns:
  true the bitmap has transparency

Author:
  [brunom]

HBITMAP CxImage::MakeBitmap | ( | HDC | hdc = `NULL`,
|  | bool | bTransparency = `false` |
| ) |  |  | `[inherited]`

Transfer the image in a bitmap handle

Parameters:

  | hdc,: | target device context (the screen, usually)
  | bTransparency | : (optional) exports trancparency

Returns:
  bitmap handle, or NULL if an error occurs.

See also:
  Draw2HBITMAP, MakeIcon

Author:
  []; changes [brunom]

HICON CxImage::MakeIcon | ( | HDC | hdc = `NULL`,
|  | bool | bTransparency = `false` |
| ) |  |  | `[inherited]`

Transfer the image in a icon handle, with transparency.

Parameters:

  | hdc,: | target device context (the screen, usually)
  | bTransparency | : (optional) exports trancparency

Returns:
  icon handle, or NULL if an error occurs.

See also:
  MakeBitmap

Author:
  [brunom]

int32_t CxImage::Stretch | ( | HDC | hdc,
|  | const RECT & | rect,
|  | uint32_t | dwRop = `SRCCOPY` |
| ) |  |  | `[inherited]`

int32_t CxImage::Stretch | ( | HDC | hdc,
|  | int32_t | xoffset,
|  | int32_t | yoffset,
|  | int32_t | xsize,
|  | int32_t | ysize,
|  | uint32_t | dwRop = `SRCCOPY` |
| ) |  |  | `[inherited]`

Stretch the image. Obsolete: use Draw() or Draw2()

Parameters:

  | hdc | : destination device context
  | xoffset,yoffset | : (optional) offset
  | xsize,ysize | : size.
  | dwRop | : raster operation code (see BitBlt documentation)

Returns:
  true if everything is ok

int32_t CxImage::Tile | ( | HDC | hdc,
|  | RECT * | rc |
| ) |  |  | `[inherited]`

Tiles the device context in the specified rectangle with the image.

Parameters:

  | hdc | : destination device context
  | rc | : tiled rectangle in the output device context

Returns:
  true if everything is ok