1 /*
2   GEOS graphic (non icon/menu/sprite) functions
3 
4   by Maciej 'YTM/Elysium' Witkowiak
5 */
6 
7 #ifndef _GGRAPH_H
8 #define _GGRAPH_H
9 
10 #include <geos/gstruct.h>
11 
12 void __fastcall__ SetPattern(char newpattern);
13 
14 void __fastcall__ HorizontalLine(char pattern, char y, unsigned xstart, unsigned xend);
15 void __fastcall__ InvertLine(char y, unsigned xstart, unsigned xend);
16 void __fastcall__ RecoverLine(char y, unsigned xstart, unsigned xend);
17 void __fastcall__ VerticalLine(char pattern, char ystart, char yend, unsigned x);
18 
19 void __fastcall__ InitDrawWindow(struct window *myRectangle);
20 void Rectangle(void);
21 void __fastcall__ FrameRectangle(char pattern);
22 void InvertRectangle(void);
23 void ImprintRectangle(void);
24 void RecoverRectangle(void);
25 
26 void __fastcall__ DrawLine(char mode, struct window *topBotCoords);
27 
28 void __fastcall__ DrawPoint(char mode, struct pixel *myPixel);
29 char __fastcall__ TestPoint(struct pixel *myPixel);
30 
31 void __fastcall__ PutChar(char character, char y, unsigned x);
32 void __fastcall__ PutString(char *myString, char y, unsigned x);
33 void __fastcall__ PutDecimal(char style, unsigned value, char y, unsigned x);
34 
35 char __fastcall__ GetCharWidth(char character);
36 void __fastcall__ LoadCharSet(struct fontdesc *myFont);
37 void UseSystemFont(void);
38 
39 void __fastcall__ BitmapUp(struct iconpic *myIcon);
40 void __fastcall__ BitmapClip(char skipl, char skipr, unsigned skiptop,
41                              struct iconpic *myIcon);
42 void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl,
43                                char skipr, unsigned skiptop,
44                                struct iconpic *myIcon);
45 
46 void __fastcall__ GraphicsString(char *myGfxString);
47 
48 #ifdef __GEOS_CBM__
49 void SetNewMode(void);
50 #endif
51 
52 /* VIC colour constants */
53 #define BLACK           0
54 #define WHITE           1
55 #define RED             2
56 #define CYAN            3
57 #define PURPLE          4
58 #define GREEN           5
59 #define BLUE            6
60 #define YELLOW          7
61 #define ORANGE          8
62 #define BROWN           9
63 #define LTRED           10
64 #define DKGREY          11
65 #define GREY            12
66 #define MEDGREY         12
67 #define LTGREEN         13
68 #define LTBLUE          14
69 #define LTGREY          15
70 /* VIC memory banks - lowest 2 bits of cia2base+0 */
71 #define GRBANK0         3
72 #define GRBANK1         2
73 #define GRBANK2         1
74 #define GRBANK3         0
75 /* VIC screen sizes */
76 #define VIC_X_POS_OFF   24
77 #define VIC_Y_POS_OFF   50
78 #ifdef __GEOS_CBM__
79 #define SC_BYTE_WIDTH   40
80 #define SC_PIX_HEIGHT   200
81 #define SC_PIX_WIDTH    320
82 #define SC_SIZE         8000
83 #else
84 #define SC_BYTE_WIDTH   70
85 #define SC_PIX_HEIGHT   192
86 #define SC_PIX_WIDTH    560
87 #define SC_SIZE         13440
88 #endif
89 /* VDC screen constants */
90 #define SCREENBYTEWIDTH         80
91 #define SCREENPIXELWIDTH        640
92 /* control characters for use as numbers, not characters */
93 #define BACKSPACE       8
94 #define FORWARDSPACE    9
95 #define TAB             9
96 #define LF              10
97 #define HOME            11
98 #define PAGE_BREAK      12
99 #define UPLINE          12
100 #define CR              13
101 #define ULINEON         14
102 #define ULINEOFF        15
103 #define ESC_GRAPHICS    16
104 #define ESC_RULER       17
105 #define REV_ON          18
106 #define REV_OFF         19
107 #define GOTOX           20
108 #define GOTOY           21
109 #define GOTOXY          22
110 #define NEWCARDSET      23
111 #define BOLDON          24
112 #define ITALICON        25
113 #define OUTLINEON       26
114 #define PLAINTEXT       27
115 /* control characters for use in
116    strings: eg: str[10]=CBOLDON "Hello"; */
117 #define CCR             "\015"
118 #define CULINEON        "\016"
119 #define CULINEOFF       "\017"
120 #define CREV_ON         "\022"
121 #define CREV_OFF        "\023"
122 #define CBOLDON         "\030"
123 #define CITALICON       "\031"
124 #define COUTLINEON      "\032"
125 #define CPLAINTEXT      "\033"
126 
127 /*values of currentMode */
128 /* bitNumbers */
129 #define UNDERLINE_BIT   7
130 #define BOLD_BIT        6
131 #define REVERSE_BIT     5
132 #define ITALIC_BIT      4
133 #define OUTLINE_BIT     3
134 #define SUPERSCRIPT_BIT 2
135 #define SUBSCRIPT_BIT   1
136 /* bitMasks */
137 #define SET_UNDERLINE   0x80
138 #define SET_BOLD        0x40
139 #define SET_REVERSE     0x20
140 #define SET_ITALIC      0x10
141 #define SET_OUTLINE     0x08
142 #define SET_SUPERSCRIPT 0x04
143 #define SET_SUBSCRIPT   0x02
144 #define SET_PLAINTEXT   0
145 /* values of dispBufferOn */
146 #define ST_WRGS_FORE    0x20
147 #define ST_WR_BACK      0x40
148 #define ST_WR_FORE      0x80
149 /* PutDecimal parameters */
150 /* leading zeros? */
151 #define SET_NOSURPRESS  0
152 #define SET_SURPRESS    0x40
153 /* justification */
154 #define SET_RIGHTJUST   0
155 #define SET_LEFTJUST    0x80
156 /* C128 x-extension flags */
157 #define ADD1_W          0x2000
158 #define DOUBLE_B        0x80
159 #define DOUBLE_W        0x8000
160 /* DrawLine/DrawPoint mode values */
161 #define DRAW_ERASE      0x00
162 #define DRAW_DRAW       0x40
163 #define DRAW_COPY       0x80
164 
165 typedef void graphicStr;
166 
167 #define MOVEPENTO(x,y) (char)1, (unsigned)(x), (char)(y)
168 #define LINETO(x,y) (char)2, (unsigned)(x), (char)(y)
169 #define RECTANGLETO(x,y) (char)3, (unsigned)(x), (char)(y)
170 #define NEWPATTERN(p) (char)5, (char)(p)
171 #define FRAME_RECTO(x,y) (char)7, (unsigned)(x), (char)(y)
172 #define PEN_X_DELTA(x) (char)8, (unsigned)(x)
173 #define PEN_Y_DELTA(y) (char)9, (char)(y)
174 #define PEN_XY_DELTA(x,y) (char)10, (unsigned)(x), (char)(y)
175 #define GSTR_END (char)NULL
176 /* ESC_PUTSTRING can't be implemented - it needs text, not pointer to it
177    #define ESC_PUTSTRING(x,y,text) (char)6, (unsigned)(x), (char)(y), (text), (char)NULL
178 */
179 
180 #endif
181