27 lines
744 B
Plaintext
27 lines
744 B
Plaintext
/* Declaration for an image, suitable for BMP files. */
|
|
declare image(0:500, 0:500) bit (24) aligned;
|
|
|
|
image = '000000000000000011111111'b;
|
|
/* Sets the entire image to red. */
|
|
|
|
image(10,40) = '111111110000000000000000'b;
|
|
/* Sets one pixel to blue. */
|
|
|
|
declare color bit (24) aligned;
|
|
color = image(20,50); /* Obtain the color of a pixel */
|
|
|
|
|
|
|
|
/* To allocate an image of size (x,y) */
|
|
allocate_image: procedure (image, x, y);
|
|
declare image (*, *) controlled bit (24) aligned;
|
|
declare (x, y) fixed binary (31);
|
|
|
|
allocate image (0:x, 0:y);
|
|
end allocate_image;
|
|
|
|
/* To use the above procedure, it's necessary to define */
|
|
/* the image in the calling program thus, for BMP images: */
|
|
|
|
declare image(*,*) controlled bit (24) aligned;
|