1740355857-Getimage and Putimage Functions
1740355857-Getimage and Putimage Functions
It accepts 5 parameters - left, top, right, bottom and image pointer (void
far*).
Once the image is captured using getimage, we can use putimage to plot
the image.
Syntax
#include <graphics.h>
void getimage(int left, int top, int right, int bottom, void *bitmap);
Description
getimage copies an image from the screen to memory.
left, top, right, and bottom define the screen area to which the
rectangle is copied. bitmap points to the area in memory where the
bit image is stored. The first two words of this area are used for the
width and height of the rectangle; the remainder holds the image
itself.
Putimage()
Syntax
#include <graphics.h>
void putimage(int left, int top, void *bitmap, int op);
Description
putimage puts the bit image previously saved with getimage back onto
the screen, with the upper left corner of the image placed at (left,top).
bitmap points to the area in memory where the source image is stored.
The op parameter to putimage specifies a combination operator that
controls how the color for each destination pixel onscreen is computed,
based on the pixel already onscreen and the corresponding source pixel
in memory. The enumeration putimage_ops, as defined in graphics.h,
gives names to these operators.
Name Value Description
COPY_PUT 0 Copy
XOR_PUT 1 Exclusive or
OR_PUT 2 Inclusive or
AND_PUT 3 And
NOT_PUT 4 Copy the inverse of the source
In other words, COPY_PUT copies the source bitmap image onto the
screen, XOR_PUT XORs the source image with the image already
onscreen, OR_PUT ORs the source image with that onscreen, and so
on.