📄 lcd_api.c
字号:
fColor = asciiCharInfo.bFgColor;
fColor = fColor | (fColor << 16);
for( j = 0; j < 4; j++ )
fGroundCode[j] = fColor;
fontRowByte = fontWidth / 8;
fontRowBit = fontWidth % 8;
if( fontRowBit )
posOffset = 1;
for( i = 0; i < fontRowByte; i++ )
{
drawX = startX + (8*i);
for( k = 0; k < fontHeight; k++ )
{
drawY = startY + k;
currentFontChar = fontLibOffset[k*(fontRowByte+posOffset)+i];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)foreGroundArray + index),&monoByteToColorArray[currentFontChar].foregroundCode[index],2);
//GSMmemcpy( (UINT8*)foreGroundArray, monoByteToColorArray[currentFontChar].foregroundCode, 16 );
foreGroundArray[0] = foreGroundArray[0] & fGroundCode[0];
foreGroundArray[1] = foreGroundArray[1] & fGroundCode[1];
foreGroundArray[2] = foreGroundArray[2] & fGroundCode[2];
foreGroundArray[3] = foreGroundArray[3] & fGroundCode[3];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)backGroundArray + index),&monoByteToColorArray[currentFontChar].backgroundCode[index],2);
//GSMmemcpy( (UINT8*)backGroundArray, monoByteToColorArray[currentFontChar].backgroundCode, 16 );
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)bGroundCodeTemp + index),&lpBitBuffer[drawY * color_Lcd_Width+drawX + index],2);
//GSMmemcpy( (UINT8*)bGroundCodeTemp, &(lpBitBuffer[drawY * color_Lcd_Width + drawX]), 16 );
backGroundArray[0] = backGroundArray[0] & bGroundCodeTemp[0];
backGroundArray[1] = backGroundArray[1] & bGroundCodeTemp[1];
backGroundArray[2] = backGroundArray[2] & bGroundCodeTemp[2];
backGroundArray[3] = backGroundArray[3] & bGroundCodeTemp[3];
foreGroundArray[0] = foreGroundArray[0] | backGroundArray[0];
foreGroundArray[1] = foreGroundArray[1] | backGroundArray[1];
foreGroundArray[2] = foreGroundArray[2] | backGroundArray[2];
foreGroundArray[3] = foreGroundArray[3] | backGroundArray[3];
HwLCDWriteLine( (UINT16*)foreGroundArray, drawX, drawY, 8 );
}
}
if( fontRowBit )
{
drawX = startX + (8*fontRowByte);
for( k = 0; k < fontHeight; k++ )
{
drawY = startY + k;
currentFontChar = fontLibOffset[k*(fontRowByte+1)+fontRowByte];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)foreGroundArray + index),&monoByteToColorArray[currentFontChar].foregroundCode[index],2);
// GSMmemcpy( (UINT8*)foreGroundArray, monoByteToColorArray[currentFontChar].foregroundCode, 16 );
foreGroundArray[0] = foreGroundArray[0] & fGroundCode[0];
foreGroundArray[1] = foreGroundArray[1] & fGroundCode[1];
foreGroundArray[2] = foreGroundArray[2] & fGroundCode[2];
foreGroundArray[3] = foreGroundArray[3] & fGroundCode[3];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)backGroundArray + index),&monoByteToColorArray[currentFontChar].backgroundCode[index],2);
// GSMmemcpy( (UINT8*)backGroundArray, monoByteToColorArray[currentFontChar].backgroundCode, 16 );
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)bGroundCodeTemp + index),&lpBitBuffer[drawY * color_Lcd_Width+drawX + index],2);
// GSMmemcpy( (UINT8*)bGroundCodeTemp, &(lpBitBuffer[drawY * color_Lcd_Width + drawX]), 16 );
backGroundArray[0] = backGroundArray[0] & bGroundCodeTemp[0];
backGroundArray[1] = backGroundArray[1] & bGroundCodeTemp[1];
backGroundArray[2] = backGroundArray[2] & bGroundCodeTemp[2];
backGroundArray[3] = backGroundArray[3] & bGroundCodeTemp[3];
foreGroundArray[0] = foreGroundArray[0] | backGroundArray[0];
foreGroundArray[1] = foreGroundArray[1] | backGroundArray[1];
foreGroundArray[2] = foreGroundArray[2] | backGroundArray[2];
foreGroundArray[3] = foreGroundArray[3] | backGroundArray[3];
HwLCDWriteLine( (UINT16*)foreGroundArray, drawX, drawY, fontRowBit );
}
}
}
void LCDDrawWideByteFontCharTransNormalMode( ColorWideByteChar wCharInfo )
{
INT8 i, j, k;
UINT8 index;
UINT8 *fontLibHeadPointer, *fontLibOffset, posOffset = 0;
UINT8 fontWidth, fontHeight, currentFontChar;
UINT8 startX, startY, drawX, drawY, fontRowByte, fontRowBit, font_Id;
UINT32 foreGroundArray[4], backGroundArray[4], bGroundCodeTemp[4], fGroundCode[4];
UINT32 fColor;
long int offset;
UINT16 hiByte, lowByte, editChar;
font_Id = wCharInfo.font_Id;
// get font width, height, size, compressed and font library header pointer
fontWidth = wCharInfo.fontWidth;
fontHeight = wCharInfo.fontHeight;
fontLibHeadPointer = (UINT8*)lcdHzParam.pFontList[font_Id].pFontHeader->pGlyphData;
// get character and get left X and top Y position that character will be displayed
startX = (UINT8)wCharInfo.sPos.x;
startY = (UINT8)wCharInfo.sPos.y;
editChar = wCharInfo.editChar;
// following steps get the character offset in current font library
//editChar = 0xb0cb;
editChar = (editChar - 0xa1a1)&0x7f7f;
lowByte = editChar & 0x00ff;
hiByte = (editChar>>8) & 0x00ff;
offset = ((lowByte*94L) + hiByte)*(fontHeight*2);
// font lib pointer offset
fontLibOffset = &fontLibHeadPointer[offset];
fColor = wCharInfo.bFgColor;
fColor = fColor | (fColor << 16);
for( j = 0; j< 4; j++ )
fGroundCode[j] = fColor;
// GSMmemset( (UINT8*)fGroundCode, wCharInfo.bFgColor, 16 );
fontRowByte = fontWidth / 8;
fontRowBit = fontWidth % 8;
if( fontRowBit )
posOffset = 1;
for( i = 0; i < fontRowByte; i++ )
{
drawX = startX + (8*i);
for( k = 0; k < fontHeight; k++ )
{
drawY = startY + k;
currentFontChar = fontLibOffset[k*(fontRowByte+posOffset)+i];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)foreGroundArray + index),&monoByteToColorArray[currentFontChar].foregroundCode[index],2);
// GSMmemcpy( (UINT8*)foreGroundArray, monoByteToColorArray[currentFontChar].foregroundCode, 16 );
foreGroundArray[0] = foreGroundArray[0] & fGroundCode[0];
foreGroundArray[1] = foreGroundArray[1] & fGroundCode[1];
foreGroundArray[2] = foreGroundArray[2] & fGroundCode[2];
foreGroundArray[3] = foreGroundArray[3] & fGroundCode[3];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)backGroundArray + index),&monoByteToColorArray[currentFontChar].backgroundCode[index],2);
// GSMmemcpy( (UINT8*)backGroundArray, monoByteToColorArray[currentFontChar].backgroundCode, 16 );
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)bGroundCodeTemp + index),&lpBitBuffer[drawY * color_Lcd_Width+drawX + index],2);
// GSMmemcpy( (UINT8*)bGroundCodeTemp, &(lpBitBuffer[drawY * color_Lcd_Width + drawX]), 16 );
backGroundArray[0] = backGroundArray[0] & bGroundCodeTemp[0];
backGroundArray[1] = backGroundArray[1] & bGroundCodeTemp[1];
backGroundArray[2] = backGroundArray[2] & bGroundCodeTemp[2];
backGroundArray[3] = backGroundArray[3] & bGroundCodeTemp[3];
foreGroundArray[0] = foreGroundArray[0] | backGroundArray[0];
foreGroundArray[1] = foreGroundArray[1] | backGroundArray[1];
foreGroundArray[2] = foreGroundArray[2] | backGroundArray[2];
foreGroundArray[3] = foreGroundArray[3] | backGroundArray[3];
HwLCDWriteLine( (UINT16*)foreGroundArray, drawX, drawY, 8 );
}
}
if( fontRowBit )
{
drawX = startX + (8*fontRowByte);
for( k = 0; k < fontHeight; k++ )
{
drawY = startY + k;
currentFontChar = fontLibOffset[k*(fontRowByte+1)+fontRowByte];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)foreGroundArray + index),&monoByteToColorArray[currentFontChar].foregroundCode[index],2);
// GSMmemcpy( (UINT8*)foreGroundArray, monoByteToColorArray[currentFontChar].foregroundCode, 16 );
foreGroundArray[0] = foreGroundArray[0] & fGroundCode[0];
foreGroundArray[1] = foreGroundArray[1] & fGroundCode[1];
foreGroundArray[2] = foreGroundArray[2] & fGroundCode[2];
foreGroundArray[3] = foreGroundArray[3] & fGroundCode[3];
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)backGroundArray + index),&monoByteToColorArray[currentFontChar].backgroundCode[index],2);
// GSMmemcpy( (UINT8*)backGroundArray, monoByteToColorArray[currentFontChar].backgroundCode, 16 );
for(index = 0; index < 8; index++)
GSMmemcpy((UINT16 *)((UINT16 *)bGroundCodeTemp + index),&lpBitBuffer[drawY * color_Lcd_Width+drawX + index],2);
// GSMmemcpy( (UINT8*)bGroundCodeTemp, &(lpBitBuffer[drawY * color_Lcd_Width + drawX]), 16 );
backGroundArray[0] = backGroundArray[0] & bGroundCodeTemp[0];
backGroundArray[1] = backGroundArray[1] & bGroundCodeTemp[1];
backGroundArray[2] = backGroundArray[2] & bGroundCodeTemp[2];
backGroundArray[3] = backGroundArray[3] & bGroundCodeTemp[3];
foreGroundArray[0] = foreGroundArray[0] | backGroundArray[0];
foreGroundArray[1] = foreGroundArray[1] | backGroundArray[1];
foreGroundArray[2] = foreGroundArray[2] | backGroundArray[2];
foreGroundArray[3] = foreGroundArray[3] | backGroundArray[3];
HwLCDWriteLine( (UINT16*)foreGroundArray, drawX, drawY, fontRowBit );
}
}
}
void LCDDrawAsciiFontCharTransInverseMode( ColorAsciiChar asciiCharInfo )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -