📄 lcd_bc256.c
字号:
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
void LCD_L0_DrawBitmap (int x0, int y0, int xsize, int ysize,
int BitsPerPixel, int BytesPerLine,
const U8* pData, int Diff, const LCD_PIXELINDEX* pTrans)
{
int i;
/* Use aID for bitmaps without palette */
if (!pTrans) {
pTrans = aID;
}
/* Use DrawBitLineXBPP */
for (i=0; i<ysize; i++) {
switch (BitsPerPixel) {
case 1:
DrawBitLine1BPP(x0, i+y0, pData, Diff, xsize, pTrans);
break;
case 8:
#if (LCD_MAX_LOG_COLORS > 16)
DrawBitLine8BPP(x0, i+y0, pData, xsize, pTrans);
// #else
// DEBUG_WARN("\nCan not display 8bpp bitmaps, please #define LCD_MAX_LOG_COLORS 256");
#endif
}
pData += BytesPerLine;
}
}
void LCD_L0_XorPixel (int x, int y)
{
U16 Index = LCD_L0_GetPixelIndex(x,y);
Index = LCD_NUM_COLORS-1-Index;
// SetPixelPhys(x,y,Index);
LCD_L0_DrawPixel(x,y,Index);
}
void LCD_L0_SetLUTEntry (U8 Pos, LCD_COLOR color)
{
LCD_USE_PARA(Pos);
LCD_USE_PARA(color);
}
void LCD_L0_SetOrg (int x, int y)
{
int Off;
int i;
if (y>(LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS))
y = LCD_VYSIZE_PHYS-LCD_YSIZE_PHYS;
Off = y*LCD_BYTESPERLINE+(x>>3);
for (i=0; i<LCD_BITSPERPIXEL/3; i++) {
#ifndef WIN32
// aLcdVirtualBuffer[i][0] = &aLcdActiveBuffer[i][0] +Off;
aLcdVirtualBuffer[i][0] = aLcdActiveBuffer[i][0] +Off; //change by lcn
#endif
}
}
unsigned int LCD_L0_GetPixelIndex (int x, int y)
{
return ((aLcdActiveBuffer[(y)][(x)/4] >> ((3 - (x % 4)) * 8)) & 0xff);
}
void LCD_L0_SetPixelIndex (int x, int y, int ColorIndex)
{
LCD_L0_DrawPixel(x,y,ColorIndex);
}
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 + -