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

📄 uigb14.c

📁 嵌入工linux开发的源码
💻 C
字号:
#include <uifont.h>
#include <uiGB14.h>
#include <uiUtility.h>
#include <uiGB14.res>
                       
void guiShowGB14Word(HNDL handle, const char *pCode,int x,int y, int color, int style)
{
	TRect ViewRect;
	int iRet, left, top;
	int ViewLeft, ViewTop, ViewRight, ViewBottom;
	
	iRet = _guiGetHandleView(handle, &ViewLeft, &ViewTop, &ViewRight, &ViewBottom);
	if(iRet!=STATUS_OK)
		return;

	ViewRect.left  = ViewLeft;   ViewRect.top    = ViewTop;
	ViewRect.right = ViewRight;  ViewRect.bottom = ViewBottom;

	left = x;
	top  = y;
	_guiConvertXY(handle, &left, &top);

	_guiShowGB14WordInView(&ViewRect, pCode, left, top, color, style);
}

void _guiShowGB14WordInView(TRect *rect, const char *pCode,int x,int y,int color, int style)
{
	int pos;
	unsigned short ch;
	int x0=x;
	int y0=y;
	int i;
	int j;
	unsigned char ch1,ch2;	
	int bkcolor, fgcolor;

	bkcolor = (color&0x0000ff00)>>8;
	fgcolor = color&0x000000ff;
	
	ch1=pCode[0]-0xa1;
	ch2=pCode[1]-0xa1;

	if(ch1 < 0 || ch2 < 0)
		return;

	pos=ch1 * 94 + ch2;

	if(pos < 0 || pos >= 8178)
		return;

	pos*=14;
	
	if(style==FONT_TRANSPARENT)
	{
		for(i=0;i<14;i++)
		{
			x0=x;
			ch=GB14_Data[pos];
			for(j=0;j<14;j++)
			{
				if(ch & 0x8000)
					if((x0>=rect->left)&&(x0<=rect->right)&&(y0>=rect->top)&&(y0<=rect->bottom))
						displayDrawPixel(x0,y0,fgcolor);
				ch<<=1;
				x0++;
			}
			y0++;
			pos++;
		}
	}
	else
	{		
		for(i=0;i<14;i++)
		{

			x0=x;
			ch=GB14_Data[pos];
			for(j=0;j<14;j++)
			{
				if((x0>=rect->left)&&(x0<=rect->right)&&(y0>=rect->top)&&(y0<=rect->bottom))
				{
					if(ch & 0x8000)
						displayDrawPixel(x0,y0,fgcolor);
					else
						displayDrawPixel(x0,y0,bkcolor);
				}
				ch<<=1;
				x0++;
			}
			y0++;
			pos++;
		}
	}
}

short guiGetGB14WordWidth(void)
{
	return 14;
}

short guiGetGB14WordHeight(void)
{
	return 14;
}

⌨️ 快捷键说明

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