Getimage() Function

getimage() function copy a specific portion into memory. This specific image would be any bit image like rectangle, circle or anything else.

void getimage(int left, int top, int right, int bottom, void *bitmap);
  • getimage() function requires five parameters.
  • The first forr parameters are the top-left and bottom right position of the rectangular area.
  • Last parameter bitmap contains the address of memory location from where getimage() will start storing the image.
  • For better understanding go through the program:





void main()


int gd=DETECT, gm,size;

char *buff;

initgraph(&gd,&gm," ");

outtextxy(100,80,"Original image:");





outtextxy(100,320,"Captured image:");





The above program will capture an image that is rectangle from memory and display it at new position. imagesize() function returns the bytes required to store the image in memory. You will study imagesize() function in detail in the further section. malloc() function will allocate the memory for the image and the pointer returned by the malloc() function will be stored in the variable buff. getimage() function here will capture the image from the memory and putimage() function will display the image at position (100,340) same as the original image. You will study putimage()function in detail in the further section. The output of the above program is given below: