📄 lcd_lc256_.c
字号:
LCD_USE_PARA(Pos);
LCD_USE_PARA(color);
}
static void SetPosXY(int x, int y) {
CurPosX = x;
//pCurPos = OFF2PTR(XY2OFF(x,y));
pCurPos = (U8*)OFF2PTR(XY2OFF(x,y));//change by lcn
switch (x&7) {
case 3:
case 4:
case 5:
pCurPos++; break;
case 6:
case 7:
pCurPos+=2;
}
}
static void SetNextPixel(LCD_PIXELINDEX c) {
switch (CurPosX&7) {
case 0: *pCurPos = (*pCurPos&~(7<<5))|(c<<5); break;
case 1: *pCurPos = (*pCurPos&~(7<<2))|(c<<2); break;
case 2: *pCurPos = (*pCurPos&~(3))|(c>>1);
pCurPos++;
*pCurPos = (*pCurPos &~(1<<7))|(c<<7);
break;
case 3: *pCurPos = (*pCurPos&~(7<<4))|(c<<4); break;
case 4: *pCurPos = (*pCurPos&~(7<<1))|(c<<1); break;
case 5: *pCurPos = (*pCurPos&~(1))|(c>>2);
pCurPos++;
*pCurPos = (*pCurPos &~(3<<6))|(c<<6);
break;
case 6: *pCurPos = (*pCurPos&~(7<<3))|(c<<3); break;
case 7: *pCurPos = (*pCurPos&~(7<<0))|(c);
pCurPos++;
break;
}
CurPosX++;
}
/*
*********************************************
* *
* Draw Bitmap 1 BPP *
* *
*********************************************
*/
static void DrawBitLine1BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
LCD_PIXELINDEX Index0 = *(pTrans+0);
LCD_PIXELINDEX Index1 = *(pTrans+1);
/*
// Jump to right entry point
*/
pixels = *p;
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0:
#if (LCD_OPTIMIZE) \
&& (!LCD_MIRROR_X) \
&& (!LCD_MIRROR_Y) \
&& (!LCD_SWAP_XY) \
&& (!LCD_SUPPORT_COMTRANS) \
&& (!LCD_SUPPORT_SEGTRANS) \
&& ((LCD_BITSPERPIXEL == 3) || (LCD_BITSPERPIXEL == 6))
SetPosXY(x+(Diff&7),y);
#endif
switch (Diff&7) {
case 0:
goto WriteBit0;
case 1:
goto WriteBit1;
case 2:
goto WriteBit2;
case 3:
goto WriteBit3;
case 4:
goto WriteBit4;
case 5:
goto WriteBit5;
case 6:
goto WriteBit6;
case 7:
goto WriteBit7;
}
break;
case LCD_DRAWMODE_TRANS:
switch (Diff&7) {
case 0:
goto WriteTBit0;
case 1:
goto WriteTBit1;
case 2:
goto WriteTBit2;
case 3:
goto WriteTBit3;
case 4:
goto WriteTBit4;
case 5:
goto WriteTBit5;
case 6:
goto WriteTBit6;
case 7:
goto WriteTBit7;
}
break;
case LCD_DRAWMODE_XOR:
switch (Diff&7) {
case 0:
goto WriteXBit0;
case 1:
goto WriteXBit1;
case 2:
goto WriteXBit2;
case 3:
goto WriteXBit3;
case 4:
goto WriteXBit4;
case 5:
goto WriteXBit5;
case 6:
goto WriteXBit6;
case 7:
goto WriteXBit7;
}
}
/*
Write with transparency
*/
WriteTBit0:
if (pixels&(1<<7)) LCD_L0_DrawPixel(x+0, y, Index1);
if (!--xsize)
return;
WriteTBit1:
if (pixels&(1<<6)) LCD_L0_DrawPixel(x+1, y, Index1);
if (!--xsize)
return;
WriteTBit2:
if (pixels&(1<<5)) LCD_L0_DrawPixel(x+2, y, Index1);
if (!--xsize)
return;
WriteTBit3:
if (pixels&(1<<4)) LCD_L0_DrawPixel(x+3, y, Index1);
if (!--xsize)
return;
WriteTBit4:
if (pixels&(1<<3)) LCD_L0_DrawPixel(x+4, y, Index1);
if (!--xsize)
return;
WriteTBit5:
if (pixels&(1<<2)) LCD_L0_DrawPixel(x+5, y, Index1);
if (!--xsize)
return;
WriteTBit6:
if (pixels&(1<<1)) LCD_L0_DrawPixel(x+6, y, Index1);
if (!--xsize)
return;
WriteTBit7:
if (pixels&(1<<0)) LCD_L0_DrawPixel(x+7, y, Index1);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteTBit0;
/*
Write without transparency
*/
#if (LCD_OPTIMIZE) \
&& (!LCD_MIRROR_X) \
&& (!LCD_MIRROR_Y) \
&& (!LCD_SWAP_XY) \
&& (!LCD_SUPPORT_COMTRANS) \
&& (!LCD_SUPPORT_SEGTRANS) \
&& ((LCD_BITSPERPIXEL == 3) || (LCD_BITSPERPIXEL == 6))
WriteBit0:
SetNextPixel((pixels&(1<<7)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit1:
SetNextPixel((pixels&(1<<6)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit2:
SetNextPixel((pixels&(1<<5)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit3:
SetNextPixel((pixels&(1<<4)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit4:
SetNextPixel((pixels&(1<<3)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit5:
SetNextPixel((pixels&(1<<2)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit6:
SetNextPixel((pixels&(1<<1)) ? Index1 : Index0);
if (!--xsize) return;
WriteBit7:
SetNextPixel((pixels&(1<<0)) ? Index1 : Index0);
if (!--xsize) return;
x+=8;
pixels = *(++p);
goto WriteBit0;
#else
WriteBit0:
LCD_L0_DrawPixel(x+0, y, (pixels&(1<<7)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit1:
LCD_L0_DrawPixel(x+1, y, (pixels&(1<<6)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit2:
LCD_L0_DrawPixel(x+2, y, (pixels&(1<<5)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit3:
LCD_L0_DrawPixel(x+3, y, (pixels&(1<<4)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit4:
LCD_L0_DrawPixel(x+4, y, (pixels&(1<<3)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit5:
LCD_L0_DrawPixel(x+5, y, (pixels&(1<<2)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit6:
LCD_L0_DrawPixel(x+6, y, (pixels&(1<<1)) ? Index1 : Index0);
if (!--xsize)
return;
WriteBit7:
LCD_L0_DrawPixel(x+7, y, (pixels&(1<<0)) ? Index1 : Index0);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteBit0;
#endif
/*
Write XOR mode
*/
WriteXBit0:
if (pixels&(1<<7))
LCD_L0_XorPixel(x+0, y);
if (!--xsize)
return;
WriteXBit1:
if (pixels&(1<<6))
LCD_L0_XorPixel(x+1, y);
if (!--xsize)
return;
WriteXBit2:
if (pixels&(1<<5))
LCD_L0_XorPixel(x+2, y);
if (!--xsize)
return;
WriteXBit3:
if (pixels&(1<<4))
LCD_L0_XorPixel(x+3, y);
if (!--xsize)
return;
WriteXBit4:
if (pixels&(1<<3))
LCD_L0_XorPixel(x+4, y);
if (!--xsize)
return;
WriteXBit5:
if (pixels&(1<<2))
LCD_L0_XorPixel(x+5, y);
if (!--xsize)
return;
WriteXBit6:
if (pixels&(1<<1))
LCD_L0_XorPixel(x+6, y);
if (!--xsize)
return;
WriteXBit7:
if (pixels&(1<<0))
LCD_L0_XorPixel(x+7, y);
if (!--xsize)
return;
x+=8;
pixels = *(++p);
goto WriteXBit0;
}
/*
*********************************************
* *
* Draw Bitmap 8 BPP (256 colors) *
* *
*********************************************
*/
#if (LCD_MAX_LOG_COLORS > 16)
static void DrawBitLine8BPP(int x, int y, U8 const*p, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
do {
pixels = *p;
LCD_L0_DrawPixel(x+0, y, *(pTrans+pixels));
x++;
p++;
} while (--xsize);
}
#endif
int LCD_L0_CheckInit(void) {
return 0;
}
void Lcd_Clr(void)
{
INT32U i;
INT32U *pDisp = (INT32U*)aLcdActiveBuffer;
for (i = 0; i < (SCR_XSIZE * SCR_YSIZE / 4); i++)
{
*pDisp++ = 0xffffffff;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -