FreeCalypso > hg > fc-magnetite
comparison src/cs/drivers/drv_app/r2d/r2d_i.h @ 0:945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
binary blobs and LCD demo files have been excluded,
all line endings are LF only
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 25 Sep 2016 22:50:11 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:945cf7f506b2 |
|---|---|
| 1 /*************************************************************************** | |
| 2 | |
| 3 Name R2DI.h | |
| 4 | |
| 5 Function Riviera 2D system : Private API | |
| 6 | |
| 7 Date Modification | |
| 8 ----------------------- | |
| 9 06/12/2001 Create | |
| 10 ************************************************************************** | |
| 11 History | |
| 12 | |
| 13 ****************************************************************************/ | |
| 14 | |
| 15 | |
| 16 #ifndef __R2DI_H_ | |
| 17 #define __R2DI_H_ | |
| 18 | |
| 19 #include "r2d/r2d.h" | |
| 20 #include "rvf/rvf_api.h" | |
| 21 | |
| 22 | |
| 23 /*************************************** | |
| 24 | |
| 25 CONSTANTS | |
| 26 | |
| 27 ***************************************/ | |
| 28 | |
| 29 | |
| 30 #if (R2D_ASM == R2D_ON) | |
| 31 ////////////////////////////////////////// | |
| 32 // | |
| 33 // R2D ASM API | |
| 34 // | |
| 35 | |
| 36 enum{ | |
| 37 R2D_LCDLCD=1, | |
| 38 R2D_COLORCOLOR=2, | |
| 39 R2D_COLORLCD=3, | |
| 40 R2D_LCDCOLOR=4 | |
| 41 }; | |
| 42 | |
| 43 #endif | |
| 44 | |
| 45 | |
| 46 /*************************************** | |
| 47 | |
| 48 TYPES | |
| 49 | |
| 50 ***************************************/ | |
| 51 | |
| 52 //////////////////////////////////////// | |
| 53 // | |
| 54 // Misc | |
| 55 // | |
| 56 | |
| 57 typedef UINT32 R2D_BOOLEAN; // To avoid veneer bug a bool on 16 bits is introduced | |
| 58 | |
| 59 //////////////////////////////////////// | |
| 60 // | |
| 61 // Arc region | |
| 62 // | |
| 63 | |
| 64 // Region delimited by vectors whose scalar | |
| 65 // product with (sa,sb) and (ea,eb) is (+,+) | |
| 66 // of (-,+) or (+,-) | |
| 67 typedef struct R2D_ARC_REGION | |
| 68 { | |
| 69 INT32 sa,sb,ea,eb; | |
| 70 INT16 one_sector; | |
| 71 BOOLEAN is_null; | |
| 72 } T_R2D_ARC_REGION; | |
| 73 | |
| 74 //////////////////////////////////////// | |
| 75 // | |
| 76 // Textures | |
| 77 // | |
| 78 typedef struct R2D_FREE_TEXTURE | |
| 79 { | |
| 80 INT16 refcount; | |
| 81 INT16 size; // Exponent of a power of 2 | |
| 82 T_R2D_ARGB_COLOR *pattern; | |
| 83 } T_R2D_FREE_TEXTURE; | |
| 84 | |
| 85 typedef struct R2D_ANCHORED_TEXTURE | |
| 86 { | |
| 87 INT16 refcount; | |
| 88 INT16 size; // Exponent of a power of 2 | |
| 89 UINT32 *pattern; | |
| 90 } T_R2D_ANCHORED_TEXTURE; | |
| 91 | |
| 92 /////////////////////////////////////// | |
| 93 // | |
| 94 // FRAMEBUFFER | |
| 95 // | |
| 96 | |
| 97 | |
| 98 typedef struct R2D_FRAMEBUFFER | |
| 99 { | |
| 100 // Refcounting | |
| 101 INT16 refcount; | |
| 102 // List of memory words containing the pixels | |
| 103 UINT32 *p_memory_words; | |
| 104 // End of frameBuffer used to prevent out of | |
| 105 // framebuffer access | |
| 106 // (It is the last word contained in the framebuffer) | |
| 107 // (but that word is used for loops and is never drawn) | |
| 108 UINT32 *p_frame_buffer_end; | |
| 109 // Kind of framebuffer (LCD or 24 bits) | |
| 110 T_R2D_FRAMEBUFFER_KIND kind; | |
| 111 // Dimensions of frameBuffer | |
| 112 UINT16 width,height; | |
| 113 // Semaphore for concurrent accesses to the framebuffer | |
| 114 T_RVF_MUTEX * mutex; | |
| 115 } T_R2D_FRAMEBUFFER; | |
| 116 | |
| 117 // Font cache framebuffer has other fields required to build | |
| 118 // the glyph from a succession of Unicode codes | |
| 119 typedef struct R2D_FONT_CACHE_FRAMEBUFFER | |
| 120 { | |
| 121 // Refcounting | |
| 122 INT16 refcount; | |
| 123 // List of memory words containing the pixels | |
| 124 UINT32 *p_memory_words; | |
| 125 // End of frameBuffer used to prevent out of | |
| 126 // framebuffer access | |
| 127 // (It is the last word contained in the framebuffer) | |
| 128 UINT32 *p_frame_buffer_end; | |
| 129 // Kind of framebuffer (LCD or 24 bits) | |
| 130 T_R2D_FRAMEBUFFER_KIND kind; | |
| 131 // Dimensions of frameBuffer | |
| 132 UINT16 width,height; | |
| 133 // Semaphore for concurrent accesses to the framebuffer | |
| 134 T_RVF_MUTEX * mutex; | |
| 135 } T_R2D_FONT_CACHE_FRAMEBUFFER; | |
| 136 | |
| 137 | |
| 138 //////////////////////////////////////// | |
| 139 // | |
| 140 // LCD API | |
| 141 // | |
| 142 | |
| 143 typedef UINT32 (*T_R2D_DRAWING_OP)(UINT32 old,UINT32 value); | |
| 144 | |
| 145 | |
| 146 typedef T_R2D_DRAWING_OP T_R2D_DRAWING_OPERATORS[10]; | |
| 147 | |
| 148 //////////////////////////////////////// | |
| 149 // | |
| 150 // OBJECTS | |
| 151 // | |
| 152 | |
| 153 // Metaclass object describing the classes | |
| 154 | |
| 155 | |
| 156 typedef struct R2D_CLASS_SHAPE T_R2D_CLASS_SHAPE; | |
| 157 typedef struct R2D_SHAPE T_R2D_SHAPE; | |
| 158 | |
| 159 typedef void (*T_R2D_shape_release_funct)(T_R2D_SHAPE *self); | |
| 160 typedef void (*T_R2D_shape_draw_funct)(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 161 typedef void (*T_R2D_shape_fill_funct)(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 162 typedef T_R2D_SHAPE_PTR (*T_R2D_shape_clone_funct)(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 163 typedef void (*T_R2D_shape_translate_funct)(T_R2D_SHAPE *self,INT16 dx,INT16 dy); | |
| 164 typedef BOOLEAN (*T_R2D_shape_point_testing_funct)(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 165 | |
| 166 | |
| 167 struct R2D_CLASS_SHAPE | |
| 168 { | |
| 169 void *parent_class; | |
| 170 T_R2D_shape_release_funct release; | |
| 171 T_R2D_shape_draw_funct draw; | |
| 172 T_R2D_shape_fill_funct fill; | |
| 173 T_R2D_shape_clone_funct clone; | |
| 174 T_R2D_shape_translate_funct translate; | |
| 175 T_R2D_shape_point_testing_funct point_in_shape; | |
| 176 }; | |
| 177 | |
| 178 //////////////////////////////////////// | |
| 179 // | |
| 180 // SHAPES OBJECTS | |
| 181 // | |
| 182 | |
| 183 struct R2D_SHAPE | |
| 184 { | |
| 185 INT16 refcount; | |
| 186 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 187 }; | |
| 188 | |
| 189 typedef struct R2D_RECT | |
| 190 { | |
| 191 INT16 refcount; | |
| 192 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 193 INT16 ul_x,ul_y,br_x,br_y; | |
| 194 } T_R2D_RECTANGLE; | |
| 195 | |
| 196 typedef struct R2D_CIRCLE | |
| 197 { | |
| 198 INT16 refcount; | |
| 199 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 200 INT16 x,y,r; | |
| 201 } T_R2D_CIRCLE; | |
| 202 | |
| 203 typedef T_R2D_RECTANGLE T_R2D_ELLIPSE; | |
| 204 | |
| 205 typedef struct R2D_ROUNDRECT | |
| 206 { | |
| 207 INT16 refcount; | |
| 208 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 209 INT16 ul_x,ul_y,br_x,br_y; | |
| 210 INT16 h,v; | |
| 211 } T_R2D_ROUND_RECTANGLE; | |
| 212 | |
| 213 typedef struct R2D_ARC | |
| 214 { | |
| 215 INT16 refcount; | |
| 216 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 217 INT16 ul_x,ul_y,br_x,br_y; | |
| 218 INT16 start_angle,stop_angle; | |
| 219 } T_R2D_ARC; | |
| 220 | |
| 221 typedef struct R2D_TEXT | |
| 222 { | |
| 223 INT16 refcount; | |
| 224 const T_R2D_CLASS_SHAPE *p_r2d_class; | |
| 225 INT16 x,y; | |
| 226 T_R2D_UTF16 *p_text; | |
| 227 } T_R2D_TEXT; | |
| 228 | |
| 229 | |
| 230 //////////////////////////////////////// | |
| 231 // | |
| 232 // GRAPHIC CONTEXT | |
| 233 // | |
| 234 | |
| 235 typedef struct R2D_GC | |
| 236 { | |
| 237 // Refcounting | |
| 238 INT16 refcount; | |
| 239 // The framebuffer | |
| 240 T_R2D_FRAMEBUFFER_PTR p_frame_buffer; | |
| 241 // Clip rectangle (in graphic context coordinates) | |
| 242 T_R2D_SHAPE *p_clipping_shape; | |
| 243 // Clipping shape in scanning coordinates | |
| 244 T_R2D_SHAPE *p_s_clipping_shape; | |
| 245 // Foreground pixel value | |
| 246 // (on 24 bits per pixel. Conversion done on the fly | |
| 247 // according to the kind of framebuffer) | |
| 248 T_R2D_ARGB_COLOR foreground_color; | |
| 249 // Cache for computed pixel value corresponding | |
| 250 // to previous color. Used for LCD with dithering off | |
| 251 // to speed drawing | |
| 252 UINT32 foreground_pixel_value; | |
| 253 // Cache for foreground dithering used when dithering ON | |
| 254 UINT32 *p_foreground_dithered_cache; | |
| 255 // Background pixel value | |
| 256 // (on 24 bits per pixel. Conversion done on the fly | |
| 257 // according to the kind of framebuffer) | |
| 258 T_R2D_ARGB_COLOR background_color; | |
| 259 // Cache for computed pixel value corresponding | |
| 260 // to previous color. Used for LCD with dithering off | |
| 261 // to speed drawing | |
| 262 UINT32 background_pixel_value; | |
| 263 // Cache for dithering used when dithering ON | |
| 264 UINT32 *p_background_dithered_cache; | |
| 265 // Background texture | |
| 266 T_R2D_ANCHORED_TEXTURE *background_texture; | |
| 267 // Pen position | |
| 268 INT16 pen_x,pen_y; | |
| 269 // pen_size in pixels | |
| 270 INT16 pen_size; | |
| 271 // Drawing mode | |
| 272 INT16 drawing_mode; | |
| 273 // Drawing operator for above drawing mode | |
| 274 T_R2D_DRAWING_OP drawing_op; | |
| 275 // Context origin (H coordinates of upper-left corner of screen) | |
| 276 INT16 org_x,org_y; | |
| 277 // Context origin (S coordinates for texture of the point corresponding | |
| 278 // to (0,0) H coordinates) | |
| 279 INT16 s_org_x,s_org_y; | |
| 280 // Dash state | |
| 281 BOOLEAN dash; | |
| 282 // Text face | |
| 283 T_R2D_TEXT_FACE text_face; | |
| 284 // Text style | |
| 285 // (List of types requested by the user) | |
| 286 T_R2D_TEXT_STYLE text_style; | |
| 287 // Internal text style | |
| 288 // (list of style effect which must be computed since | |
| 289 // there are not embedded into the fonts) | |
| 290 T_R2D_TEXT_STYLE internal_text_style; | |
| 291 // Text size | |
| 292 T_R2D_TEXT_SIZE text_size; | |
| 293 // Font framebuffer | |
| 294 T_R2D_FRAMEBUFFER *font_frame_buffer; | |
| 295 // Font metrics pointer | |
| 296 INT32 *font_metrics; | |
| 297 // Font transcoding table | |
| 298 INT32 *font_table; | |
| 299 // Script mode (left to right by defaulr) | |
| 300 T_R2D_SCRIPT_MODE script_mode; | |
| 301 } T_R2D_GC; | |
| 302 | |
| 303 //////////////////////////////////////// | |
| 304 // | |
| 305 // FONT CONFIG | |
| 306 // | |
| 307 | |
| 308 typedef INT32 *T_R2D_FONT_METRICS; | |
| 309 typedef INT32 *T_R2D_FONT_TABLE; | |
| 310 | |
| 311 typedef struct R2D_FONT_DESCRIPTION | |
| 312 { | |
| 313 T_R2D_FONT_TABLE table; | |
| 314 T_R2D_FONT_METRICS metrics; | |
| 315 T_R2D_FRAMEBUFFER_PTR framebuffer; | |
| 316 BOOLEAN compute_bold; | |
| 317 } T_R2D_FONT_DESCRIPTION; | |
| 318 | |
| 319 | |
| 320 /*************************************** | |
| 321 | |
| 322 FUNCTIONS | |
| 323 | |
| 324 ***************************************/ | |
| 325 | |
| 326 //////////////////////////////////////// | |
| 327 // | |
| 328 // TOOL | |
| 329 // MACROS | |
| 330 // | |
| 331 | |
| 332 // One should never call following function directly | |
| 333 // because when refcount is reaching 0 an object | |
| 334 // has generally subobject torelease before releasing | |
| 335 // itself | |
| 336 | |
| 337 // Decrement refcount and autodelete if required | |
| 338 #define r2d_release(p) { \ | |
| 339 if (p) \ | |
| 340 { \ | |
| 341 if ((((T_R2D_REFCOUNT*)(p))->refcount)>0) { \ | |
| 342 ((T_R2D_REFCOUNT*)(p))->refcount--; \ | |
| 343 if ((((T_R2D_REFCOUNT*)(p))->refcount==0)) \ | |
| 344 R2D_FREE(p); \ | |
| 345 } \ | |
| 346 } \ | |
| 347 } | |
| 348 | |
| 349 | |
| 350 // Return refcount of an object | |
| 351 #define R2D_REFCOUNT(p) (((T_R2D_REFCOUNT*)(p))->refcount) | |
| 352 | |
| 353 // Compute dithered value | |
| 354 // lightness is either the gray intensity (for monochrome) | |
| 355 // or the component intensity. | |
| 356 // It is coded on at most 8 bits | |
| 357 #if (R2D_DITHERING == R2D_ON) | |
| 358 | |
| 359 #define r2d_dithering_group_and_lightness() \ | |
| 360 lightness = lightness >> (8 - R2D_DITHERING_DIMENSION - R2D_PIXEL_DEPTH); \ | |
| 361 dithering_group=lightness >> R2D_DITHERING_DIMENSION; \ | |
| 362 \ | |
| 363 lightness=lightness & R2D_DITHERED_MASK; | |
| 364 | |
| 365 #define r2d_dithered_value(x,y) \ | |
| 366 \ | |
| 367 dvalue=dithering_group; \ | |
| 368 if (lightness>=r2d_get_dithering_matrix_entry(r2d_g_dithering_matrix,x,y)) \ | |
| 369 dvalue+=1; \ | |
| 370 \ | |
| 371 if (dvalue) \ | |
| 372 dvalue--; | |
| 373 #else | |
| 374 #define r2d_dithering_group_and_lightness() | |
| 375 #define r2d_dithered_value(x,y) | |
| 376 #endif | |
| 377 | |
| 378 extern INT32 r2d_ptree_find(INT32 *tree,INT32 unicode); | |
| 379 | |
| 380 void r2d_arc_region_x_reflect(T_R2D_ARC_REGION *rgn); | |
| 381 void r2d_arc_region_y_reflect(T_R2D_ARC_REGION *rgn); | |
| 382 void r2d_arc_region_diagonal_reflect(T_R2D_ARC_REGION *rgn); | |
| 383 BOOLEAN r2d_check_is_in_arc_region(INT16 x,INT16 y,T_R2D_ARC_REGION *rgn); | |
| 384 INT32 r2d_get_point_side(INT16 x,INT16 y,INT32 sa,INT32 sb); | |
| 385 | |
| 386 //////////////////////////////////////// | |
| 387 // | |
| 388 // LCD | |
| 389 // FUNCTIONS | |
| 390 // | |
| 391 | |
| 392 extern void r2d_convert_foreground_color(T_R2D_GC *gc,UINT32 color); | |
| 393 extern void r2d_convert_background_color(T_R2D_GC *gc,UINT32 color); | |
| 394 extern BOOLEAN r2d_lcd_foreground_pixel(UINT32 lcd_value,T_R2D_GC_PTR src_gc); | |
| 395 extern UINT32 r2d_color_to_lcd(UINT32 pixel_value,INT16 x,INT16 y); | |
| 396 extern UINT32 r2d_lcd_to_color(UINT32 color); | |
| 397 | |
| 398 //////////////////////////////////////// | |
| 399 // | |
| 400 // SHAPE LOW LEVEL | |
| 401 // FUNCTIONS | |
| 402 // | |
| 403 | |
| 404 void r2d_release_rectangle(T_R2D_SHAPE *self); | |
| 405 void r2d_draw_rectangle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 406 void r2d_fill_rectangle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 407 T_R2D_SHAPE_PTR r2d_clone_rectangle_shape(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 408 | |
| 409 void r2d_release_circle(T_R2D_SHAPE *self); | |
| 410 void r2d_draw_circle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 411 void r2d_fill_circle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 412 T_R2D_SHAPE_PTR r2d_clone_circle_shape(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 413 | |
| 414 void r2d_release_ellipse(T_R2D_SHAPE *self); | |
| 415 void r2d_draw_ellipse_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 416 void r2d_fill_ellipse_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 417 | |
| 418 void r2d_release_round_rectangle(T_R2D_SHAPE *self); | |
| 419 void r2d_draw_round_rectangle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 420 void r2d_fill_round_rectangle_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 421 T_R2D_SHAPE_PTR r2d_clone_round_rectangle_shape(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 422 | |
| 423 void r2d_release_arc(T_R2D_SHAPE *self); | |
| 424 void r2d_draw_arc_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 425 void r2d_fill_arc_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 426 T_R2D_SHAPE_PTR r2d_clone_arc_shape(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 427 | |
| 428 void r2d_release_text(T_R2D_SHAPE *self); | |
| 429 void r2d_draw_text_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 430 void r2d_fill_text_shape(T_R2D_SHAPE *self,T_R2D_GC_PTR gc); | |
| 431 T_R2D_SHAPE_PTR r2d_clone_text_shape(T_RVF_MB_ID bank,T_R2D_SHAPE *self); | |
| 432 | |
| 433 void r2d_translate_rectangle_shape(T_R2D_SHAPE *self,INT16 dx,INT16 dy); | |
| 434 void r2d_translate_point_shape(T_R2D_SHAPE *self,INT16 dx,INT16 dy); | |
| 435 | |
| 436 BOOLEAN r2d_point_in_rectangle_shape(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 437 BOOLEAN r2d_point_in_circle_shape(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 438 BOOLEAN r2d_point_in_ellipse_shape(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 439 BOOLEAN r2d_point_in_round_rectangle_shape(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 440 BOOLEAN r2d_point_in_not_supported_shape(T_R2D_SHAPE *self,INT16 x,INT16 y); | |
| 441 | |
| 442 //////////////////////////////////////// | |
| 443 // | |
| 444 // FRAMEBUFFER ACCESS | |
| 445 // FUNCTIONS | |
| 446 // | |
| 447 | |
| 448 | |
| 449 | |
| 450 // Write a pixel at position x,y with graphic context gc | |
| 451 // pixel_value must be compatible with the framebuffer owned | |
| 452 // by the graphic context. No color conversion is done | |
| 453 // here | |
| 454 extern void r2d_write_lcd_pixel(T_R2D_GC *gc,INT16 x,INT16 y,UINT32 pixel_value); | |
| 455 extern void r2d_write_lcd_line(T_R2D_GC* gc,INT16 x,INT16 y,INT16 nb,R2D_BOOLEAN | |
| 456 background); | |
| 457 extern void r2d_arc_write_lcd_line(T_R2D_GC* gc,INT16 x,INT16 y,INT16 org_x,INT16 org_y,INT16 nb, | |
| 458 T_R2D_ARC_REGION *rgn,R2D_BOOLEAN | |
| 459 background); | |
| 460 | |
| 461 | |
| 462 extern T_R2D_DRAWING_OP r2d_get_drawing_op(T_R2D_GC *gc,T_R2D_DRAWING_MODE mode); | |
| 463 #if (R2D_ASM == R2D_ON) | |
| 464 extern UINT32 * r2d_get_asm_drawing_op(T_R2D_GC *gc,T_R2D_DRAWING_MODE mode); | |
| 465 | |
| 466 #endif | |
| 467 | |
| 468 //////////////////////////////////////// | |
| 469 // | |
| 470 // COLOR | |
| 471 // FUNCTIONS | |
| 472 // | |
| 473 | |
| 474 // color conversion : on the fly dithering and color scaling | |
| 475 // with final conversion to the format used by the LCD if needed | |
| 476 // The dithered matrix or the pixel_value are cached into the gc | |
| 477 // structure | |
| 478 extern void r2d_convert_foreground_color(T_R2D_GC *gc,UINT32 color); | |
| 479 extern void r2d_convert_background_color(T_R2D_GC *gc,UINT32 color); | |
| 480 | |
| 481 // Get value at dithering matrix position | |
| 482 #define r2d_get_dithering_matrix_entry(matrix,x,y) \ | |
| 483 *(matrix+(x&1)+(y&1)*2) | |
| 484 | |
| 485 // Set element (x,y) of dithering or dithered matrix | |
| 486 extern void r2d_set_dithering_matrix_entry(UINT32 *matrix,UINT32 elem,INT16 x,INT16 y); | |
| 487 | |
| 488 extern void r2d_convert_foreground_color_color(T_R2D_GC *gc,UINT32 color); | |
| 489 extern void r2d_convert_background_color_color(T_R2D_GC *gc,UINT32 color); | |
| 490 | |
| 491 extern UINT16 r2d_max_color(UINT16 red,UINT16 green, UINT16 blue); | |
| 492 // Get min component | |
| 493 extern UINT16 r2d_min_color(UINT16 red,UINT16 green, UINT16 blue); | |
| 494 | |
| 495 extern UINT32 r2d_get_color_pixel_value(T_R2D_GC *gc,INT16 x,INT16 y); | |
| 496 | |
| 497 //////////////////////////////////////// | |
| 498 // | |
| 499 // TEXT | |
| 500 // FUNCTIONS | |
| 501 // | |
| 502 | |
| 503 #define r2d_get_char_x(p) (((INT32*)p)[0]) | |
| 504 | |
| 505 //////////////////////////////////////// | |
| 506 // | |
| 507 // COPY | |
| 508 // FUNCTIONS | |
| 509 // | |
| 510 | |
| 511 #if (R2D_ASM == R2D_OFF) | |
| 512 | |
| 513 void r2d_blit_lcd_to_lcd(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
| 514 T_R2D_SHAPE_PTR src_rectangle, T_R2D_SHAPE_PTR dst_rectangle, | |
| 515 R2D_BOOLEAN use_foreground_color); | |
| 516 | |
| 517 void r2d_blit_color_to_color(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
| 518 T_R2D_SHAPE_PTR src_rectangle, T_R2D_SHAPE_PTR dst_rectangle, | |
| 519 R2D_BOOLEAN use_foreground_color); | |
| 520 | |
| 521 void r2d_blit_lcd_to_color(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
| 522 T_R2D_SHAPE_PTR src_rectangle, T_R2D_SHAPE_PTR dst_rectangle, | |
| 523 R2D_BOOLEAN use_foreground_color); | |
| 524 | |
| 525 void r2d_blit_color_to_lcd(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
| 526 T_R2D_SHAPE_PTR src_rectangle, T_R2D_SHAPE_PTR dst_rectangle, | |
| 527 R2D_BOOLEAN use_foreground_color); | |
| 528 #else | |
| 529 | |
| 530 void r2d_blit_asm(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
| 531 T_R2D_SHAPE_PTR src_rectangle, | |
| 532 T_R2D_SHAPE_PTR dst_rectangle, | |
| 533 R2D_BOOLEAN use_foreground_color,INT32 srcdst); | |
| 534 #endif | |
| 535 | |
| 536 | |
| 537 /*************************** | |
| 538 | |
| 539 DEFINES | |
| 540 | |
| 541 ***************************/ | |
| 542 | |
| 543 /* FOR SEARCH INSIDE PATRICIA TREE */ | |
| 544 #define R2D_PTREE_TYPE 3 | |
| 545 #define R2D_PTREE_BRANCHING 0 | |
| 546 #define R2D_PTREE_PREFIX 1 | |
| 547 #define R2D_PTREE_UNICODE_BLOCK 0 | |
| 548 #define R2D_PTREE_GLYPH_INDEX 1 | |
| 549 #define R2D_PTREE_CONVERSION 2 | |
| 550 #define R2D_PTREE_LEFT 2 | |
| 551 #define R2D_PTREE_RIGHT 3 | |
| 552 #define R2D_PTREE_CONVERSION 2 | |
| 553 #define R2D_PTREE_T_LEAF 0 | |
| 554 #define R2D_PTREE_SHIFT 4 | |
| 555 | |
| 556 /* FOR FONT DESCRIPTION */ | |
| 557 | |
| 558 #define R2D_SMALL_SYSTEM_NORMAL 0 | |
| 559 #define R2D_SMALL_SYSTEM_BOLD 1 | |
| 560 #define R2D_SMALL_SYSTEM_ITALIC 2 | |
| 561 #define R2D_SMALL_SYSTEM_BOLD_ITALIC 3 | |
| 562 | |
| 563 #define R2D_MEDIUM_SYSTEM_NORMAL 4 | |
| 564 #define R2D_MEDIUM_SYSTEM_BOLD 5 | |
| 565 #define R2D_MEDIUM_SYSTEM_ITALIC 6 | |
| 566 #define R2D_MEDIUM_SYSTEM_BOLD_ITALIC 7 | |
| 567 | |
| 568 #define R2D_BIG_SYSTEM_NORMAL 8 | |
| 569 #define R2D_BIG_SYSTEM_BOLD 9 | |
| 570 #define R2D_BIG_SYSTEM_ITALIC 10 | |
| 571 #define R2D_BIG_SYSTEM_BOLD_ITALIC 11 | |
| 572 | |
| 573 #define R2D_SMALL_TYPEWRITER_NORMAL 12 | |
| 574 #define R2D_SMALL_TYPEWRITER_BOLD 13 | |
| 575 #define R2D_SMALL_TYPEWRITER_ITALIC 14 | |
| 576 #define R2D_SMALL_TYPEWRITER_BOLD_ITALIC 15 | |
| 577 | |
| 578 #define R2D_MEDIUM_TYPEWRITER_NORMAL 16 | |
| 579 #define R2D_MEDIUM_TYPEWRITER_BOLD 17 | |
| 580 #define R2D_MEDIUM_TYPEWRITER_ITALIC 18 | |
| 581 #define R2D_MEDIUM_TYPEWRITER_BOLD_ITALIC 19 | |
| 582 | |
| 583 #define R2D_BIG_TYPEWRITER_NORMAL 20 | |
| 584 #define R2D_BIG_TYPEWRITER_BOLD 21 | |
| 585 #define R2D_BIG_TYPEWRITER_ITALIC 22 | |
| 586 #define R2D_BIG_TYPEWRITER_BOLD_ITALIC 23 | |
| 587 | |
| 588 #define R2D_SMALL_PROPORTIONAL_NORMAL 24 | |
| 589 #define R2D_SMALL_PROPORTIONAL_BOLD 25 | |
| 590 #define R2D_SMALL_PROPORTIONAL_ITALIC 26 | |
| 591 #define R2D_SMALL_PROPORTIONAL_BOLD_ITALIC 27 | |
| 592 | |
| 593 #define R2D_MEDIUM_PROPORTIONAL_NORMAL 28 | |
| 594 #define R2D_MEDIUM_PROPORTIONAL_BOLD 29 | |
| 595 #define R2D_MEDIUM_PROPORTIONAL_ITALIC 30 | |
| 596 #define R2D_MEDIUM_PROPORTIONAL_BOLD_ITALIC 31 | |
| 597 | |
| 598 #define R2D_BIG_PROPORTIONAL_NORMAL 32 | |
| 599 #define R2D_BIG_PROPORTIONAL_BOLD 33 | |
| 600 #define R2D_BIG_PROPORTIONAL_ITALIC 34 | |
| 601 #define R2D_BIG_PROPORTIONAL_BOLD_ITALIC 35 | |
| 602 | |
| 603 | |
| 604 /*************************** | |
| 605 | |
| 606 GLOBALS | |
| 607 | |
| 608 ****************************/ | |
| 609 | |
| 610 // and for reentrancy they should be read only if possible | |
| 611 // or protected by a semaphore otherwise | |
| 612 | |
| 613 #if (R2D_ASM == R2D_ON) | |
| 614 extern T_RVF_MUTEX * r2d_g_blit_mutex; | |
| 615 extern T_R2D_DRAWING_MODE r2d_g_old_mode; | |
| 616 extern R2D_BOOLEAN r2d_g_old_use_foreground; | |
| 617 extern INT32 r2d_g_old_srcdst; | |
| 618 #endif | |
| 619 | |
| 620 // Global mutex for access to global variables | |
| 621 extern T_RVF_MUTEX * r2d_g_global_mutex; | |
| 622 | |
| 623 | |
| 624 // Drawing operators (C version) | |
| 625 extern const T_R2D_DRAWING_OPERATORS r2d_g_lcd_operators,r2d_g_color_operators; | |
| 626 | |
| 627 extern UINT32 *r2d_g_asm_lcd_operators[],*r2d_g_asm_color_operators[]; | |
| 628 | |
| 629 // LCD framebuffer | |
| 630 extern T_R2D_FRAMEBUFFER* r2d_g_framebuffer; | |
| 631 | |
| 632 // For fonts | |
| 633 | |
| 634 extern T_R2D_FONT_DESCRIPTION *r2d_g_font_configuration; | |
| 635 | |
| 636 // (default pointers for initialization of graphical context) | |
| 637 extern T_R2D_FRAMEBUFFER *r2d_g_default_font_framebuffer; | |
| 638 extern INT32 *r2d_g_default_font_metrics; | |
| 639 extern INT32 *r2d_g_default_font_table; | |
| 640 | |
| 641 | |
| 642 // Dithering matrix | |
| 643 extern UINT32 *r2d_g_dithering_matrix; | |
| 644 | |
| 645 // Class globals | |
| 646 extern const T_R2D_CLASS_SHAPE r2d_class_rectangle; | |
| 647 extern const T_R2D_CLASS_SHAPE r2d_class_circle; | |
| 648 extern const T_R2D_CLASS_SHAPE r2d_class_ellipse; | |
| 649 extern const T_R2D_CLASS_SHAPE r2d_class_round_rectangle; | |
| 650 extern const T_R2D_CLASS_SHAPE r2d_class_arc; | |
| 651 extern const T_R2D_CLASS_SHAPE r2d_class_text; | |
| 652 | |
| 653 // Memory bank id | |
| 654 extern T_RVF_MB_ID r2d_mb_id; | |
| 655 | |
| 656 // Global LCD graphical context | |
| 657 extern T_R2D_GC_PTR r2d_g_lcd_gc; | |
| 658 | |
| 659 // Global flag to check if event required | |
| 660 extern BOOLEAN r2d_g_event_was_sent; | |
| 661 | |
| 662 // Global flag to disable refresh | |
| 663 extern INT16 r2d_g_refresh_disabled; | |
| 664 | |
| 665 /* global addr id */ | |
| 666 extern T_RVF_ADDR_ID r2d_addr_id; | |
| 667 | |
| 668 | |
| 669 #endif | |
| 670 |
