aw_engine.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 454 行 · 第 1/2 页

H
454
字号
 * @brief All display drawing action should be done in the off secrren buffer until you 
 * call AWActiveOffScreen to display off screen buffer.
 * Off screen is a back up display buffer, you can draw any data to it, but not display to 
 * scren until call AWActiveOffScreen.
 */
void AWSetOffScreen(void);

/**
 * Copy off screen buffer data to video memory to display it. 
 */
void AWActiveOffScreen(void);

/**
 * Set whether or not the background is used when we drawing text. 
 */
void AWSetDrawBackground(INT8U flag);

/**
 * Turn off screen.
 */
void AWTurnOffScreen(void);

/**
 * Turn on screen.
 */
void AWTurnOnScreen(void);

/**
 * Draw a font type bmp data at screen (x,y).
 * @param [in] x define the drawing start point's X coordinate.
 * @param [in] y define the drawing start point's Y coordinate.
 * @param [in] ch_width define the width pixel of bmp data, that's means AWFontBitmap will 
 * change to next line if it have drawn ch_width pixel in one line.
 * @param [in] font_height define the height of bmp data, so the length of bmp data is 
 * caculate like [(ch_width * font_height)/8 + 1] byte.
 * @param [in] bg_flag if true, draw the pixel with back ground color when the bmp data 
 * bit is 0. Otherwise draw nothing if the bmp data bit is 0. 
 * @param [in] imagebits It's the data point of bmp, the length should be 
 * [(ch_width * font_height)/8 + 1] . the bmp data is a binary data, every bit represent 
 * one pixel, if the bit is 1, use fore ground color draw one pixel, otherwise draw the 
 * pixel with background color if bg_flag is true, or don't draw the pixel if bg_flag is false.
 * @param [in] zoomx for font zoom width multiple
 * @param [in] zoomy for font zoom height multiple
 */
void AWFontBitmap(COORD x, COORD y, COORD ch_width, COORD font_height,
                  INT8U bg_flag, INT8U *imagebits,INT8U zoomx, INT8U zoomy);

/**
 * Clear the image in the given rectangle.
 */                  
void AWClearRect(COORD x, COORD y, COORD width, COORD height) ;

void AWClearScreen() ;
/*
Define the OSD datat source:
 if DCUselect == 2, Frame buffer OSD will be used
 otherwise normal OSD will be used
 Default: if AWSetOSDDataSouce's not called, normal OSD will be used.
*/
void AWSetOSDDataSouce(INT32U DCUselect) ;

/**
 * Set dynamic palette related settings
 */
void AWSetDynamicPalette(osd_dynamic_palette_t *setting);

/**
 * Enable dynamic palette
 */
void AWEnableDynamicPalette(void);

/**
 * Disable dynamic palette
 */
void AWDisableDynamicPalette(void);

/**
 * Set OSD color table
 */
void AWSetOSD240Color(const INT16U* table,INT8U level);

/**
 *Following section is about font function set.
 */
 
/** Text/GetTextSize encoding flags*/
#define AWTF_ASCII			0x0000	/* 8 bit packing, ascii*/
#define AWTF_UTF8			0x0001	/* 8 bit packing, utf8*/
#define AWTF_UC16			0x0002	/* 16 bit packing, unicode 16*/
#define AWTF_UC32			0x0004	/* 32 bit packing, unicode 32*/
#define AWTF_XCHAR2B		0x0008	/* 16 bit packing, X11 big endian PCF*/
#define AWTF_PACKMASK		0x000F	/* packing bits mask*/

/** asian double-byte encodings*/
#define AWTF_DBCS_BIG5		0x0100	/* chinese big5*/
#define AWTF_DBCS_EUCCN		0x0200	/* chinese EUCCN (gb2312+0x80)*/
#define AWTF_DBCS_EUCKR		0x0300	/* korean EUCKR (ksc5601+0x80)*/
#define AWTF_DBCS_EUCJP		0x0400	/* japanese EUCJP*/
#define AWTF_DBCS_JIS		0x0500	/* japanese JISX0213*/
#define AWTF_DBCSMASK		0x0F00	/* DBCS encodings bitmask*/

typedef INT16U 	AWTEXTFLAGS ;

/** 
 * @brief Define the struct of font lib data.
 * As you see, we only define the font interface spec, we don't care how to implement a 
 * font, if the font lib supports this interface, we can use this font lib in our system, 
 * so we can support more fonts easily and needn't change anything.
 */
typedef struct {
	///font name
	const char *font_name;
	///font size 
	INT16U		font_size;
	///the characters max width in pixel of this font lib
	INT16U		max_width;
	///define the character height in pixel
	INT16U		font_height;
	///ascent (baseline) height
	INT16U		font_ascent;
	///this font lib's character encode type.
	AWTEXTFLAGS	encode_type ;		
	///gaps between characters of this font
	INT8U		font_gaps ;
	///total character number in this font lib
	INT16U		characternum; 
	///Call back function of font lib, we will get the font data by call this function.
	INT8U *		(*GetFontBitmap)(INT16U ch, INT16U *font_width) ; 
} AWFONT, *PAWFONT;

/**
 * @brief Register a new font lib to system.
 * After register the font lib, we can use it to draw the characters on screen, you can call
 * AWSetFont to set current use font lib.
 */
INT32S AWRegisterFont(PAWFONT new_font) ;

/**
 * @brief Unregister the font lib from system.
 */
INT32S AWUnregisterFont(PAWFONT del_font) ;

/**
 * Set current use font lib.
 * @param [in] font_name the font lib name you want to use.
 */
void AWSetFont(char *font_name);

/* set font zoomx and zoomy 
 * @param [in] zoomx for zoom width multiple ,now support (1-15)
 * @param [in] zoomy for zoom height multiple ,now support (1-15)
*/
void AWSetFontZoom(INT8U zoomx, INT8U zoomy) ;

/**
 * According input string and current used font lib to caculate width and height these character
 * will taken.
 * @param [in] str the string which will be caculate its length.
 * @param [in] cn the string length.
 * @param [in|out] pwidth if pwidth != 0, that's means the max pixel number of this string length. 
 * Return the pixel number of whold string.
 * @param [out] pheight return the charcter height of current font lib.
 * @param [out] word_length return proper string length which ended with legal word.
 * @param [out] flags define the input string format.
 * @return return string length which will not exceed the pixel length defined by pwidth.
 */
INT32S AWGetTextSize(const void *str, INT8U cn, INT32S *pwidth,INT32S *pheight,INT32S *word_length, AWTEXTFLAGS flags);

/**
 * Return the font name list system supported now(Registered font libs).
 * @param [out] fonts_name the name list of font lib.
 * @param [out] numfonts the length of list.
 */
void AWGetFontList(const char **fonts_name, INT8U *numfonts) ;

/**
 * Draw the text to screen.
 * @param [in] str The text string which will be drawed.
 * @param [in] cc String length.
 * @param [in] x Start draw position in X coordinate.
 * @param [in] y Start draw position in Y coordinate.
 * @param [out] pwidth the pixel length of this string.
 * @param [out] pheight the pixel height of this string.
 * @param [in] bg_flag Define if draw the back ground bit of character.
 * @param [in] flags define the input string format.
 */
void AWText(const void *str, INT8U cc, COORD x, COORD y, INT32S *pwidth,INT32S *pheight,
            INT8U bg_flag, AWTEXTFLAGS flags) ;

/**
 * get the char width.
 * @param [in] ch ,which char you checked.
 * @param [out] char width
 */
 INT16U  GetCharWidth(char ch);
 
/**
 * Sample function of draw text.
 * @param [in] x Start draw position in X coordinate.
 * @param [in] y Start draw position in Y coordinate.
 * @param [in] print_strings The text string which will be drawed.
 */            
void AWAsciiPrintf(COORD x, COORD y, const CHARSTR * print_strings) ;

#define MAX_AREA_NUM_OF_WINDOW		4
typedef struct {
	INT8U	display_area_num;
	RECT	display_areas[MAX_AREA_NUM_OF_WINDOW] ;
	INT32U  display_area_pf_types[MAX_AREA_NUM_OF_WINDOW] ;
	void (*SetPalette)(void);
}CREATEWINDOWPARAM ;

typedef struct {
INT16U		character ; // character value
INT16U		width ;		// this character's font width
INT32U 		offset ;  // character's font bits map
} AWFONTINDEX ;


extern INT8U gInvalidCacheFlag ;
#define SET_INVALID_CACHE_ENABLE    {gInvalidCacheFlag =1 ;}
#define FIRE_INVALID_CACHE  { if(gInvalidCacheFlag) \
                              { ARC_invalidate_dcache(); \
                                gInvalidCacheFlag = 0 ;}}

#endif  //end of _AW_ENGINE_H

⌨️ 快捷键说明

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