📄 apiosdgc.h
字号:
////////////////////////////////////////////////////////////////////////////////
//
// @file apiOsdGC.h
// @brief Graphic context defination
// @author MStar Semiconductor Inc.
//
// Features:
// - Define Graphic context defination API
//
// Notes:
//
// Modified: Kevin Hsu
//
////////////////////////////////////////////////////////////////////////////////
#ifndef _OSDGC_H_
#define _OSDGC_H_
//------------------------------------------------------------------------------
// Include Files
//------------------------------------------------------------------------------
#include "DataType.h"
//------------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------
#define REDUCED_BUFFER 2
#define MAX_BUFFER_NUM 2
#define MAX_SYSTEMFONT 9 // use system font
#define INVALID_WIDGET 0xFFFFFFFF
#define CLIP3(min, x, max) (MIN(MAX(min, x), max))
#define DEC_RANGE(a, min, max) ( a = (a==min) ? a : (--a) )
#define INC_RANGE(a, min, max) ( a = (a==max) ? a : (++a) )
#define DIM(a) (sizeof(a)/sizeof(a[0]))
#define INVALID_HANDLE -1
#define MAX_BUFFER 3
#define BUFFER_DISPLAY 0
#define ON_SCREEN 0
#define BUFFER_BACK 1
#define BUFFER_TEMP 2
#define RECT(r, l, t, w, h) \
{ r.top = t; r.left = l; r.width = w; r.height = h; }
#define RECT_SHIFT(r, w, h) \
{ r.left += w; r.top += h; }
#define RECT_SCALE(r, w, h) \
{ r.left += w; r.top += h; r.width -= (w<<1); r.height -= (h<<1); }
#define RECT_REALIZE(r1, r2) \
{r1.left += r2.left; r1.top += r2.top;}
#define RECT_MAP(r1, r2) \
{r1.left -= r2.left; r1.top -= r2.top;}
#define ARGB(a, r, g, b) ((a&0xff)<<24 | (r&0xff) << 16 | (g&0xff) <<8 | (b&0xff))
#define RGB565(r, g, b) ((((b>>3)&0x1f)<<11) | (((g>>2)&0x3f) <<5) | (((r>>3)&0x1f)<<3))
#define ARGB_A(c) ((c>>24)&0xff)
#define ARGB_R(c) ((c>>16)&0xff)
#define ARGB_G(c) ((c>>8)&0xff)
#define ARGB_B(c) (c&0xff)
#define ARGB_OP(c, idx, val) { c &= ~(0xff<<(idx*8)); c |= (val<<(idx*8)); }
#define SET_GC_SYSCOLOR(gc, index, color) MApi_Osd_SetSystemColor(gc, index, color);
#define SYSCOLOR(gc, index) ((gc)->colorSys[index])
#define GC_FMT(gc) (gc->fmt)
#define NEWUI_GWIN_BLENDING 58// 1//87.5%
//------------------------------------------------------------------------------
// Type and Structure Declaration
//------------------------------------------------------------------------------
typedef struct _Rect
{
S16 left;
S16 top;
S16 width;
S16 height;
}Rect;
typedef enum _GC_ColorFmt
{
FMT_I8 = 0x4,
FMT_RGB565 = 0x8,
FMT_RGB555 = 0x9,
FMT_ARGB4444 = 0xa,
FMT_ARGB8888 = 0xf,
}GC_ColorFmt;
typedef struct _MemHandle
{
//GE_BUFFER_INFO *pGEInfo;
void *pMem;
}MemHandle;
typedef struct _ScrConfig
{
GC_ColorFmt fmt;
U8 bpp;
S32 s32Width;
S32 s32Height;
}ScrConfig;
typedef enum _RectAttrib
{
eRectBorder ,
eRectBorderRound ,
}RectAttrib;
typedef enum _TextAttrib
{
eTextAlignLeft = 0x1,
eTextAlignMiddle = 0x2,
eTextAlignRight = 0x4,
eTextAlignMiddleWH = 0x8,
eTextAlignLeft_MiddleH = 0x10,
eTextAlignRight_MiddleH = 0x20,
}TextAttrib;
typedef enum _SystemFont
{
FONT_NORMAL = 0, //GE I2 NORMAL Font
FONT_NORMAL_SMALL, //GE I2 NORMAL SMALL Font
FONT_NORMAL_LARGE, //GE I2 NORMAL LARGE Font
FONT_BASIC, //GE I1 BASIC Font
FONT_BASIC_SMALL, //GE I1 BASIC SMALL Font
FONT_BASIC_LARGE, //GE I1 BASIC LARGE Font
FONT_ADVANCE, //GE I4 ADVANCE Font
FONT_ADVANCE_SMALL, //GE I4 ADVANCE SMALL Font
FONT_ADVANCE_LARGE, //GE I4 ADVANCE LARGE Font
}SystemFont;
typedef enum _SystemColor
{
COLOR_SHADOW = 0,
MAX_SYSTEMCOLOR = 1,
}SystemColor;
typedef enum _FontAttrib
{
AlignLeft = 0,
AlignMiddle,
AlignRight
}FontAttrib;
typedef struct _OsdFont
{
U32 u32FontType;
FontAttrib eFontAttrib;
}OsdFont;
/*
---------------------
| |
| |
| |
| |
| |
| |
| |
| |
----------------------
*/
typedef struct _OsdGC
{
U8 gopnum;
U8 gwin;
bool bIsOnscreen;
U8 u8FBID; // frame buffer ID
//MemHandle pMemHandle;
GC_ColorFmt fmt;
S16 s16Width;
S16 s16Height;
U32 colorBackground;
//FONTHANDLE hFont[MAX_SYSTEMFONT];
//U32 u32FontType[MAX_SYSTEMFONT];
U32 colorSys[MAX_SYSTEMCOLOR];
}OsdGC;
//-------------------------------------------------------------------------------------------------
// Extern Global Variabls
//-------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Macros
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// Extern Functions
//------------------------------------------------------------------------------
bool MApi_Osd_CreateGC(OsdGC *pGC, U32 primAddr);
bool MApi_Osd_Create_GC(OsdGC *pGC);
void MApi_Osd_ReleaseGC(OsdGC *pGC);
void MApi_Osd_Release_GC(OsdGC *pGC);
void MApi_Osd_GCClear(OsdGC *pGC, Rect *r);
void MApi_Osd_GCFillRect(OsdGC *thiz, Rect *r, U32 color);
void MApi_Osd_GCDrawRectangle(OsdGC *thiz, Rect *r, U32 color, U8 thickness);
GC_ColorFmt MApi_Osd_GCGetColorFmt(OsdGC *gc);
FONTHANDLE MApi_Osd_GCGetSystemFont(OsdGC *gc, SystemFont index);
bool MApi_Osd_GCGetSysFont(OsdGC *gc, SystemFont index, FONTHANDLE *pFontHandle, U32 *pFontType);
void MApi_Osd_GCSetSystemFont(OsdGC *gc, SystemFont index, FONTHANDLE handle);
bool MApi_Osd_GCSetSysFont(OsdGC *gc, SystemFont index, U32 u32FontType);
U32 MApi_Osd_GetSystemColor(OsdGC *pGC, SystemColor color);
bool MApi_Osd_GetSystemGWin(OsdGC *pGC, U8 *u8GwinNum);
bool MApi_Osd_GetSystemGOP(OsdGC *pGC, U8 *u8GOPNum);
U32 MApi_Osd_GetSystemColorKey(OsdGC *pGC);
void MApi_Osd_SetSystemColor(OsdGC *pGC, U8 index, U32 color);
bool MApi_Osd_CreateGwin_By_GC(OsdGC *pGC, U32 GOPnum, U32 GWinNum, U32 u32DstXpos, U32 u32DstYpos);
bool MApi_Osd_GWin_Show (OsdGC *pGC);
bool MApi_Osd_GWin_Hide(OsdGC * pGC);
//------------------------------------------------------------------------------
// Local Functions
//------------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -