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

📄 r2d.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
//zhangzg 07/16/2002 R2D_INVERT is added in K_R2D_DRAWING_MODE enum type

/**
                                                                          
	@file:	r2d.h	
	
	@author Christophe Favergeon                              
                                                                          
    @version	0.5	

    Purpose:	Riviera 2D : Public API       
	
*/

/*
																			
 	Date       	Modification												
  ------------------------------------									
    06/02/2001	Create		
	10/18/2001  Version 0.5 for first integration with Riviera database
																											    
																			
 (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
*/


#ifndef __R2D_H_
#define __R2D_H_

#include "general.h"
#include "rvf_api.h"
#include "r2d_config.h"


/***************************************

    IMPORTANT NOTES

***************************************/

// For speed reasons the system is minimizing
// number of checks.

// So, the user must ensure that some
// conditions are respected before she/he
// calls the drawing subroutines :

// For rectangle, ellipse etc... one must
// has : br_x > ul_x and br_y > ul_y

// Rectangles and ellipse where one of
// the dimensions is 0 are not allowed

// For circle, the radius must be strictly
// positive



/***************************************

    TYPES / CONSTANTS

***************************************/

////////////////////////////////////////
//
// GENERAL
//

typedef enum K_R2D_ERROR
{
	R2D_OK=0,
	R2D_MEMORY_ERR=-4,
	R2D_UNKNOWN_OP=-5,
	R2D_LOCK_ERROR=-6,
	R2D_UNLOCK_ERROR=-7
} T_R2D_ERROR;

////////////////////////////////////////
//
// Memory
//
typedef void *T_R2D_REFCOUNT_PTR;

// Should NEVER be allocated on stack
typedef struct R2D_REFCOUNTING
{
  // Refcounting
     INT16 refcount;
} T_R2D_REFCOUNT;


////////////////////////////////////////
//
// Framebuffer
//
typedef enum {R2D_LCD_KIND=1, R2D_FULL_KIND} T_R2D_FRAMEBUFFER_KIND;

typedef void *T_R2D_FRAMEBUFFER_PTR;


////////////////////////////////////////
//
// Graphic context
//
typedef void *T_R2D_GC_PTR;

typedef enum K_R2D_DRAWING_MODE {
R2D_COPY_MODE=0,
R2D_OR_MODE,
R2D_AND_MODE,
R2D_XOR_MODE,
R2D_NOT_COPY_MODE,
R2D_NOT_OR_MODE,
R2D_NOT_AND_MODE,
R2D_NOT_XOR_MODE,
R2D_INVERT,    //r2d_invert must be 8!!  zhangzg 07/16/2002
R2D_ALPHA_MODE
} T_R2D_DRAWING_MODE ;

typedef enum K_R2D_COLOR_REF
{
R2D_RED=1,
R2D_BLUE,
R2D_GREEN,
R2D_WHITE,
R2D_BLACK,
R2D_GRAY50
} T_R2D_COLOR_REF;

typedef enum K_R2D_TEXT_FACE
{
R2D_SYSTEM=1,
R2D_TYPEWRITER,
R2D_PROPORTIONAL
} T_R2D_TEXT_FACE;

typedef enum K_R2D_TEXT_STYLE
{
R2D_PLAIN=1,
R2D_BOLD=2,
R2D_ITALIC=4,
R2D_UNDERLINED=8
} T_R2D_TEXT_STYLE;

typedef enum K_R2D_TEXT_SIZE
{
R2D_SMALL=1,
R2D_MEDIUM,
R2D_LARGE
} T_R2D_TEXT_SIZE ;



////////////////////////////////////////
//
// Shapes
//
typedef void *T_R2D_SHAPE_PTR;

typedef struct R2D_R
{
  INT16 refcount;
  void *p_r2d_class;
  INT16 ul_x,ul_y,br_x,br_y;
} T_R2D_RECT;

////////////////////////////////////////
//
// Text
//
typedef UINT16 T_R2D_UTF16;
typedef UINT32* T_R2D_CHAR_METRIC_PTR;

////////////////////////////////////////
//
// Color
//
typedef UINT32 T_R2D_ARGB_COLOR;

////////////////////////////////////////
//
// Textures
//
typedef void *T_R2D_FREE_TEXTURE_PTR;
typedef void *T_R2D_ANCHORED_TEXTURE_PTR;


/***************************************

    Functions

***************************************/

////////////////////////////////////////
//
// Memory
//

// Increment refcount of an object
#define r2d_retain(p) {\
    if (p) \
    { \
	   if (((T_R2D_REFCOUNT*)(p))->refcount>0) \
         ((T_R2D_REFCOUNT*)(p))->refcount++; \
    \
    } \
   }

////////////////////////////////////////
//
// Texture
//

// The pattern is an array of ARGB colors saved column per column
T_R2D_FREE_TEXTURE_PTR r2d_new_free_texture(T_RVF_MB_ID bank,INT16 size,T_R2D_ARGB_COLOR *pattern);
T_R2D_FREE_TEXTURE_PTR r2d_new_const_free_texture(T_RVF_MB_ID bank,INT16 size,T_R2D_ARGB_COLOR *pattern);

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);

void              r2d_release_free_texture(T_R2D_FREE_TEXTURE_PTR texture);
void			  r2d_release_anchored_texture(T_R2D_ANCHORED_TEXTURE_PTR texture);

////////////////////////////////////////
//
// Framebuffer
//


T_R2D_FRAMEBUFFER_PTR r2d_new_framebuffer(T_RVF_MB_ID bank,T_R2D_FRAMEBUFFER_KIND the_kind,UINT16 width, UINT16 height);
void                  r2d_release_framebuffer(T_R2D_FRAMEBUFFER_PTR the_framebuffer);

////////////////////////////////////////
//
// Graphic context
//

// Return a new graphical contect connected to the LCD framebuffer
// (The LCD framebuffer is private)
T_R2D_GC_PTR   r2d_new_lcd_context(T_RVF_MB_ID bank);

// Return a new graphical context connected to a framebuffer
T_R2D_GC_PTR   r2d_new_context(T_RVF_MB_ID bank,T_R2D_FRAMEBUFFER_PTR the_frame_buffer);

// Return a graphical context for a picture saved in R2D format
T_R2D_GC_PTR r2d_new_picture_context(T_RVF_MB_ID bank,const UINT32 *the_picture,T_R2D_FRAMEBUFFER_KIND kind);


// Release a graphical context. 
// For LCD, the framebuffer is released but never deleted
// since it is also owned by the R2D software entity
void           r2d_release_context(T_R2D_GC_PTR gc);

// Clear the content of the framebuffer referenced by 
// the graphic context (in white);
void           r2d_erase(T_R2D_GC_PTR gc);
void           r2d_erase_with_background(T_R2D_GC_PTR gc,
										 INT16 a,INT16 b,
										 INT16 c,INT16 d);

// Get size and width of the drawing area of the framebuffer referenced
// by the graphic context. The framebuffer (as a memory area) is generally
// a bit larger than the drawing area (defined by width*height) because
// of memory alignment constraints
UINT16          r2d_get_width(T_R2D_GC_PTR gc);
UINT16          r2d_get_height(T_R2D_GC_PTR gc);

void            r2d_get_pen_pos(T_R2D_GC_PTR gc,INT16 *x,INT16 *y);

//
// Drawing mode settings
T_R2D_DRAWING_MODE r2d_get_drawing_mode(T_R2D_GC_PTR gc);

⌨️ 快捷键说明

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