FreeCalypso > hg > leo2moko-debug
comparison chipsetsw/drivers/drv_app/r2d/r2d.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /** | |
2 | |
3 @file: r2d.h | |
4 | |
5 @author Christophe Favergeon | |
6 | |
7 @version 1.0 | |
8 | |
9 Purpose: Riviera 2D : Public API | |
10 | |
11 */ | |
12 | |
13 /* | |
14 | |
15 Date Modification | |
16 ------------------------------------ | |
17 06/02/2001 Create | |
18 10/18/2001 Version 0.5 for first integration with Riviera database | |
19 04/30/2002 Version 1.0 | |
20 | |
21 | |
22 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved | |
23 */ | |
24 | |
25 /* | |
26 History | |
27 | |
28 Apr-06-2005 MMI-SPR-29655 - xreddymn | |
29 Added function r2d_flush_region to allow flushing of portions | |
30 of framebuffer to the display | |
31 | |
32 */ | |
33 | |
34 | |
35 #ifndef __R2D_H_ | |
36 #define __R2D_H_ | |
37 | |
38 #include "rv/general.h" | |
39 #include "rvf/rvf_api.h" | |
40 #include "r2d/r2d_config.h" | |
41 | |
42 | |
43 /*************************************** | |
44 | |
45 IMPORTANT NOTES | |
46 | |
47 ***************************************/ | |
48 | |
49 // For speed reasons the system is minimizing | |
50 // number of checks. | |
51 | |
52 // So, the user must ensure that some | |
53 // conditions are respected before she/he | |
54 // calls the drawing subroutines : | |
55 | |
56 // For rectangle, ellipse etc... one must | |
57 // has : br_x > ul_x and br_y > ul_y | |
58 | |
59 // Rectangles and ellipse where one of | |
60 // the dimensions is 0 are not allowed | |
61 | |
62 // For circle, the radius must be strictly | |
63 // positive | |
64 | |
65 | |
66 | |
67 /*************************************** | |
68 | |
69 TYPES / CONSTANTS | |
70 | |
71 ***************************************/ | |
72 | |
73 //////////////////////////////////////// | |
74 // | |
75 // GENERAL | |
76 // | |
77 | |
78 typedef enum K_R2D_ERROR | |
79 { | |
80 R2D_OK=0, | |
81 R2D_MEMORY_ERR=-4, | |
82 R2D_UNKNOWN_OP=-5, | |
83 R2D_LOCK_ERROR=-6, | |
84 R2D_UNLOCK_ERROR=-7 | |
85 } T_R2D_ERROR; | |
86 | |
87 //////////////////////////////////////// | |
88 // | |
89 // Memory | |
90 // | |
91 typedef void *T_R2D_REFCOUNT_PTR; | |
92 | |
93 // Should NEVER be allocated on stack | |
94 typedef struct R2D_REFCOUNTING | |
95 { | |
96 // Refcounting | |
97 INT16 refcount; | |
98 } T_R2D_REFCOUNT; | |
99 | |
100 | |
101 //////////////////////////////////////// | |
102 // | |
103 // Framebuffer | |
104 // | |
105 typedef enum {R2D_LCD_KIND=1, R2D_FULL_KIND} T_R2D_FRAMEBUFFER_KIND; | |
106 | |
107 typedef void *T_R2D_FRAMEBUFFER_PTR; | |
108 | |
109 | |
110 //////////////////////////////////////// | |
111 // | |
112 // Graphic context | |
113 // | |
114 typedef void *T_R2D_GC_PTR; | |
115 | |
116 typedef enum K_R2D_DRAWING_MODE { | |
117 R2D_COPY_MODE=0, | |
118 R2D_OR_MODE, | |
119 R2D_AND_MODE, | |
120 R2D_XOR_MODE, | |
121 R2D_NOT_COPY_MODE, | |
122 R2D_NOT_OR_MODE, | |
123 R2D_NOT_AND_MODE, | |
124 R2D_NOT_XOR_MODE, | |
125 R2D_ALPHA_MODE, | |
126 R2D_ERASE_MODE | |
127 } T_R2D_DRAWING_MODE ; | |
128 | |
129 typedef enum K_R2D_COLOR_REF | |
130 { | |
131 R2D_RED=1, | |
132 R2D_BLUE, | |
133 R2D_GREEN, | |
134 R2D_WHITE, | |
135 R2D_BLACK, | |
136 R2D_GRAY50 | |
137 } T_R2D_COLOR_REF; | |
138 | |
139 typedef enum K_R2D_TEXT_FACE | |
140 { | |
141 R2D_SYSTEM=1, | |
142 R2D_TYPEWRITER, | |
143 R2D_PROPORTIONAL | |
144 } T_R2D_TEXT_FACE; | |
145 | |
146 typedef enum K_R2D_TEXT_STYLE | |
147 { | |
148 R2D_PLAIN=1, | |
149 R2D_BOLD=2, | |
150 R2D_ITALIC=4, | |
151 R2D_UNDERLINED=8, | |
152 R2D_STRIKETHROUGH=16 | |
153 } T_R2D_TEXT_STYLE; | |
154 | |
155 typedef enum K_R2D_TEXT_SIZE | |
156 { | |
157 R2D_SMALL=1, | |
158 R2D_MEDIUM, | |
159 R2D_LARGE | |
160 } T_R2D_TEXT_SIZE ; | |
161 | |
162 typedef enum K_R2D_SCRIPT_MODE | |
163 { | |
164 R2D_LEFT_TO_RIGHT=1, | |
165 R2D_RIGHT_TO_LEFT=2 | |
166 } T_R2D_SCRIPT_MODE ; | |
167 | |
168 | |
169 //////////////////////////////////////// | |
170 // | |
171 // Shapes | |
172 // | |
173 typedef void *T_R2D_SHAPE_PTR; | |
174 | |
175 typedef struct R2D_R | |
176 { | |
177 INT16 refcount; | |
178 void *p_r2d_class; | |
179 INT16 ul_x,ul_y,br_x,br_y; | |
180 } T_R2D_RECT; | |
181 | |
182 //////////////////////////////////////// | |
183 // | |
184 // Text | |
185 // | |
186 typedef UINT16 T_R2D_UTF16; | |
187 typedef UINT32* T_R2D_CHAR_METRIC_PTR; | |
188 | |
189 //////////////////////////////////////// | |
190 // | |
191 // Color | |
192 // | |
193 typedef UINT32 T_R2D_ARGB_COLOR; | |
194 | |
195 //////////////////////////////////////// | |
196 // | |
197 // Textures | |
198 // | |
199 typedef void *T_R2D_FREE_TEXTURE_PTR; | |
200 typedef void *T_R2D_ANCHORED_TEXTURE_PTR; | |
201 | |
202 | |
203 /*************************************** | |
204 | |
205 Functions | |
206 | |
207 ***************************************/ | |
208 | |
209 //////////////////////////////////////// | |
210 // | |
211 // Memory | |
212 // | |
213 | |
214 // Increment refcount of an object | |
215 #define r2d_retain(p) {\ | |
216 if (p) \ | |
217 { \ | |
218 if (((T_R2D_REFCOUNT*)(p))->refcount>0) \ | |
219 ((T_R2D_REFCOUNT*)(p))->refcount++; \ | |
220 \ | |
221 } \ | |
222 } | |
223 | |
224 //////////////////////////////////////// | |
225 // | |
226 // Texture | |
227 // | |
228 | |
229 // The pattern is an array of ARGB colors saved column per column | |
230 T_R2D_FREE_TEXTURE_PTR r2d_new_free_texture(T_RVF_MB_ID bank,INT16 size,T_R2D_ARGB_COLOR *pattern); | |
231 T_R2D_FREE_TEXTURE_PTR r2d_new_const_free_texture(T_RVF_MB_ID bank,INT16 size,T_R2D_ARGB_COLOR *pattern); | |
232 | |
233 T_R2D_ANCHORED_TEXTURE_PTR r2d_new_anchored_texture(T_RVF_MB_ID bank,T_R2D_GC_PTR gc,T_R2D_FREE_TEXTURE_PTR texture); | |
234 | |
235 void r2d_release_free_texture(T_R2D_FREE_TEXTURE_PTR texture); | |
236 void r2d_release_anchored_texture(T_R2D_ANCHORED_TEXTURE_PTR texture); | |
237 | |
238 //////////////////////////////////////// | |
239 // | |
240 // Framebuffer | |
241 // | |
242 | |
243 | |
244 T_R2D_FRAMEBUFFER_PTR r2d_new_framebuffer(T_RVF_MB_ID bank,T_R2D_FRAMEBUFFER_KIND the_kind,UINT16 width, UINT16 height); | |
245 void r2d_release_framebuffer(T_R2D_FRAMEBUFFER_PTR the_framebuffer); | |
246 | |
247 // return the size used in a memory bank by a framebuffer | |
248 UINT32 r2d_get_framebuffer_size(T_R2D_FRAMEBUFFER_KIND the_kind,UINT16 width, UINT16 height); | |
249 | |
250 //////////////////////////////////////// | |
251 // | |
252 // Graphic context | |
253 // | |
254 | |
255 // Return a new graphical contect connected to the LCD framebuffer | |
256 // (The LCD framebuffer is private) | |
257 T_R2D_GC_PTR r2d_new_lcd_context(T_RVF_MB_ID bank); | |
258 | |
259 // Return a new graphical context connected to a framebuffer | |
260 T_R2D_GC_PTR r2d_new_context(T_RVF_MB_ID bank,T_R2D_FRAMEBUFFER_PTR the_frame_buffer); | |
261 | |
262 // Return size used in a memory bank by a graphical context (not taking | |
263 // into account the framebuffer used by this context) | |
264 // For LCD context, the LCD framebuffer is created at build time and | |
265 // does not take any space in any memory bank. Other framebuffers are | |
266 // using memory from the memory bank | |
267 UINT32 r2d_get_gc_size(void); | |
268 | |
269 // Return a graphical context for a picture saved in R2D format | |
270 T_R2D_GC_PTR r2d_new_picture_context(T_RVF_MB_ID bank,const UINT32 *the_picture,T_R2D_FRAMEBUFFER_KIND kind); | |
271 void r2d_release_picture_context(T_R2D_GC_PTR gc); | |
272 | |
273 // Release a graphical context. | |
274 // For LCD, the framebuffer is released but never deleted | |
275 // since it is also owned by the R2D software entity | |
276 void r2d_release_context(T_R2D_GC_PTR gc); | |
277 | |
278 // Clear the content of the framebuffer referenced by | |
279 // the graphic context (in white); | |
280 void r2d_erase(T_R2D_GC_PTR gc); | |
281 void r2d_erase_with_background(T_R2D_GC_PTR gc, | |
282 INT16 a,INT16 b, | |
283 INT16 c,INT16 d); | |
284 | |
285 // Get size and width of the drawing area of the framebuffer referenced | |
286 // by the graphic context. The framebuffer (as a memory area) is generally | |
287 // a bit larger than the drawing area (defined by width*height) because | |
288 // of memory alignment constraints | |
289 UINT16 r2d_get_width(T_R2D_GC_PTR gc); | |
290 UINT16 r2d_get_height(T_R2D_GC_PTR gc); | |
291 | |
292 void r2d_get_pen_pos(T_R2D_GC_PTR gc,INT16 *x,INT16 *y); | |
293 | |
294 // | |
295 // Drawing mode settings | |
296 T_R2D_DRAWING_MODE r2d_get_drawing_mode(T_R2D_GC_PTR gc); | |
297 T_R2D_ERROR r2d_set_drawing_mode(T_R2D_GC_PTR gc,T_R2D_DRAWING_MODE the_mode); | |
298 | |
299 UINT16 r2d_get_pen_size(T_R2D_GC_PTR gc); | |
300 void r2d_set_pen_size(T_R2D_GC_PTR gc,UINT16 the_size); | |
301 | |
302 BOOLEAN r2d_dash_enabled(T_R2D_GC_PTR gc); | |
303 void r2d_set_dash_state(T_R2D_GC_PTR gc,BOOLEAN enabled); | |
304 | |
305 // Get or set the coordinates of the origin of the framebuffer in the | |
306 // graphic context (upper-left point) | |
307 // Clipping shape does not move when origin coordinates are | |
308 // changed. It is always at the same position relatively to the | |
309 // framebuffer | |
310 void r2d_set_context_origin(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
311 void r2d_get_context_origin(T_R2D_GC_PTR gc,INT16 *x,INT16 *y); | |
312 | |
313 // Convert coordinates such that the framebuffer origin is (0,0) | |
314 // after the transform | |
315 void r2d_local_to_global(T_R2D_GC_PTR gc,INT16 *x,INT16 *y); | |
316 | |
317 // | |
318 // Text settings | |
319 void r2d_set_text_face(T_R2D_GC_PTR gc,T_R2D_TEXT_FACE the_face); | |
320 T_R2D_TEXT_FACE r2d_get_text_face(T_R2D_GC_PTR gc); | |
321 | |
322 void r2d_set_text_style(T_R2D_GC_PTR gc,T_R2D_TEXT_STYLE the_style); | |
323 T_R2D_TEXT_STYLE r2d_get_text_style(T_R2D_GC_PTR gc); | |
324 | |
325 void r2d_set_text_size(T_R2D_GC_PTR gc,T_R2D_TEXT_SIZE the_size); | |
326 T_R2D_TEXT_SIZE r2d_get_text_size(T_R2D_GC_PTR gc); | |
327 | |
328 T_R2D_ERROR r2d_context_lock(T_R2D_GC_PTR gc); | |
329 T_R2D_ERROR r2d_context_unlock(T_R2D_GC_PTR gc); | |
330 | |
331 // Flush lcd framebuffer to force the display | |
332 void r2d_flush(void); | |
333 | |
334 // xreddymn Apr-06-2005 MMI-SPR-29655: Function to flush a region to display | |
335 void r2d_flush_region(INT16 ul_x,INT16 ul_y,INT16 br_x,INT16 br_y); | |
336 | |
337 void r2d_disable_refresh(void); | |
338 void r2d_enable_refresh(void); | |
339 | |
340 | |
341 // Return the a pointer to the memory area containing | |
342 // pixels for the graphic context gc | |
343 // Use with care | |
344 UINT32* r2d_get_pixmap(T_R2D_GC_PTR gc); | |
345 | |
346 //////////////////////////////////////// | |
347 // | |
348 // Colors | |
349 // | |
350 | |
351 // (Never assume a particular format for the ARGB field | |
352 // and use Riviera functions to create/set/get colors) | |
353 | |
354 // Get ARGB foreground color | |
355 T_R2D_ARGB_COLOR r2d_get_foreground_color(T_R2D_GC_PTR gc); | |
356 | |
357 // Set foreground color (seperate components or packed format as | |
358 // returned by the Riviera 2D API) | |
359 void r2d_set_foreground_color_with_argb(T_R2D_GC_PTR gc,UINT16 alpha,UINT16 red, | |
360 UINT16 green,UINT16 blue); | |
361 void r2d_set_foreground_color(T_R2D_GC_PTR gc,T_R2D_ARGB_COLOR color); | |
362 | |
363 // Get ARGB background color | |
364 T_R2D_ARGB_COLOR r2d_get_background_color(T_R2D_GC_PTR gc); | |
365 | |
366 // Set ARGB background color | |
367 // ("A" field not supported in that version) | |
368 void r2d_set_background_color_with_argb(T_R2D_GC_PTR gc,UINT16 alpha,UINT16 red, | |
369 UINT16 green,UINT16 blue); | |
370 void r2d_set_background_color(T_R2D_GC_PTR gc,T_R2D_ARGB_COLOR color); | |
371 | |
372 // Set background texture | |
373 // (it hides temporarily the background color) | |
374 void r2d_set_background_texture(T_R2D_GC_PTR gc,T_R2D_ANCHORED_TEXTURE_PTR texture); | |
375 T_R2D_ANCHORED_TEXTURE_PTR r2d_get_background_texture(T_R2D_GC_PTR gc); | |
376 | |
377 | |
378 // Get color components from an ARGB color | |
379 #define r2d_alpha(color) ((UINT16)(((color & 0x0FF000000) >> 24))) | |
380 #define r2d_red(color) ((UINT16)(((color & 0x0FF0000) >> 16))) | |
381 #define r2d_green(color) ((UINT16)(((color & 0x0FF00) >> 8))) | |
382 #define r2d_blue(color) ((UINT16)(((color & 0x00FF)))) | |
383 | |
384 T_R2D_ARGB_COLOR r2d_new_argb_color(UINT16 alpha,UINT16 red,UINT16 green,UINT16 blue); | |
385 | |
386 T_R2D_ARGB_COLOR r2d_get_argb_color_at_point(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
387 T_R2D_ARGB_COLOR r2d_get_standard_argb_color(T_R2D_COLOR_REF ref); | |
388 void r2d_hsv_to_rgb( INT16 *r, INT16 *g, INT16 *b, INT32 h, INT32 s, INT32 v ); | |
389 | |
390 //////////////////////////////////////// | |
391 // | |
392 // Shape functions | |
393 // | |
394 | |
395 void r2d_draw_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc); | |
396 void r2d_fill_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc); | |
397 void r2d_translate_shape(T_R2D_SHAPE_PTR self,INT16 dx,INT16 dy); | |
398 void r2d_release_shape(T_R2D_SHAPE_PTR self); | |
399 T_R2D_SHAPE_PTR r2d_clone_shape(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR self); | |
400 | |
401 | |
402 T_R2D_SHAPE_PTR r2d_new_rectangle(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y,INT16 br_x,INT16 br_y); | |
403 T_R2D_SHAPE_PTR r2d_new_circle(T_RVF_MB_ID bank,INT16 x,INT16 y,INT16 r); | |
404 T_R2D_SHAPE_PTR r2d_new_ellipse(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y,INT16 br_x,INT16 br_y); | |
405 T_R2D_SHAPE_PTR r2d_new_round_rectangle(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y, | |
406 INT16 br_x,INT16 br_y,INT16 h,INT16 v); | |
407 | |
408 T_R2D_SHAPE_PTR r2d_new_arc(T_RVF_MB_ID bank,INT16 start_angle, INT16 stop_angle,INT16 ul_x,INT16 ul_y, | |
409 INT16 br_x,INT16 br_y); | |
410 | |
411 T_R2D_SHAPE_PTR r2d_new_text(T_RVF_MB_ID bank,INT16 x, INT16 y,T_R2D_UTF16 *the_text); | |
412 | |
413 T_R2D_SHAPE_PTR r2d_new_rectangle_intersection(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR a,T_R2D_SHAPE_PTR b); | |
414 T_R2D_SHAPE_PTR r2d_new_rectangle_union(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR a,T_R2D_SHAPE_PTR b); | |
415 | |
416 #define r2d_get_xmin(r) ((INT16)(((T_R2D_RECT*)r)->ul_x)) | |
417 #define r2d_get_ymin(r) ((INT16)(((T_R2D_RECT*)r)->ul_y)) | |
418 #define r2d_get_xmax(r) ((INT16)(((T_R2D_RECT*)r)->br_x)) | |
419 #define r2d_get_ymax(r) ((INT16)(((T_R2D_RECT*)r)->br_y)) | |
420 #define r2d_get_shape_width(r) (((INT16)(((T_R2D_RECT*)r)->br_x)) - ((INT16)(((T_R2D_RECT*)r)->ul_x))) | |
421 #define r2d_get_shape_height(r) (((INT16)(((T_R2D_RECT*)r)->br_y)) - ((INT16)(((T_R2D_RECT*)r)->ul_y))) | |
422 | |
423 //////////////////////////////////////// | |
424 // | |
425 // Clipping functions | |
426 // | |
427 | |
428 // For clipping with rectangle, we stop | |
429 // before xmax (at xmax-1) | |
430 // contrary to rectangle drawing where xmax is drawn | |
431 void r2d_set_clipping_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc); | |
432 T_R2D_SHAPE_PTR r2d_get_clipping_shape(T_R2D_GC_PTR gc); | |
433 T_R2D_ERROR r2d_restore_standard_clipping_shape(T_R2D_GC_PTR gc); | |
434 | |
435 //////////////////////////////////////// | |
436 // | |
437 // Test functions | |
438 // | |
439 BOOLEAN r2d_point_in_shape(T_R2D_SHAPE_PTR r,INT16 x,INT16 y); | |
440 | |
441 /////////////////////////////////////// | |
442 // | |
443 // Drawing functions | |
444 // | |
445 | |
446 // Draw a point in graphical context gc at position (x, y) | |
447 void r2d_draw_point(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
448 void r2d_erase_point(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
449 | |
450 // Move pen to point (x,y) | |
451 void r2d_moveto(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
452 // draw line from pen position to point (x,y) | |
453 // (Last point at (x,y) is NOT drawn since x,y is the ending | |
454 // coordinate and not the ending point) | |
455 void r2d_lineto(T_R2D_GC_PTR gc,INT16 x,INT16 y); | |
456 | |
457 // br means bottom right as displayed on screen but | |
458 // br has a higher y coordinate than ul | |
459 // since y increasing means below | |
460 | |
461 // Rectangle | |
462 void r2d_draw_rectangle(T_R2D_GC_PTR gc, | |
463 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y); | |
464 void r2d_fill_rectangle(T_R2D_GC_PTR gc, | |
465 INT16 ul_x,INT16 ul_y,INT16 br_x, INT16 br_y); | |
466 | |
467 // Circle | |
468 void r2d_draw_circle(T_R2D_GC_PTR gc, | |
469 INT16 x,INT16 y,INT16 r); | |
470 void r2d_fill_circle(T_R2D_GC_PTR gc, | |
471 INT16 x,INT16 y,INT16 r); | |
472 | |
473 // Ellipse | |
474 void r2d_draw_ellipse(T_R2D_GC_PTR gc, | |
475 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y); | |
476 void r2d_fill_ellipse(T_R2D_GC_PTR gc, | |
477 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y); | |
478 | |
479 | |
480 // Round Rectangle | |
481 void r2d_draw_round_rectangle(T_R2D_GC_PTR gc, | |
482 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y,INT16 h,INT16 v); | |
483 void r2d_fill_round_rectangle(T_R2D_GC_PTR gc, | |
484 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y,INT16 h,INT16 v); | |
485 | |
486 // Ellipse arc | |
487 | |
488 void r2d_draw_arc(T_R2D_GC_PTR gc,INT16 start_angle,INT16 stop_angle, | |
489 INT16 ul_x,INT16 ul_y,INT16 bl_x,INT16 bl_y); | |
490 void r2d_fill_arc(T_R2D_GC_PTR gc, INT16 start_angle,INT16 stop_angle, | |
491 INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y); | |
492 | |
493 /////////////////////////////////////// | |
494 // | |
495 // Copy function | |
496 // | |
497 | |
498 T_R2D_ERROR r2d_blit_rect(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc, | |
499 T_R2D_SHAPE_PTR src_rectangle, | |
500 T_R2D_SHAPE_PTR dst_rectangle, | |
501 BOOLEAN use_foreground_color); | |
502 | |
503 | |
504 | |
505 /////////////////////////////////////// | |
506 // | |
507 // Text functions | |
508 // | |
509 | |
510 #define r2d_get_char_width(p) (((INT32*)p)[1]) | |
511 #define r2d_get_char_height(p) (((INT32*)p)[2]) | |
512 #define r2d_get_char_dx(p) (((INT32*)p)[3]) | |
513 #define r2d_get_char_dy(p) (((INT32*)p)[4]) | |
514 #define r2d_get_char_org_x(p) (((INT32*)p)[5]) | |
515 #define r2d_get_char_org_y(p) (((INT32*)p)[6]) | |
516 | |
517 // Return nb of word16 (a Glyph may be made of more than one Unicode char | |
518 // so from more than one word16. Consequently, it does not represent the number | |
519 // or displayed chars) | |
520 INT16 r2d_str_nb_word16(T_R2D_UTF16 *l); | |
521 T_R2D_UTF16 *r2d_duplicate_text(T_RVF_MB_ID bank,T_R2D_UTF16 *l); | |
522 | |
523 T_R2D_UTF16 *r2d_new_unicode_from_cstring(T_RVF_MB_ID bank,unsigned char *the_string); | |
524 T_R2D_UTF16 *r2d_new_unicode_from_pstring(T_RVF_MB_ID bank,unsigned char *the_string); | |
525 | |
526 T_R2D_CHAR_METRIC_PTR r2d_get_char_metrics(T_R2D_GC_PTR gc,UINT32 the_char); | |
527 | |
528 UINT32 r2d_get_next_char(T_R2D_UTF16 *the_text,INT16 *pos, | |
529 UINT16 max_chars,BOOLEAN *swapping); | |
530 | |
531 | |
532 T_R2D_ERROR r2d_draw_char(T_R2D_GC_PTR font_cache_gc, | |
533 T_R2D_GC_PTR gc, | |
534 T_R2D_GC_PTR fontgc, | |
535 INT16 x,INT16 y,INT16 org_size,T_R2D_CHAR_METRIC_PTR p); | |
536 | |
537 T_R2D_ERROR r2d_draw_text(T_R2D_GC_PTR gc,INT16 x,INT16 y,T_R2D_UTF16 *the_text); | |
538 | |
539 // Length is given in word16 | |
540 T_R2D_ERROR r2d_draw_chars(T_R2D_GC_PTR gc,INT16 x,INT16 y,T_R2D_UTF16 *the_text, | |
541 UINT16 nb_words16); | |
542 | |
543 T_R2D_ERROR r2d_get_text_width(T_R2D_GC_PTR gc,T_R2D_UTF16 *the_text,UINT16 *size); | |
544 | |
545 // Length is given in word16 | |
546 T_R2D_ERROR r2d_get_width_of_chars(T_R2D_GC_PTR gc,T_R2D_UTF16 *the_text,UINT16 nb_words16,UINT16 *size); | |
547 | |
548 | |
549 void r2d_get_font_info(T_R2D_GC_PTR gc,INT16 *ascent,INT16 *descent,INT16 *leading); | |
550 | |
551 T_R2D_SCRIPT_MODE r2d_get_script_mode(T_R2D_GC_PTR gc); | |
552 void r2d_set_script_mode(T_R2D_GC_PTR gc,T_R2D_SCRIPT_MODE mode); | |
553 | |
554 /////////////////////////////////////// | |
555 // | |
556 // Globals | |
557 // | |
558 | |
559 #define R2D_EMPTY_RECT NULL | |
560 extern T_R2D_GC_PTR r2d_g_lcd_gc; | |
561 extern INT16 r2d_g_refresh_disabled; | |
562 | |
563 #endif |