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

📄 uieng12.c

📁 嵌入工linux开发的源码
💻 C
字号:
#include <uifont.h>
#include <uiEng12.h>
#include <uiUtility.h>
#include <uiEng12.res>

short guiGetEng12Height(void)
{
	return 12;
}

short guiGetEng12Width(const char ascii)
{
	return Eng12_Width[ascii];
}

void _guiShowEng12InView(TRect *rect, const char ascii, int x, int y, int color, int style)
{
	short data, bitOffset, dataOffset;
	short rulerData, width;
	int i, j, xPos, yPos;
	int bkcolor, fgcolor;
	
	dataOffset = Eng12_Offset[ascii];
	width = Eng12_Width[ascii];

	bkcolor = (color&0x0000ff00)>>8;
	fgcolor = color&0x000000ff;
	
	xPos = x;
	yPos = y;
	
	if(style==FONT_TRANSPARENT)
	{
		for(i=dataOffset; i<dataOffset+width; i++)
		{
			data = Eng12_Data[i];
			for(j=0; j<12; j++)
			{
				rulerData = (0x0001)<<j;
				if(data & rulerData)
				{
					if((xPos>=rect->left)&&(xPos<=rect->right)&&(yPos+j>=rect->top)&&(yPos+j<=rect->bottom))
						displayDrawPixel(xPos, yPos+j, fgcolor);
				}
			}
			xPos++;
		}
	}
	else
	{
		for(i=dataOffset; i<dataOffset+width; i++)
		{
			data = Eng12_Data[i];
			for(j=0; j<12; j++)
			{
				rulerData = (0x0001)<<j;
				
				if((xPos>=rect->left)&&(xPos<=rect->right)&&(yPos+j>=rect->top)&&(yPos+j<=rect->bottom))
				{
					if(data & rulerData)	
						displayDrawPixel(xPos, yPos+j, fgcolor);
					else
						displayDrawPixel(xPos, yPos+j, bkcolor);				
				}
			}
			xPos++;
		}
	}
}

void guiShowEng12(HNDL handle, const char ascii, 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);

	_guiShowEng12InView(&ViewRect, ascii, left, top, color, style);
}

unsigned short *guiGetEng12Bitmap(char ascii)
{
	unsigned short offset;

	offset=Eng12_Offset[ascii];
	return ((unsigned short *)(&Eng12_Data[offset]));
}

⌨️ 快捷键说明

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