putimage

Several overloads of this function are used to draw the specified image on the current device.

// Draw an image
void putimage(
	int dstX,				// X coordinates of the draw position
	int dstY,				// Y coordinates of the draw position
	IMAGE *pSrcImg,			// Image object pointer to draw
	DWORD dwRop = SRCCOPY	// Three-element grating operating code
);
// Draw an image (specifying width and start position)
void putimage(
	int dstX,				// X coordinates of the draw position
	int dstY,				// Y coordinates of the draw position
	int dstWidth,			// The width of the draw
	int dstHeight,			// The height of the draw
	IMAGE *pSrcImg,			// Image object pointer to draw
	int srcX,				// Draw the upper-left x coordinates of the content in the IMAGE object
	int srcY,				// Draw the upper-left y coordinates of the content in the IMAGE object
	DWORD dwRop = SRCCOPY	// The three-element grating operating code
);

Parameters

See notes in function prototypes.

Remarks

The three-element grating operating code (i.e. bit operating mode) supports all 256 kinds of three-element grating operating codes, which are commonly used as follows:

Value Meaning
DSTINVERT Destination image = NOT Destination image
MERGECOPY Destination image = Source image AND Current fill color
MERGEPAINT Destination image = Destination image OR (NOT Source image)
NOTSRCCOPY Destination image = NOT Source image
NOTSRCERASE Destination image = NOT (Destination image OR Source image)
PATCOPY Destination image = Current fill color
PATINVERT Destination image = Destination image XOR Current fill color
PATPAINT Destination image = Destination image OR ((NOT Source image) OR Current fill color)
SRCAND Destination image = Destination image AND Source image
SRCCOPY Destination image = Source image
SRCERASE Destination image = (NOT Destination image) AND Source image
SRCINVERT Destination image = Destination image XOR Source image
SRCPAINT Destination image = Destination image OR Source image

注:

  1. AND / OR / NOT / XOR for Boolean operations.
  2. Current fill color refers to the color that is set by setfillcolor for the current fill.
  3. See all the ternary raster operation codes here: Ternary raster operations.

Return Value

None

Examples

The following snippet copies the 100x100 image from the start of the screen (0,0) to the (200,200) position:

IMAGE img;
getimage(&img, 0, 0, 100, 100);
putimage(200, 200, &img);