RosettaCodeData/Task/Bitmap/Modula-3/bitmap-1.mod3

25 lines
642 B
Plaintext

INTERFACE Bitmap;
TYPE UByte = BITS 8 FOR [0 .. 16_FF];
Pixel = RECORD R, G, B: UByte; END;
Point = RECORD x, y: UByte; END;
T = REF ARRAY OF ARRAY OF Pixel;
CONST
Black = Pixel{0, 0, 0};
White = Pixel{255, 255, 255};
Red = Pixel{255, 0, 0};
Green = Pixel{0, 255, 0};
Blue = Pixel{0, 0, 255};
Yellow = Pixel{255, 255, 0};
EXCEPTION BadImage;
BadColor;
PROCEDURE NewImage(height, width: UByte): T RAISES {BadImage};
PROCEDURE Fill(VAR pic: T; color: Pixel);
PROCEDURE GetPixel(VAR pic: T; point: Point): Pixel RAISES {BadColor};
PROCEDURE SetPixel(VAR pic: T; point: Point; color: Pixel);
END Bitmap.