#include#include using namespace std; int main() { initwindow(500,500, "Draw Image"); readimagefile("image.jpg", 10, 10, 490, 490); getch(); closegraph(); return 0; }
#includeIn this example, the graphics window is initialized with the same parameters as before. However, instead of reading an external image file, we create a 4x4 pixel image in memory using a 2D integer array. Then we use the `putimage` function to draw this image on the window starting from (10,10). The `COPY_PUT` parameter is used to copy the image instead of merging it with the existing contents of the window. The package library which provides the `readimagefile`, `putimage` and other graphics functions is the graphics.h library in CPP.#include using namespace std; int main() { initwindow(500,500, "Draw Image"); int img[4][4] = {{0,0,0,0}, {0,1,1,0}, {0,1,1,0}, {0,0,0,0}}; putimage(10,10, img, COPY_PUT); getch(); closegraph(); return 0; }