Show a basic storage type to handle a simple RGB raster graphics image,
and some primitive associated functions.

If possible provide a function to allocate an uninitialised image,
given its width and height, and provide 3 additional functions:

   one to fill an image with a plain RGB color,
   one to set a given pixel with a color,
   one to get the color of a pixel.


(If there are specificities about the storage or the allocation, explain those.)

These functions are used as a base for the articles in the category raster graphics operations, 
and a basic output function to check the results
is available in the article write ppm file.




 
/* 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;
 