📄 gdi.h
字号:
/**************************************************************************
(C)Copyright Cheertek Inc. 2002-2003,
D300, all right reserved.
Product : WinAV Firmware
Date : 2003.01.08.
Author : Cheertek (D300 BrianCheng)
Purpose : Graphic Device Interface Module
The moudle provides BMP OSD graphic functions
Sources : gdi.h/ gdi.c/ gdiex.c
------------------------------------------------------------
Update
Date :
Name : Cheertek (D300 Briancheng)
Description : ???
Item Source
---------------------------------------- -------------------
.
****************************************************************************/
#ifndef __GDI_H__
#define __GDI_H__
//#define NO_GDI
// define this to use 4-bit OSD
#define GDI_4_BIT_OSD
#include "fontindx.def"
#include "colordef.h"
// Brian2.36
#ifdef FONT_TABLE_AT_ODD_ADDRESS // here I mean font number is not fixed to 512
#include "fontnum.h" // will define FONT_NUMBER, must be even, *2==>the acrually number, ie. 256 means 512 char in Font table
#define FONT_TABLE_SIZE_DIV_2 (FONT_NUMBER*64L) // (font_number*2) *256/4/2 ==> HDW or LDW size of the fontable
#endif
// Brian1.08, add for global variable __bColorMode
#define COLOR_MODE_4_BIT 1
#define COLOR_MODE_8_BIT 2
// The macro command index and argument
// these command will need longer ACK time than the other commands
#define COMMAND_GDI 0x001C
#define CMDARG_FILL_RECT 0x0001
#define CMDARG_BMP_COPY 0x0002
#define CMDARG_OUTPUT_TEXT 0x0003
#define CMDARG_FILL_DRAM 0x0004
// Brian0.86, 4-bit OSD, bit 15 of command argument set to 1
#define CMDARG_FILL_RECT_4_BIT 0x8001
#define CMDARG_BMP_COPY_4_BIT 0x8002
#define CMDARG_OUTPUT_TEXT_4_BIT 0x8003
//#define CMDARG_DRAW_FRAME 0x0005
// Two corner area start points
#define CORNER_TOP_RIGHT_X 539
#define CORNER_TOP_RIGHT_Y 0
#define CORNER_BOTTOM_LEFT_X 0
#define CORNER_BOTTOM_LEFT_Y 420
/////////////////////////////////////////////////////////////
// GXA Test
#define GDI_DRAW_STRING_GXA(X, Y)\
{\
__wGDIx=(WORD)(X);\
__wGDIy=(WORD)(Y);\
GDI_DrawString_GXA();\
}
// Alan2.36 adds the following macro for unicode
#ifdef SUPPORT_UNICODE
#define GDI_DRAW_UNICODE_STRING_GXA(X, Y, MaxWidth)\
{\
__wGDIx=(WORD)(X);\
__wGDIy=(WORD)(Y);\
GDI_DrawUnicodeString_GXA(MaxWidth);\
}
#endif
#define GDI_FILL_RECT_GXA(LEFT,TOP,RIGHT,BOTTOM,COLOR)\
{\
__GDIParm.u.RectParm.rect.wLeft=(WORD)(LEFT);\
__GDIParm.u.RectParm.rect.wTop=(WORD)(TOP);\
__GDIParm.u.RectParm.rect.wRight=(WORD)(RIGHT);\
__GDIParm.u.RectParm.rect.wBottom=(WORD)(BOTTOM);\
__GDIParm.u.RectParm.bColor=(BYTE)(COLOR);\
GDI_FillRect_GXA((PPARM_RECT)&__GDIParm);\
}
/////////////////////////////////////////////////////////////
#define SET_RECT(P,LEFT,TOP,RIGHT,BOTTOM)\
{\
P.wLeft=LEFT;\
P.wTop=TOP;\
P.wRight=RIGHT;\
P.wBottom=BOTTOM;\
}
#define GDI_OUTPUT_TEXT(X, Y, PTR)\
{\
__bGDIMacroParam=0;\
__wGDIx=X;\
__wGDIy=Y;\
GDI_OutputText(PTR);\
}
// Brian1.21, only OSDND need this special process
// move it to OSDN module to reduce common bank
/*
// Brian1.00
#define GDI_OUTPUT_TEXT_EX(X, Y, PTR)\
{\
__bGDIMacroParam=1;\
__wGDIx=X;\
__wGDIy=Y;\
GDI_OutputText(PTR);\
}
*/
#define GDI_OUTPUT_NUMBER(X, Y, NUM)\
{\
GDI_NumberToString(NUM);\
__wGDIx=X;\
__wGDIy=Y;\
GDI_DrawString();\
}
// Chuan1.00-2, create to display Hex Number
#define GDI_OUTPUT_NUMBERHEX(X, Y, NUM)\
{\
GDI_NumberToStringHex(NUM);\
__wGDIx=X;\
__wGDIy=Y;\
GDI_DrawString();\
}
#define GDI_DRAW_STRING(X, Y)\
{\
__wGDIx=(WORD)(X);\
__wGDIy=(WORD)(Y);\
GDI_DrawString();\
}
// Alan2.36 adds the following API for unicode
#ifdef SUPPORT_UNICODE
#define GDI_DRAW_UNICODE_STRING(X, Y, MaxWidth)\
{\
__wGDIx=(WORD)(X);\
__wGDIy=(WORD)(Y);\
GDI_DrawUnicodeString(MaxWidth);\
}
#define GDI_DRAW_ASCII_STRING(X, Y, MaxWidth)\
{\
__wGDIx=(WORD)(X);\
__wGDIy=(WORD)(Y);\
GDI_DrawAsciiString(MaxWidth);\
}
#endif
#define GDI_MOVE_REGION(X, Y)\
{\
__wGDIStartX=X;\
__wGDIStartY=Y;\
GDI_MoveRegion();\
}
#define GDI_FILL_RECT(LEFT,TOP,RIGHT,BOTTOM,COLOR)\
{\
__GDIParm.u.RectParm.rect.wLeft=(WORD)(LEFT);\
__GDIParm.u.RectParm.rect.wTop=(WORD)(TOP);\
__GDIParm.u.RectParm.rect.wRight=(WORD)(RIGHT);\
__GDIParm.u.RectParm.rect.wBottom=(WORD)(BOTTOM);\
__GDIParm.u.RectParm.bColor=(BYTE)(COLOR);\
GDI_FillRect((PPARM_RECT)&__GDIParm);\
}
#define GDI_BITMAP_COPY(LEFT,TOP,RIGHT,BOTTOM,X,Y,SRC,DEST)\
{\
__GDIParm.u.BitmapCopy.SrcRect.wLeft=LEFT;\
__GDIParm.u.BitmapCopy.SrcRect.wTop=TOP;\
__GDIParm.u.BitmapCopy.SrcRect.wRight=RIGHT;\
__GDIParm.u.BitmapCopy.SrcRect.wBottom=BOTTOM;\
__GDIParm.u.BitmapCopy.wDestX = X;\
__GDIParm.u.BitmapCopy.wDestY = Y;\
__GDIParm.u.BitmapCopy.bSrcRegion = SRC;\
__GDIParm.u.BitmapCopy.bDestRegion = DEST;\
GDI_BitmapCopy((PPARM_BITMAP_COPY)&__GDIParm);\
}
#define GDI_DRAW_FRAME(LEFT,TOP,RIGHT,BOTTOM,COL_BRIGHT,COL_DARK,COL_CENTER,STYLE,THICKNESS)\
{\
__GDIParm.u.Frame.rect.wLeft=LEFT;\
__GDIParm.u.Frame.rect.wTop=TOP;\
__GDIParm.u.Frame.rect.wRight=RIGHT;\
__GDIParm.u.Frame.rect.wBottom=BOTTOM;\
__GDIParm.u.Frame.bColorBright = COL_BRIGHT;\
__GDIParm.u.Frame.bColorDark = COL_DARK;\
__GDIParm.u.Frame.bColorCenter = COL_CENTER;\
__GDIParm.u.Frame.bStyle = STYLE;\
__GDIParm.u.Frame.bThickness = THICKNESS;\
GDI_DrawFrame((PPARM_FRAME)&__GDIParm);\
}
#define GDI_DRAW_SCROLL_BAR(LEFT,TOP,RIGHT,BOTTOM,START,DISPLAY)\
{\
__GDIParm.u.ScrollBar.rect.wLeft=LEFT;\
__GDIParm.u.ScrollBar.rect.wTop=TOP;\
__GDIParm.u.ScrollBar.rect.wRight=RIGHT;\
__GDIParm.u.ScrollBar.rect.wBottom=BOTTOM;\
__GDIParm.u.ScrollBar.wStartPoint=START;\
__GDIParm.u.ScrollBar.wDisplay=DISPLAY;\
GDI_DrawScrollBar((PPARM_SCROLL_BAR)&__GDIParm);\
}
#define GDI_DRAW_VOLUME_BAR(LEFT,TOP,RIGHT,BOTTOM,BAR_COLOR,BG_COLOR,VOLUME,ORIENTION)\
{\
__GDIParm.u.VolumeBar.rect.wLeft = LEFT;\
__GDIParm.u.VolumeBar.rect.wTop = TOP;\
__GDIParm.u.VolumeBar.rect.wRight = RIGHT;\
__GDIParm.u.VolumeBar.rect.wBottom = BOTTOM;\
__GDIParm.u.VolumeBar.bBarColor = BAR_COLOR;\
__GDIParm.u.VolumeBar.bBgColor = BG_COLOR;\
__GDIParm.u.VolumeBar.wVolume = VOLUME;\
__GDIParm.u.VolumeBar.bOriention = ORIENTION;\
GDI_DrawVolumeBar((PPARM_VOLUME_BAR)&__GDIParm);\
}
#define GDI_DRAW_BUTTON(LEFT,TOP,RIGHT,BOTTOM,ID,STYLE)\
{\
__GDIParm.u.Button.rect.wLeft = (WORD)(LEFT);\
__GDIParm.u.Button.rect.wTop = (WORD)(TOP);\
__GDIParm.u.Button.rect.wRight = (WORD)(RIGHT);\
__GDIParm.u.Button.rect.wBottom = (WORD)(BOTTOM);\
__GDIParm.u.Button.bButtonId = (BYTE)(ID);\
__GDIParm.u.Button.bStyle = (BYTE)(STYLE);\
GDI_DrawButton((PPARM_BUTTON)&__GDIParm);\
}
#define GDI_SET_CURRENT_REGION(ID)\
{\
__bCurrentRegionId = ID;\
}
#define GDI_GET_CHAR_WIDTH(C)\
((C & 0xF000) >> 10)
// define the number of font, palette and region used in this module
#define NUMBER_OF_REGION 4
#define NUMBER_OF_IMAGE 1
#define TEXT_BG_COLOR 0
#define TEXT_FG_COLOR 1
#define TEXT_SHADOW_COLOR_1 2
#define TEXT_SHADOW_COLOR_2 3
#define H2D // define this will diable pixel horizontal duplication
// The maximum length of a text string, not including the first length value
#define GDI_STRING_LENGTH 14 //20
#define ORIENTION_VERTICAL 0
#define ORIENTION_HORIZONTAL 1
// Frame style
// bit 0: 1:push, 0:pop
// bit 1: 1:solid, 0: empty
// bit 2: 1:double, 0: single
#define FRAME_PUSH_SOLID 0x03
#define FRAME_POP_SOLID 0x02
#define FRAME_DOUBLE_SOLID 0x06
#define FRAME_PUSH 0x01
#define FRAME_POP 0x00
#define FRAME_DOUBLE 0x04
// Button style
// bit 0~1: 00:normal, 01:disabled, 10:selected
// bit 2: 1:with text, 0: without text
#define BUTTON_NORMAL 0x00
#define BUTTON_DISABLED 0x01
#define BUTTON_PUSH 0x02
#define BUTTON_HIGHLIGHT 0x03
#define BUTTON_WITH_TEXT 0x04
#define BUTTON_ID_LANGUAGE 0
#define BUTTON_ID_SCREEN 1
#define BUTTON_ID_AUDIO 2
#define BUTTON_ID_CUSTOM 3
#define BUTTON_ID_EXIT 4
#define BUTTON_ID_120x40 5
#define BUTTON_ID_40x40 6
// bit 0~3:define the channel
// bit 4: 0:normal, 1:highlight
#define SPEAKER_ALL 0
#define SPEAKER_L 1
#define SPEAKER_R 2
#define SPEAKER_C 3
#define SPEAKER_LS 4
#define SPEAKER_RS 5
#define SPEAKER_SW 6
#define SPEAKER_CLEAR 7
#define SPEAKER_HIGHLIGHT 0x10
// Brian2.37
#define FONT_TABLE_NORMAL 0
#define FONT_TABLE_JPEG 1
#define GDI_REGION_WIDTH 640L
// Brian2.31-2
#ifdef USE_ONE_OSD_REGION
#define GDI_REGION_HEIGHT 444L
#else
#define GDI_REGION_HEIGHT 460L
#endif
// Brian1.10
#ifdef USE_ONE_OSD_REGION
#define GDI_REGION_2_HEIGHT 180L
#else
#define GDI_REGION_2_HEIGHT 200L
#endif
#define GDI_REGION_3_WIDTH 256
#define GDI_REGION_3_HEIGHT 128L
#define REGION_X_NTSC 368 // Brian1.24, move 16 pixles right //336 //360
#ifdef MINI_OSD_REGION // Brian2.30a
#define REGION_Y_NTSC 38 //30 //24, 28, 30, 32,33,34 44
#else
#define REGION_Y_NTSC 30 //30 //24, 28, 30, 32,33,34 44
#endif
#define REGION_X_PAL 392 // Brian1.24, move 16 pixles right //360
#define REGION_Y_PAL 46
#ifdef USE_ONE_OSD_REGION
#ifdef MINI_OSD_REGION // CT908S, 16M, only 3 line OSD display area
#define ADJUST_FONTABLE_SIZE // define this will set font table size (char number) to GXA
// Brian2.36, FONT_NUMBER is defined in FontNum.h
//
// // Brian2.31-2, Setup use lower case letter, total 176 char
//#define FONT_NUMBER 88 // must be even, *2==>the acrually number, ie. 256 means 512 char in Font table
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -