📄 gpc.h
字号:
#ifndef _GPC_H_
#define _GPC_H_
#include "asixdef.h"
// longn_qi 2001/11/27 added
#include "cdevice.h" // in that header, phyiscal screen size
// and pixel size are defined.
///////////////////////////////////////////////////////////////
// Define Declare Section
///////////////////////////////////////////////////////////////
// GPC Library Version */
#define GPC_VERSION (0x13) // ver 1.3
// longn_qi 2001/11/27 revised
#define PHY_LCD_W LCD_WIDTH // 物理屏幕宽度
#define PHY_LCD_H LCD_HEIGHT // 物理屏幕高度
// 预定义 RGB 色
#ifndef GPC_COLOR_TABLE
#define GPC_COLOR_TABLE
#define GPC_BLACK 0x000000
#define GPC_RED 0x800000
#define GPC_GREEN 0x008000
#define GPC_YELLOW 0x808000
#define GPC_BLUE 0x000080
#define GPC_MAGENTA 0x800080
#define GPC_CYAN 0x008080
#define GPC_LIGHTGREY 0x808080
#define GPC_DARKGREY 0x303030
#define GPC_LIGHTRED 0xff0000
#define GPC_LIGHTGREEN 0x00ff00
#define GPC_LIGHTYELLOW 0xffff00
#define GPC_LIGHTBLUE 0x0000ff
#define GPC_LIGHTMAGENTA 0xff00ff
#define GPC_LIGHTCYAN 0x00ffff
#define GPC_WHITE 0xffffff
#define GPC_ALICEBLUE 0xF0F8FF
#define GPC_ANTIQUEWHITE 0xFAEBD7
#define GPC_BURLYWOOD 0xDEB887
#define GPC_CADETBLUE 0x5F9EA0
#define GPC_CORNFLOWERBLUE 0x6495ED
#define GPC_CORNSILK 0xFFF8DC
#define GPC_CORAL 0xFF7F50
#define GPC_CRIMSON 0xDC143C
#define GPC_DARKBLUE 0x00008B
#define GPC_DARKCYAN 0x008B8B
#define GPC_DARKKHAKI 0xBDB76B
#define GPC_DARKMAGENTA 0x8B008B
#define GPC_DARKORANGE 0xFF8C00
#define GPC_DARKORCHID 0x9932CC
#define GPC_DARKRED 0x8B0000
#define GPC_DARKSALMON 0xE9967A
#define GPC_DARKSLATEBLUE 0x483D8B
#define GPC_DARKSEAGREAN 0x8FBC8F
#define GPC_DODGERBLUE 0x1E90FF
#define GPC_FIREBRICK 0xB22222
#define GPC_FLORALWHITE 0xFFFAF0
#define GPC_GAINSBORO 0xDCDCDC
#define GPC_GREENYELLOW 0xADFF2F
#define GPC_HOTPINK 0xFF69B4
#define GPC_INDIANRED 0xCD5C5C
#define GPC_INDIGO 0x4B0082
#define GPC_KHAKI 0xF0E68C
#define GPC_LAVENDER 0xE6E6FA
#define GPC_LEMONCHIFFON 0xFFFACD
#define GPC_LIGHTCORAL 0xF08080
#define GPC_LIGHTPINK 0xFFB6C1
#define GPC_LIGHTSTEELBLUE 0xB0C4DE
#define GPC_MAROON 0x800000
#define GPC_MEDIUMORCHID 0xBA55D3
#define GPC_OLIVEDRAB 0x6B8E23
#define GPC_ORANGE 0xFFA500
#define GPC_ORANGERED 0xFF4500
#define GPC_PALEGOLDENROD 0xEEE8AA
#define GPC_PALEVIOLETRED 0xD87093
#define GPC_PLUM 0xDDA0DD
#define GPC_POWDERBLUE 0xB0E0E6
#define GPC_SEAGREEN 0x2E8B57
#define GPC_SLATEBLUE 0x6A5ACD
#define GPC_THISTLE 0xD8BFD8
#define GPC_TEAL 0x008080
#define GPC_VIOLETRED 0xD02090
#define GPC_YELLOWGREEN 0x9ACD32
#endif //GPC_COLOR_TABLE
// 线型
#ifndef GPC_LINE_STYLE
#define GPC_LINE_STYLE
#define GPC_SOLID_LINE 0xffff // 实线 ——
#define GPC_DASH_LINE 0xf0f0 // 虚线 - -
#define GPC_DOT_LINE 0xaaaa // 虚线 ····
#define GPC_DASHDOT_LINE 0xe4e4 // 点划线 -·-·
#endif //GPC_LINE_STYLE
// 线宽
#define GPC_NORM_WIDTH 1
#define GPC_THICK_WIDTH 3
// BitBlt operators for gpcPutImage
#define GPC_COPY_PUT COPY_PUT // MOV
#define GPC_XOR_PUT XOR_PUT // XOR
#define GPC_OR_PUT OR_PUT // OR
#define GPC_AND_PUT AND_PUT // AND
#define GPC_NOT_PUT NOT_PUT // NOT
// 返回值
#ifndef GPC_ERROR_CODE
#define GPC_ERROR_CODE
#define GPC_ERR_OK (0) // No Error, Call Was Successful.
#define GPC_ERR_FAILED (-1) // General purpose failure.
#define GPC_ERR_NOMAP (-2) // Memory Overflow.
#define GPC_ERR_FONT (-10) // No FONTX2 Font.
#define GCC_NO_FIELD (-20) // No Field Control
#define GCC_NO_DATA_FIELD (-21) // No Data in the Field Control
#define GPC_ERR_NO_SCROLL (-22) // No Scroll in the Field Control
#define GPC_ERR_MAX_SCROLL (-23) // ScrollLines > 10(MAX_SCROLL)
#define GPC_NO_FONT_FIELD (-24) // No FONT1 in the text field
#endif // GPC_ERROR_CODE
// 位操作类型
#ifndef GPC_BIT_OP_STYLE
#define GPC_BIT_OP_STYLE
#define GPC_REPLACE_STYLE 0x1 // 位替换操作
#define GPC_AND_STYLE 0x2 // 位与操作
#define GPC_OR_STYLE 0x3 // 位或操作
#define GPC_XOR_STYLE 0x4 // 位异或操作
#define GPC_COPY_STYLE 0x5 // 位复制操作
#define GPC_NOT_STYLE 0x6 // 位取反操作
// 扩展位操作类型
#ifndef GPC_BIT_OP_EX_STYLE
#define GPC_BIT_OP_EX_STYLE
#define GPC_TRANSPARENT_STYLE 0x7 // 透明效果
#define GPC_PAINT_STYLE 0x8 // 正常效果
#define GPC_MIN_STYLE GPC_REPLACE_STYLE
#define GPC_MAX_STYLE GPC_PAINT_STYLE
#endif //GPC_BIT_OP_EX_STYLE
#endif //GPC_BIT_OP_STYLE
//-----------------------------------------------------------
// 光标状态
#define ASIX_CURSOR_OFF 1 // 关闭光标
#define ASIX_CURSOR_ON 2 // 开启光标
#define ASIX_CURSOR_REVERSED 3 // 反转光标状态
#define BLINK_MASK 0x0 // 光标闪烁模板
//#define BLINK_MASK 0xffffff // 光标闪烁模板
// maximun scope of cursor
// cursor的最大为16*16 pixel
// longn_qi 2001/12/20 revised
#define MAX_CURSOR_WIDTH 16 // 最大光标宽度
#define MAX_CURSOR_HEIGHT 16 // 最大光标高度
// 光标闪烁频率范围
#define FREMAX 10000 //??最低频率(1/10000 MHz = 100Hz)
#define FREMIN 10 //??最高频率(1/10 MHz = 100KHz)
// 光标风格
#define CURSOR_THREAD 0 // 垂直细实线
#define CURSOR_REC 1 // 矩形
// 文本对齐模式
#define GPC_ALIGN_CENTER 0 // 居中对齐
#define GPC_ALIGN_LEFT 1 // 左对齐
#define GPC_ALIGN_RIGHT 2 // 右对齐
// 结构标识符
#ifdef BIG_ENDIAN_ORDER
#define GPC_GC_SYMBOL 0x4347 // 图形上下文结构标识符'GC'
#define GPC_CURSOR_SYMBOL 0x5343 // 光标结构标识符'CS'
#define GPC_BMP_SYMBOL 0x424D // 位图标识符'BM'
#else
#define GPC_GC_SYMBOL 0x4743 // 图形上下文结构标识符'GC'
#define GPC_CURSOR_SYMBOL 0x4353 // 光标结构标识符'CS'
#define GPC_BMP_SYMBOL 0x4D42 // 位图标识符'BM'
#endif
/* Now, we use GB font */
#define _GB2312_
#ifndef _GB2312_
// 1999.12.13 By Shin :: Add Font Byte Check
#define gpcCheckFontByte(text) \
(((*(text) >= 0x20 && *(text) <= 0x7E) || (*(text) >= 0xA1 && *(text) <= 0xDF)) ? 1 : \
((*(text) >= 0x81 && *(text) <= 0x9F) || (*(text) >= 0xE0 && *(text) <= 0xEA) || \
(*(text) >= 0xED && *(text) <= 0xEE) || (*(text) >= 0xFA && *(text) <= 0xFC)) ? 2 : 0)
// Modified by Stella 2001/01/11
#else
#define gpcCheckFontByte(text) \
( ( *(text) >= 0x20 && *(text) <=0x7e )? 1 :\
(( *(text)>=0xa0 && *(text)<=0xfe ) ? 2 : 0 ) )
#endif
//by zhuli 2002.2.3
//convert the types of x and y from WORD to SHORT before compare to 0 By zl 2002.4.3
// longn_qi 2002/04/25 move it here
extern BOOL Write2LCD( WORD x1, WORD y1, WORD x2, WORD y2, VRAM *initAd );
//#ifdef DMA_MODE
//#define WRITELCD( x1, y1, x2, y2 ) seWrite2LCD( pGC->vram, 0 );
//#else
#define WRITELCD( x1, y1, x2, y2 ) \
{\
short px1, px2, py1, py2;\
px1 = (x1) - pGC->lcd_x;\
px2 = (x2) - pGC->lcd_x;\
py1 = (y1) - pGC->lcd_y;\
py2 = (y2) - pGC->lcd_y;\
if(!( (SHORT)(x2) < 0 ||(SHORT) (y2) < 0 || (x1) > PHY_LCD_W - 1 || (y1) > PHY_LCD_H - 1 ))\
{\
px1 = ( px1 < 0 )? 0 : px1;\
py1 = ( py1 < 0 )? 0 : py1;\
px2 = ( px2 >= PHY_LCD_W )? PHY_LCD_W-1 : px2;\
py2 = ( py2 >= PHY_LCD_H )? PHY_LCD_H-1 : py2;\
Write2LCD( px1, py1, px2, py2, pGC->vram );\
}\
}
//#endif
// 位图的状态标志位
#define GPC_BMP_PALETTE_FLAG 0x01
#define GPC_BMP_COMPRESS_FLAG 0x02
//位图头信息结构
typedef struct
{
WORD type; // 位图的标识符,必须是GPC_BMP_SYMBOL = 0x4D42 ('BM')
WORD width; // 位图的宽度(像素单位)
WORD height; // 位图的高度(像素单位)
BYTE bitcount; // 位图的像素深度(bits/pixel)
BYTE flag; // 位图的状态标志位
// |7|6|5|4|3|2|1|0|
// 0位:是否使用自定义调色板(1=使用自定义调色板,0=使用系统调色板)
// 1位:是否压缩(1=使用压缩算法,0=不使用压缩算法)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -