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.




 100 W = 8
 110 H = 8
 120 BB = 24576 +  LEN ( STR$ (W) +  STR$ (H)) + 9: REM  P6 HEADER
 130  HIMEM: 8192
 140 R = 255
 150 G = 255
 160 B = 0
 170 C = R + G * 256 + B * 65536
 180  GOSUB 600FILL
 190 X = 4
 200 Y = 5
 210 R = 127
 220 G = 127
 230 B = 255
 240 C = R + G * 256 + B * 65536
 250  GOSUB 500"SET PIXEL"
 260 X = 3
 270 Y = 2
 280  GOSUB 400"GET PIXEL"
 290  PRINT "COLOR="C" RED="R" GREEN="G" BLUE="B;
 300  END 
 400 A = BB + X * 3 + Y * W * 3
 410 R =  PEEK (A)
 420 G =  PEEK (A + 1)
 430 B =  PEEK (A + 2)
 440 C = R + G * 256 + B * 65536
 450  RETURN 
 500 R = C -  INT (C / 256) * 256
 510 B =  INT (C / 65536)
 520 G =  INT (C / 256) - B * 256
 530 A = BB + X * 3 + Y * W * 3
 540  POKE A,R
 550  POKE A + 1,G
 560  POKE A + 2,B
 570  RETURN 
 600  FOR Y = 0 TO H - 1
 610      FOR X = 0 TO W - 1
 620          GOSUB 500"SET PIXEL"
 630          NEXT X,Y
 640  RETURN