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

📄 gdi.h

📁 车载电子影音系统dvd播放系统原程序代码
💻 H
📖 第 1 页 / 共 2 页
字号:

// *******************************
// This is would be 16M DRAM case
// *******************************

// Brian2.30b
// The palette address in DRAM
#define PAL_ADDR            0x4200 //Brian2.35a //0x3E00// 0x38000L //0x5E00 //0xA000L //0x3FE00 //0x3CE00    // palette 0 address, will use 256 DW 

#define GDI_REGION_0_HEIGHT      98L

// The region address in DRAM
#define REGION_BUFFER_0_SIZE      ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_0_HEIGHT / 4)/2) // 4 bit mode DWORD, top+bottom
#define REGION_BUFFER_1_SIZE      ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_HEIGHT / 4)) //DWORD, top+bottom
#define REGION_BUFFER_2_SIZE  0 // don't care
#define REGION_BUFFER_3_SIZE  0 // don't care

#ifdef FONT_TABLE_AT_ODD_ADDRESS

// put in odd address // max 8.75K DW: 0x70801 ~ 0x74E01
#define OSD_DRAM_FONT_TABLE_START_0         0x6F001L // 0x70801L //0x6000L //0x1D200L //((DWORD)PAL_ADDR+256L +256)  //0x40000 //0x40800  // Font table address needs 512-DW alignment
#define OSD_DRAM_FONT_TABLE_START_1         ((DWORD)OSD_DRAM_FONT_TABLE_START_0 + FONT_TABLE_SIZE_DIV_2*2)  //0x44000 //0x44800  // Font table address needs 512-DW alignment

// Brian2.37, for change font table address to give large Frame buffer for JPEG mode
#define OSD_DRAM_FONT_TABLE_START_0_JPEG         0x19900L  
#define OSD_DRAM_FONT_TABLE_START_1_JPEG         ((DWORD)OSD_DRAM_FONT_TABLE_START_0_JPEG + FONT_TABLE_SIZE_DIV_2)  

#else

#define OSD_DRAM_FONT_TABLE_START_0         0x6000L //0x1D200L //((DWORD)PAL_ADDR+256L +256)  //0x40000 //0x40800  // Font table address needs 512-DW alignment
#define OSD_DRAM_FONT_TABLE_START_1         ((DWORD)OSD_DRAM_FONT_TABLE_START_0 + FONT_TABLE_SIZE_DIV_2)  //0x44000 //0x44800  // Font table address needs 512-DW alignment

#endif

// the header would use 1 line DRAM space, that is GDI_REGION_WIDTH/8 ==> 80 DWORD in 4-bit mode
#define REGION_T_ADDR0       0x4400 //Brian2.35a //0x4000L //0x35A00L //0x8300L //((DWORD)OSD_DRAM_FONT_TABLE_START_1+0x4000L) //(PAL_ADDR+256) //0x46D00 // region 0 top field address, using frame 1~
#define REGION_T_ADDR1       REGION_T_ADDR0                               // region 1 top field address
#define REGION_T_ADDR2       REGION_T_ADDR1 // region 2 top field address
#define REGION_T_ADDR3       REGION_T_ADDR2 // region 3 top field address

#define REGION_B_ADDR0       ((DWORD)REGION_T_ADDR0 +  (REGION_BUFFER_0_SIZE/2) + (GDI_REGION_WIDTH>>3)) // region 0 bottom field address
#define REGION_B_ADDR1       ((DWORD)REGION_T_ADDR0 +  (REGION_BUFFER_1_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 1 bottom field address
#define REGION_B_ADDR2       REGION_T_ADDR1 // region 2 bottom field address
#define REGION_B_ADDR3       REGION_B_ADDR2 // region 3 bottom field address

// Brian1.22
#define OSD_BUFFER_END  ((DWORD)REGION_B_ADDR2 +  (REGION_BUFFER_2_SIZE/2) + (GDI_REGION_WIDTH>>2))

// Brian0.91
// Space for Screen Saver

// reserve 256 DW to backup the palette
#define GDI_PAL_BACKUP_ADDR      (PAL_ADDR+256) // use the gap between PAL_ADDR and font table

// multiple SCR buffer0 and buffer1
// we have 1K DW space for screen saver
// Brian1.22, still has space in OSD buffer after region 2
#define BITMAP_BUFFER0_T    OSD_BUFFER_END // 0x2DF00L
#define BITMAP_BUFFER0_B    ((DWORD)BITMAP_BUFFER0_T + 512)
#define BITMAP_BUFFER1_T    ((DWORD)BITMAP_BUFFER0_T + 256) // skip a little space after the real end of region 0 bottom for safe
#define BITMAP_BUFFER1_B    ((DWORD)BITMAP_BUFFER0_B + 256)

#else // #ifdef MINI_OSD_REGION

// *******************************
// This is would be 32M DRAM case
// *******************************

// The palette address in DRAM
#define PAL_ADDR            0xA000L //0x3FE00 //0x3CE00       // palette 0 address, will use 256 DW

// The region address in DRAM
#define REGION_BUFFER_SIZE      ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_HEIGHT / 4)) //DWORD, top+bottom
#define REGION_BUFFER_2_SIZE  ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_2_HEIGHT / 4)) //DWORD, top+bottom, now the size of region is 640*200
#define REGION_BUFFER_3_SIZE  ((DWORD)(GDI_REGION_3_WIDTH * GDI_REGION_3_HEIGHT / 4)) //DWORD, top+bottom, now the size of region is 640*200

#define OSD_DRAM_FONT_TABLE_START_0         ((DWORD)PAL_ADDR+256L +256)  //0x40000 //0x40800  // Font table address needs 512-DW alignment
#define OSD_DRAM_FONT_TABLE_START_1         ((DWORD)OSD_DRAM_FONT_TABLE_START_0 + 0x4000L)  //0x44000 //0x44800  // Font table address needs 512-DW alignment

// the header would use 1 line DRAM space, that is GDI_REGION_WIDTH/4 ==> 160 DWORD in 8-bit mode
#define REGION_T_ADDR0       ((DWORD)OSD_DRAM_FONT_TABLE_START_1+0x4000L) //(PAL_ADDR+256) //0x46D00 // region 0 top field address, using frame 1~
#define REGION_T_ADDR1       REGION_T_ADDR0                               // region 1 top field address
#define REGION_T_ADDR2       ((DWORD)REGION_T_ADDR1 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 2 top field address
#define REGION_T_ADDR3       REGION_T_ADDR2 // region 3 top field address

#define REGION_B_ADDR0       ((DWORD)REGION_T_ADDR2 +  (REGION_BUFFER_2_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 0 bottom field address
#define REGION_B_ADDR1       REGION_B_ADDR0                               // region 1 bottom field address
#define REGION_B_ADDR2       ((DWORD)REGION_B_ADDR1 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 2 bottom field address
#define REGION_B_ADDR3       REGION_B_ADDR2 // region 3 bottom field address

// Brian1.22
#define OSD_BUFFER_END  ((DWORD)REGION_B_ADDR2 +  (REGION_BUFFER_2_SIZE/2) + (GDI_REGION_WIDTH>>2))

// Brian0.91
// Space for Screen Saver

// reserve 256 DW to backup the palette
#define GDI_PAL_BACKUP_ADDR      (PAL_ADDR+256) // use the gap between PAL_ADDR and font table

// multiple SCR buffer0 and buffer1
// we have 1K DW space for screen saver
// Brian1.22, still has space in OSD buffer after region 2
#define BITMAP_BUFFER0_T    OSD_BUFFER_END // 0x2DF00L
#define BITMAP_BUFFER0_B    ((DWORD)BITMAP_BUFFER0_T + 512)
#define BITMAP_BUFFER1_T    ((DWORD)BITMAP_BUFFER0_T + 256) // skip a little space after the real end of region 0 bottom for safe
#define BITMAP_BUFFER1_B    ((DWORD)BITMAP_BUFFER0_B + 256)

#endif // #ifdef MINI_OSD_REGION

#else // #ifdef USE_ONE_OSD_REGION

// *******************************
// This is would be 64M DRAM case
// *******************************

// The palette address in DRAM
#define PAL_ADDR            0xA000L //0x3FE00 //0x3CE00       // palette 0 address, will use 256 DW

// The region address in DRAM

#define REGION_BUFFER_SIZE      ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_HEIGHT / 4)) //DWORD, top+bottom
#define REGION_BUFFER_2_SIZE  ((DWORD)(GDI_REGION_WIDTH * GDI_REGION_2_HEIGHT / 4)) //DWORD, top+bottom, now the size of region is 640*200
#define REGION_BUFFER_3_SIZE  ((DWORD)(GDI_REGION_3_WIDTH * GDI_REGION_3_HEIGHT / 4)) //DWORD, top+bottom, now the size of region is 640*200

#define OSD_DRAM_FONT_TABLE_START_0         ((DWORD)PAL_ADDR+256L +256)  //0x40000 //0x40800  // Font table address needs 512-DW alignment
#define OSD_DRAM_FONT_TABLE_START_1         ((DWORD)OSD_DRAM_FONT_TABLE_START_0 + 0x4000L)  //0x44000 //0x44800  // Font table address needs 512-DW alignment

// the header would use 1 line DRAM space, that is GDI_REGION_WIDTH/4 ==> 160 DWORD in 8-bit mode
#define REGION_T_ADDR0       ((DWORD)OSD_DRAM_FONT_TABLE_START_1+0x4000L) //(PAL_ADDR+256) //0x46D00 // region 0 top field address, using frame 1~
#define REGION_T_ADDR1       ((DWORD)REGION_T_ADDR0 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 1 top field address
#define REGION_T_ADDR2       ((DWORD)REGION_T_ADDR1 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 2 top field address
#define REGION_T_ADDR3       REGION_T_ADDR2 // region 3 top field address

#define REGION_B_ADDR0       ((DWORD)REGION_T_ADDR2 +  (REGION_BUFFER_2_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 0 bottom field address
#define REGION_B_ADDR1       ((DWORD)REGION_B_ADDR0 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 1 bottom field address
#define REGION_B_ADDR2       ((DWORD)REGION_B_ADDR1 +  (REGION_BUFFER_SIZE/2) + (GDI_REGION_WIDTH>>2)) // region 2 bottom field address
#define REGION_B_ADDR3       REGION_B_ADDR2 // region 3 bottom field address

// Brian0.91
// Space for Screen Saver
// The original region 0 is design as 640x460 8-bit mode, now we use region 0 as 4-bit mode 
// but the space is still preserved as 8-bit mode to maintain the X, Y calculation for GXA command.
// We can use these un-used DRAM space for screen scaver, total about 138K bytes (bottom + top) could use

// reserve 256 DW to backup the palette
#define GDI_PAL_BACKUP_ADDR      ((DWORD)REGION_T_ADDR0 + (GDI_REGION_WIDTH) + (REGION_BUFFER_SIZE/4)) // skip a little space after the real end of region 0 top for safe

// multiple SCR buffer0 and buffer1
#define BITMAP_BUFFER0_T    (GDI_PAL_BACKUP_ADDR+256)
#define BITMAP_BUFFER0_B    ((DWORD)BITMAP_BUFFER0_T + ((REGION_T_ADDR1 - BITMAP_BUFFER0_T)/2))
#define BITMAP_BUFFER1_T    ((DWORD)REGION_B_ADDR0 + (GDI_REGION_WIDTH) + (REGION_BUFFER_SIZE/4)) // skip a little space after the real end of region 0 bottom for safe
#define BITMAP_BUFFER1_B    ((DWORD)BITMAP_BUFFER1_T + ((REGION_B_ADDR1 - BITMAP_BUFFER1_T)/2))


#endif // #ifdef USE_ONE_OSD_REGION

// CDDA & MP3 SCR, now will use the DRAM space
#define BITMAP_BUFFER0_CDDA_T    BITMAP_BUFFER0_T
#define BITMAP_BUFFER0_CDDA_B    BITMAP_BUFFER0_B
#define BITMAP_BUFFER1_CDDA_T    BITMAP_BUFFER1_T
#define BITMAP_BUFFER1_CDDA_B    BITMAP_BUFFER1_B


// Define the DRAM variable address of the plane

// CT908, T/B may be switched ??
#define PLANE_T_ADDR        W99AV_DRAM_OSDB_ADR
#define PLANE_B_ADDR        W99AV_DRAM_OSDT_ADR
#define PLANE_T_SIZE        W99AV_DRAM_OSDB_SIZE
#define PLANE_B_SIZE        W99AV_DRAM_OSDT_SIZE

#define PLANE_PAL_ADDR      W99AV_DRAM_FONTPAL_TBL_ADR

typedef struct tagGDI_REGION_INFO	
{
	DWORD	wWidth;		    // region width
	DWORD	wHeight;		// region height
	BYTE	bColorMode;	    // color mode, 0: 4 color, 1: 16 color, 2: 256 color
	DWORD	dwTAddr;		// top field buffer (including header) address 
	DWORD	dwBAddr;		// bottom field buffer (including header) address
} GDI_REGION_INFO, * PGDI_REGION_INFO;

typedef struct tagGDI_PALETTE_INFO	
{
    
	BYTE	bStartNumber;	// the palette will be put starting at DWORD entry
	DWORD	dwPalAddr;	    // palette address in DRAM
	DWORD	*pdwPalette;	// point to a palette data array
} GDI_PALETTE_INFO, * PGDI_PALETTE_INFO;

typedef struct tagGDI_PLANE_INFO	
{
	DWORD	dwTAddr_var;	// the top field address DRAM variable
	DWORD	dwBAddr_var;	// the bottom field address DRAM variable
    DWORD	dwTSize_var;	// the top field size DRAM variable
    DWORD	dwBSize_var;	// the bottom field size DRAM variable
    DWORD   dwPalAddr_var;  // the palette address DRAM variable
} GDI_PLANE_INFO, * PGDI_PLANE_INFO;

typedef struct tagGDI_IMAGE_INFO	
{
	BYTE	bWidth;	        // the image width
	BYTE	bHeight;	    // the image height
    BYTE	bColorMode;	    // color mode, 0: 4 color, 1: 16 color, 2: 256 color
	BYTE	code *pbImageData;	// point to a image data array, top field data first then bottom field data
} GDI_IMAGE_INFO, * PGDI_IMAGE_INFO;

// ******************************
// Parameter structure definition
// ******************************
typedef struct tagPARM_SCROLL_BAR // Scroll bar parameter structure
{
    RECT  rect;
    WORD  wDisplay;
    WORD  wStartPoint;
}PARM_SCROLL_BAR, *PPARM_SCROLL_BAR;

typedef struct tagPARM_VOLUME_BAR // Volume bar parameter structure
{
    RECT  rect;
    WORD  wVolume;
    BYTE  bBarColor;
    BYTE  bBgColor;
    BYTE  bOriention;
}PARM_VOLUME_BAR, *PPARM_VOLUME_BAR;

typedef struct tagPARM_FRAME // Draw frame parameter structure
{
    RECT  rect;
    BYTE  bStyle;
    BYTE  bThickness;
    BYTE  bColorBright;
    BYTE  bColorDark;
    BYTE  bColorCenter;
}PARM_FRAME, *PPARM_FRAME;

typedef struct tagPARM_RECT // DrawRect, DrawLine, FillRect parameter structure
{
    RECT  rect;
    BYTE  bColor;
}PARM_RECT, *PPARM_RECT;

typedef struct tagPARM_PIXEL // DrawPixel parameter structure
{
    WORD  wX;
    WORD  wY;
    BYTE  bColor;
}PARM_PIXEL, *PPARM_PIXEL;

typedef struct tagPARM_BITMAP_COPY // BitmapCopy parameter structure
{
    RECT  SrcRect;
    BYTE  bSrcRegion;
    WORD  wDestX;
    WORD  wDestY;
    BYTE  bDestRegion;
}PARM_BITMAP_COPY, *PPARM_BITMAP_COPY;

typedef struct tagPARM_BUTTON // BitmapCopy parameter structure
{
    RECT  rect;
    BYTE  bButtonId;
    BYTE  bStyle;       // noraml, disbaled, selected, with text
    //WORD  wTemp;        // Temp usage
}PARM_BUTTON, *PPARM_BUTTON;

typedef struct tagPARM_BMP // Load BMP parameter structure
{
    WORD    wX;         // the x-coordinate
    WORD    wY;         // the y-coordinate
    DWORD  *pdwData;    // pointer to the BMP data, the same format as SCR (not split)
}PARM_BMP, *PPARM_BMP;


typedef struct tagGDI_PARAMETER
{
    union{
        PARM_SCROLL_BAR ScrollBar;
        PARM_VOLUME_BAR VolumeBar;
        PARM_FRAME Frame;
        PARM_RECT RectParm;
        PARM_PIXEL PixelParm;
        PARM_BITMAP_COPY BitmapCopy;
        PARM_BUTTON Button;
        PARM_BMP    BMP;
    } u;

} GDI_PARAMETER, *PGDI_PARAMETER;



extern BOOL GDI_InitialRegion(BYTE bRegionId);
extern void GDI_SetCurrentRegion(BYTE bRegionId);
extern BOOL GDI_ActivateRegion(void);
extern void GDI_DeactivateRegion(void);
extern void GDI_MoveRegion(void); //(WORD wX, WORD wY);
extern void GDI_SetMixRatio(BYTE bMixRatio);
//extern void GDI_DrawPixel(WORD wX, WORD wY, BYTE bColor);
extern void GDI_DrawString(void); //(WORD wX, WORD wY);
//Alan2.36 support for Unicode
#ifdef SUPPORT_UNICODE
extern void GDI_DrawUnicodeString(WORD wMaxWidth);
extern void GDI_DrawAsciiString(WORD wMaxWidth);
#endif
extern void GDI_LoadPalette(BYTE bPaletteId);
extern void GDI_SetTextColor (BYTE bFgBg, BYTE bColor);
extern void GDI_ChangePALEntry(BYTE bIndex, DWORD dwRGB, BYTE bMixEnable);
extern void GDI_ClearRegion(BYTE bRegionId);
extern void GDI_FillRect(PARM_RECT *pParm);
extern void GDI_DrawFrame(PARM_FRAME *pParm);
extern void GDI_BitmapCopy(PARM_BITMAP_COPY *pParm);
extern void GDI_DrawVolumeBar(PARM_VOLUME_BAR *pParm);
extern void GDI_DrawScrollBar(PARM_SCROLL_BAR *pParm);
extern void GDI_DrawButton(PARM_BUTTON *pParm);

extern WORD GDI_GetStringWidth(void);
extern BYTE GDI_GetStringHeight(void);
//Alan2.36 support for Unicode
#ifdef SUPPORT_UNICODE
//extern BYTE GDI_GetUnicodeCharWidth(WORD wUnicodeChar);
extern WORD GDI_GetUnicodeStringWidth(void);
extern WORD GDI_GetUnicodeStringMaxWidth(WORD wMaxWidth);
#endif
extern void GDI_CopyMsgString(void); // Brian0.87-3rd


extern void GDI_CopyCodeString(WORD code *pw);  // should be put in common bank
extern void GDI_OutputText(WORD code *pw); // should be put in common bank

extern void GDI_Initial(void);
extern void GDI_SetGDIPalEntry(void);
extern void GDI_LoadBMPResource(void);
extern void GDI_ShowSpeaker(BYTE bLoc);

extern void GDI_Test();
extern void GDI_DrawString_GXA(void);
//Alan2.36 support for Unicode
#ifdef SUPPORT_UNICODE
extern void GDI_DrawUnicodeString_GXA(WORD wMaxWidth);
extern void GDI_DrawAsciiString_GXA(WORD wMaxWidth);
#endif
extern void GDI_FillRect_GXA(PARM_RECT *pParm);
extern void GDI_BitmapCopy_GXA(PARM_BITMAP_COPY *pParm);
extern void GDI_NumberToString(WORD wNum);
extern void GDI_NumberToStringHex(WORD wNum); // Chuan1.00-2
extern void GDI_ClearRegion_By_RISC(BYTE bRegionId);
extern WORD GDI_GetCodeStringWidth(WORD code *pw);
extern void GDI_VarInit(void); // CT908S
extern void GDI_LinkPseudoRegion(BYTE bLinkRegion); // Brian2.33-2nd
// Brian2.37
extern void GDI_SetFonTableAddr (BYTE bMode);

// Brian1.25, move to OSD.h
//#ifdef SUPPORT_GZIP_COMPRESSION
//extern void OSD_LoadFontTable(void);    // Chuan1.20, Unzip Font Table
//#else
//extern void OSD_LoadFontTableHDW(void);
//extern void OSD_LoadFontTableLDW(void);
//#endif

#ifndef GDI_MAIN_FILE1

extern GDI_REGION_INFO code __RegionList[NUMBER_OF_REGION];
extern WORD    __wGDIString[GDI_STRING_LENGTH+1];
extern BYTE __bCurrentRegionId;
extern GDI_PARAMETER __GDIParm;
extern WORD __wGDIx, __wGDIy;
extern BYTE    __bTextFgColor;
extern BYTE    __bTextBgColor;
extern BYTE    __bShadowColor_1;
extern BYTE    __bShadowColor_2;
extern BYTE    __bGDIMacroParam; // Brian1.00
extern BYTE    __bColorMode; // Brian1.08
extern DWORD   __dwRegionHeight; // CT908S, Brian
extern DWORD   __dwRegionTAddr; // CT908S, Brian
extern DWORD   __dwRegionBAddr; // CT908S, Brian

#endif


#endif  // __GDI_H__

⌨️ 快捷键说明

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