1 /** @file gb/drawing.h 2 All Points Addressable (APA) mode drawing library. 3 4 Drawing routines originally by Pascal Felber 5 Legendary overhall by Jon Fuge <jonny@q-continuum.demon.co.uk> 6 Commenting by Michael Hope 7 8 Note that the standard text printf() and putchar() cannot be used 9 in APA mode - use gprintf() and wrtchr() instead. 10 */ 11 #ifndef __DRAWING_H 12 #define __DRAWING_H 13 14 #include <sys/types.h> 15 #include <sys/compiler.h> 16 17 /** Size of the screen in pixels */ 18 #define GRAPHICS_WIDTH 160 19 #define GRAPHICS_HEIGHT 144 20 21 /** Possible drawing modes */ 22 #if ORIGINAL 23 #define SOLID 0x10 /* Overwrites the existing pixels */ 24 #define OR 0x20 /* Performs a logical OR */ 25 #define XOR 0x40 /* Performs a logical XOR */ 26 #define AND 0x80 /* Performs a logical AND */ 27 #else 28 #define SOLID 0x00 /* Overwrites the existing pixels */ 29 #define OR 0x01 /* Performs a logical OR */ 30 #define XOR 0x02 /* Performs a logical XOR */ 31 #define AND 0x03 /* Performs a logical AND */ 32 #endif 33 34 /** Possible drawing colours */ 35 #define WHITE 0 36 #define LTGREY 1 37 #define DKGREY 2 38 #define BLACK 3 39 40 /** Possible fill styles for box() and circle() */ 41 #define M_NOFILL 0 42 #define M_FILL 1 43 44 /** Old style plot - try plot_point() */ 45 void __LIB__ plot(uint16_t x, uint16_t y, uint16_t colour, uint16_t mode) __smallc; 46 47 /** Plot a point in the current drawing mode and colour at (x,y) */ 48 void __LIB__ plot_point(uint16_t x, uint16_t y) __smallc; 49 50 /** I (MLH) have no idea what switch_data does... */ 51 void __LIB__ switch_data(uint16_t x, uint16_t y, unsigned char *src, unsigned char *dst) __smallc NONBANKED; 52 53 /** Ditto */ 54 void __LIB__ draw_image(unsigned char *data) NONBANKED; 55 56 /** Draw a line in the current drawing mode and colour from (x1,y1) to (x2,y2) */ 57 void __LIB__ line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) __smallc; 58 59 /** Draw a box (rectangle) with corners (x1,y1) and (x2,y2) using fill mode 60 'style' (one of NOFILL or FILL */ 61 void __LIB__ box(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t style) __smallc; 62 63 /** Draw a circle with centre at (x,y) and radius 'radius'. 'style' sets 64 the fill mode */ 65 void __LIB__ circle(uint16_t x, uint16_t y, uint16_t radius, uint16_t style) __smallc; 66 67 /** Returns the current colour of the pixel at (x,y) */ 68 uint16_t __LIB__ getpix(uint16_t x, uint16_t y) __smallc; 69 70 /** Prints the character 'chr' in the default font at the current position */ 71 void __LIB__ wrtchr(char chr); 72 73 /** Sets the current text position to (x,y). Note that x and y have units 74 of cells (8 pixels) */ 75 void __LIB__ gotogxy(uint16_t x, uint16_t y) __smallc; 76 77 /** Set the current foreground colour (for pixels), background colour, and 78 draw mode */ 79 void __LIB__ color(uint16_t forecolor, uint16_t backcolor, uint16_t mode) __smallc; 80 81 #endif /* __DRAWING_H */ 82