⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 r2d.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
T_R2D_ERROR               r2d_set_drawing_mode(T_R2D_GC_PTR gc,T_R2D_DRAWING_MODE the_mode);

UINT16          r2d_get_pen_size(T_R2D_GC_PTR gc);
void           r2d_set_pen_size(T_R2D_GC_PTR gc,UINT16 the_size);

BOOLEAN        r2d_dash_enabled(T_R2D_GC_PTR gc);
void           r2d_set_dash_state(T_R2D_GC_PTR gc,BOOLEAN enabled);

// Get or set the coordinates of the origin of the framebuffer in the
// graphic context (upper-left point)
// Clipping shape does not move when origin coordinates are
// changed. It is always at the same position relatively to the
// framebuffer
void           r2d_set_context_origin(T_R2D_GC_PTR gc,INT16 x,INT16 y);
void           r2d_get_context_origin(T_R2D_GC_PTR gc,INT16 *x,INT16 *y);

// Convert coordinates such that the framebuffer origin is (0,0)
// after the transform
void           r2d_local_to_global(T_R2D_GC_PTR gc,INT16 *x,INT16 *y);

//
// Text settings
void           r2d_set_text_face(T_R2D_GC_PTR gc,T_R2D_TEXT_FACE the_face);
T_R2D_TEXT_FACE r2d_get_text_face(T_R2D_GC_PTR gc);

void           r2d_set_text_style(T_R2D_GC_PTR gc,T_R2D_TEXT_STYLE the_style);
T_R2D_TEXT_STYLE r2d_get_text_style(T_R2D_GC_PTR gc);

void           r2d_set_text_size(T_R2D_GC_PTR gc,T_R2D_TEXT_SIZE the_size);
T_R2D_TEXT_SIZE r2d_get_text_size(T_R2D_GC_PTR gc);

T_R2D_ERROR r2d_context_lock(T_R2D_GC_PTR gc);
T_R2D_ERROR r2d_context_unlock(T_R2D_GC_PTR gc);

// Flush lcd framebuffer to force the display
void           r2d_flush(void);

void           r2d_disable_refresh(void);
void           r2d_enable_refresh(void);


// Return the a pointer to the memory area containing
// pixels for the graphic context gc
// Use with care
UINT32*        r2d_get_pixmap(T_R2D_GC_PTR gc);

////////////////////////////////////////
//
// Colors
//

// (Never assume a particular format for the ARGB field
// and use Riviera functions to create/set/get colors)

// Get ARGB foreground color
T_R2D_ARGB_COLOR         r2d_get_foreground_color(T_R2D_GC_PTR gc);

// Set foreground color (seperate components or packed format as
// returned by the Riviera 2D API) 
void           r2d_set_foreground_color_with_argb(T_R2D_GC_PTR gc,UINT16 alpha,UINT16 red,
               UINT16 green,UINT16 blue);
void           r2d_set_foreground_color(T_R2D_GC_PTR gc,T_R2D_ARGB_COLOR color);

// Get ARGB background color
T_R2D_ARGB_COLOR         r2d_get_background_color(T_R2D_GC_PTR gc);

// Set ARGB background color
// ("A" field not supported in that version)
void           r2d_set_background_color_with_argb(T_R2D_GC_PTR gc,UINT16 alpha,UINT16 red,
               UINT16 green,UINT16 blue);
void           r2d_set_background_color(T_R2D_GC_PTR gc,T_R2D_ARGB_COLOR color);

// Set background texture
// (it hides temporarily the background color)
void           r2d_set_background_texture(T_R2D_GC_PTR gc,T_R2D_ANCHORED_TEXTURE_PTR texture);
T_R2D_ANCHORED_TEXTURE_PTR  r2d_get_background_texture(T_R2D_GC_PTR gc);


// Get color components from an ARGB color
#define        r2d_alpha(color) ((UINT16)(((color & 0x0FF000000) >> 24)))
#define        r2d_red(color) ((UINT16)(((color & 0x0FF0000) >> 16)))
#define        r2d_green(color) ((UINT16)(((color & 0x0FF00) >> 8)))
#define        r2d_blue(color) ((UINT16)(((color & 0x00FF))))
#define        r2d_bytetored(color) ((UINT32)(((color & 0x0000F800) >>8)))
#define        r2d_bytetogreen(color) ((UINT32)(((color & 0x000007E0) >> 3)))
#define        r2d_bytetoblue(color) ((UINT32)(((color & 0x0000001F)<<3)))

T_R2D_ARGB_COLOR         r2d_new_argb_color(UINT16 alpha,UINT16 red,UINT16 green,UINT16 blue);

T_R2D_ARGB_COLOR         r2d_get_argb_color_at_point(T_R2D_GC_PTR gc,INT16 x,INT16 y);
T_R2D_ARGB_COLOR         r2d_get_standard_argb_color(T_R2D_COLOR_REF ref);
void                     r2d_hsv_to_rgb( INT16 *r, INT16 *g, INT16 *b, INT32 h, INT32 s, INT32 v );

////////////////////////////////////////
//
// Shape functions
//

void r2d_draw_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc);
void r2d_fill_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc);
void r2d_translate_shape(T_R2D_SHAPE_PTR self,INT16 dx,INT16 dy);
void r2d_release_shape(T_R2D_SHAPE_PTR self);
T_R2D_SHAPE_PTR r2d_clone_shape(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR self);


T_R2D_SHAPE_PTR r2d_new_rectangle(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y,INT16 br_x,INT16 br_y);
T_R2D_SHAPE_PTR r2d_new_circle(T_RVF_MB_ID bank,INT16 x,INT16 y,INT16 r);
T_R2D_SHAPE_PTR r2d_new_ellipse(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y,INT16 br_x,INT16 br_y);
T_R2D_SHAPE_PTR r2d_new_round_rectangle(T_RVF_MB_ID bank,INT16 ul_x,INT16 ul_y,
                                         INT16 br_x,INT16 br_y,INT16 h,INT16 v);

T_R2D_SHAPE_PTR r2d_new_arc(T_RVF_MB_ID bank,INT16 start_angle, INT16 stop_angle,INT16 ul_x,INT16 ul_y,
                                         INT16 br_x,INT16 br_y);

T_R2D_SHAPE_PTR r2d_new_text(T_RVF_MB_ID bank,INT16 x, INT16 y,T_R2D_UTF16 *the_text);

T_R2D_SHAPE_PTR r2d_new_rectangle_intersection(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR a,T_R2D_SHAPE_PTR b);
T_R2D_SHAPE_PTR r2d_new_rectangle_union(T_RVF_MB_ID bank,T_R2D_SHAPE_PTR a,T_R2D_SHAPE_PTR b);

#define r2d_get_xmin(r) ((INT16)(((T_R2D_RECT*)r)->ul_x))
#define r2d_get_ymin(r) ((INT16)(((T_R2D_RECT*)r)->ul_y))
#define r2d_get_xmax(r) ((INT16)(((T_R2D_RECT*)r)->br_x))
#define r2d_get_ymax(r) ((INT16)(((T_R2D_RECT*)r)->br_y))
#define r2d_get_shape_width(r) (((INT16)(((T_R2D_RECT*)r)->br_x)) - ((INT16)(((T_R2D_RECT*)r)->ul_x)))
#define r2d_get_shape_height(r) (((INT16)(((T_R2D_RECT*)r)->br_y)) - ((INT16)(((T_R2D_RECT*)r)->ul_y)))

////////////////////////////////////////
//
// Clipping functions
//

// For clipping with rectangle, we stop
// before xmax (at xmax-1)
// contrary to rectangle drawing where xmax is drawn
void r2d_set_clipping_shape(T_R2D_SHAPE_PTR self,T_R2D_GC_PTR gc);
T_R2D_SHAPE_PTR r2d_get_clipping_shape(T_R2D_GC_PTR gc);
T_R2D_ERROR r2d_restore_standard_clipping_shape(T_R2D_GC_PTR gc);

////////////////////////////////////////
//
// Test functions
//
BOOLEAN r2d_point_in_shape(T_R2D_SHAPE_PTR r,INT16 x,INT16 y);

///////////////////////////////////////
//
// Drawing functions
//

// Draw a point in graphical context gc at position (x, y)
void           r2d_draw_point(T_R2D_GC_PTR gc,INT16 x,INT16 y);
void           r2d_erase_point(T_R2D_GC_PTR gc,INT16 x,INT16 y);

// Move pen to point (x,y)
void           r2d_moveto(T_R2D_GC_PTR gc,INT16 x,INT16 y);
// draw line from pen position to point (x,y)
// (Last point at (x,y) is NOT drawn since x,y is the ending
//  coordinate and not the ending point)
void           r2d_lineto(T_R2D_GC_PTR gc,INT16 x,INT16 y);

// br means bottom right as displayed on screen but
// br has a higher y coordinate than ul
// since y increasing means below

// Rectangle
void           r2d_draw_rectangle(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y);
void           r2d_fill_rectangle(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 br_x, INT16 br_y);

// Circle
void           r2d_draw_circle(T_R2D_GC_PTR gc,
                 INT16 x,INT16 y,INT16 r);
void           r2d_fill_circle(T_R2D_GC_PTR gc,
                 INT16 x,INT16 y,INT16 r);

// Ellipse
void           r2d_draw_ellipse(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y);
void           r2d_fill_ellipse(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y);


// Round Rectangle
void           r2d_draw_round_rectangle(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y,INT16 h,INT16 v);
void           r2d_fill_round_rectangle(T_R2D_GC_PTR gc,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y,INT16 h,INT16 v);

// Ellipse arc

void           r2d_draw_arc(T_R2D_GC_PTR gc,INT16 start_angle,INT16 stop_angle,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x,INT16 bl_y);
void           r2d_fill_arc(T_R2D_GC_PTR gc, INT16 start_angle,INT16 stop_angle,
                  INT16 ul_x,INT16 ul_y,INT16 bl_x, INT16 bl_y);

///////////////////////////////////////
//
// Copy function
//

T_R2D_ERROR           r2d_blit_rect(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc,
                             T_R2D_SHAPE_PTR src_rectangle, 
							 T_R2D_SHAPE_PTR dst_rectangle,
							 BOOLEAN use_foreground_color);

T_R2D_ERROR r2d_fast_blit(T_R2D_GC_PTR src_gc,T_R2D_GC_PTR dst_gc);


///////////////////////////////////////
//
// Text functions
//

#define r2d_get_char_width(p) (((INT32*)p)[1])
#define r2d_get_char_height(p) (((INT32*)p)[2])
#define r2d_get_char_dx(p) (((INT32*)p)[3])
#define r2d_get_char_dy(p) (((INT32*)p)[4])
#define r2d_get_char_org_x(p) (((INT32*)p)[5])
#define r2d_get_char_org_y(p) (((INT32*)p)[6])

// Return nb of word16 (a Glyph may be made of more than one Unicode char
// so from more than one word16. Consequently, it does not represent the number
// or displayed chars)
INT16 r2d_str_nb_word16(T_R2D_UTF16 *l);
T_R2D_UTF16 *r2d_duplicate_text(T_RVF_MB_ID bank,T_R2D_UTF16 *l);

T_R2D_UTF16 *r2d_new_unicode_from_cstring(T_RVF_MB_ID bank,unsigned char *the_string);
T_R2D_UTF16 *r2d_new_unicode_from_pstring(T_RVF_MB_ID bank,unsigned char *the_string);

T_R2D_CHAR_METRIC_PTR r2d_get_char_metrics(T_R2D_GC_PTR gc,T_R2D_UTF16 the_char);

T_R2D_UTF16 r2d_get_next_char(T_R2D_UTF16 *the_text,INT16 *pos,
							  UINT16 max_chars,BOOLEAN *swapping);


T_R2D_ERROR r2d_draw_char(T_R2D_GC_PTR font_cache_gc,
                    T_R2D_GC_PTR gc,
                    T_R2D_GC_PTR fontgc,
                    INT16 x,INT16 y,INT16 org_size,T_R2D_CHAR_METRIC_PTR p);

T_R2D_ERROR   r2d_draw_text(T_R2D_GC_PTR gc,INT16 x,INT16 y,T_R2D_UTF16 *the_text);

// Length is given in word16
T_R2D_ERROR   r2d_draw_chars(T_R2D_GC_PTR gc,INT16 x,INT16 y,T_R2D_UTF16 *the_text,
							 UINT16 nb_words16);

T_R2D_ERROR   r2d_get_text_width(T_R2D_GC_PTR gc,T_R2D_UTF16 *the_text,UINT16 *size);

// Length is given in word16
T_R2D_ERROR   r2d_get_width_of_chars(T_R2D_GC_PTR gc,T_R2D_UTF16 *the_text,UINT16 nb_words16,UINT16 *size);


void          r2d_get_font_info(T_R2D_GC_PTR gc,INT16 *ascent,INT16 *descent,INT16 *leading);


/***********************tangyan  add it**************************************************/

void  r2d_readimage(T_R2D_GC_PTR gc,int px, int py, int sx, int sy, char *pscreenbuffer);
UINT32 dspl_cpy_lcdbuffer(T_R2D_GC_PTR gc, UINT32 lcdy, UINT32 yincreament);
///////////////////////////////////////
//
// Globals
//

#define R2D_EMPTY_RECT NULL
extern T_R2D_GC_PTR r2d_g_lcd_gc;
extern T_R2D_GC_PTR r2d_g_sublcd_gc;
extern INT16 r2d_g_refresh_disabled;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -