Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PgDrawPhImageRectv(), PgDrawPhImageRectCxv()

Draw part of an image that's contained in a PhImage_t structure

Synopsis:

int PgDrawPhImageRectv( PhPoint_t const *pos,
                        PhImage_t const *image,
                        PhRect_t const *rect,
                        int flags );

int PgDrawPhImageRectCxv( void *dc,
                          PhPoint_t const *pos,
                          PhImage_t const *image,
                          PhRect_t const *rect,
                          int flags );

Library:

ph

Description:

These functions draw a rectangular piece (specified by the PhRect_t structure pointed to by rect) of the provided image at position pos. The image parameter must be a pointer to a PhImage_t structure that defines the image to be rendered.

PgDrawPhImageRectv() works on the current draw context, while you can specify the draw context dc for PgDrawPhImageRectCxv().

If the image has a transparency mask, it's used. These functions set the palettes for palette-based images, and apply alpha blending if the alpha member of the PhImage_t structure isn't NULL.

The currently defined bits for the flags parameter are:

Pg_GHOST or Pt_GHOST
Render the image using the ghost bitmap as a transparency mask.

The rectangle is clipped to the image boundaries (i.e. the area bounded by (0,0) to (image->size.w - 1, image->size.h - 1). If rect is NULL, the entire image is drawn.

The drawing of the piece of the image begins at pos (i.e. the rect argument doesn't introduce an additional offset.


Note: For image formats where the number of pixels per byte is greater than 1 (e.g. Pg_IMAGE_GRADIENT_NIBBLE, Pg_IMAGE_PALETTE_NIBBLE, Pg_BITMAP_BACKFILL, and Pg_BITMAP_TRANSPARENT), the portion specified by rect might be grown horizontally so that it falls on even byte boundaries.

Returns:

0
Success.
-1
The draw buffer couldn't be resized enough to fit a single scan line of the image (insufficient memory).

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

ApGetImageRes(), PgDrawPhImage*(), PgDrawRepPhImage*(), PhCreateImage(), PhImage_t, PhMakeGhostBitmap(), PhMakeTransBitmap(), PhMakeTransparent(), PhPoint_t, PhRect_t, PhReleaseImage(), PmMemCreateMC(), PmMemFlush(), PxLoadImage()

"Images" in the Raw Drawing and Animation chapter of the Photon Programmer's Guide