📄 lcd15e05.c
字号:
goto WriteXBit0;
}
/*
*****************************************
*
* Draw Bitmap 2 BPP
* no optimizations
*
*****************************************
*/
#if (LCD_MAX_LOG_COLORS > 2)
static void DrawBitLine2BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
/*
// Jump to right entry point
*/
pixels = *p;
if (pTrans) {
/*
with palette
*/
if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) switch (Diff&3) {
case 0:
goto WriteTBit0;
case 1:
goto WriteTBit1;
case 2:
goto WriteTBit2;
default:
goto WriteTBit3;
} else switch (Diff&3) {
case 0:
goto WriteBit0;
case 1:
goto WriteBit1;
case 2:
goto WriteBit2;
default:
goto WriteBit3;
}
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, *(pTrans+(pixels>>6)));
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, *(pTrans+(3&(pixels>>4))));
if (!--xsize)
return;
WriteBit2:
SETPIXEL(x+2, y, *(pTrans+(3&(pixels>>2))));
if (!--xsize)
return;
WriteBit3:
SETPIXEL(x+3, y, *(pTrans+(3&(pixels))));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels&(3<<6))
SETPIXEL(x+0, y, *(pTrans+(pixels>>6)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&(3<<4))
SETPIXEL(x+1, y, *(pTrans+(3&(pixels>>4))));
if (!--xsize)
return;
WriteTBit2:
if (pixels&(3<<2))
SETPIXEL(x+2, y, *(pTrans+(3&(pixels>>2))));
if (!--xsize)
return;
WriteTBit3:
if (pixels&(3<<0))
SETPIXEL(x+3, y, *(pTrans+(3&(pixels))));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteTBit0;
} else {
/*
without palette
*/
if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) switch (Diff&3) {
case 0:
goto WriteDDPTBit0;
case 1:
goto WriteDDPTBit1;
case 2:
goto WriteDDPTBit2;
default:
goto WriteDDPTBit3;
} else switch (Diff&3) {
case 0:
goto WriteDDPBit0;
case 1:
goto WriteDDPBit1;
case 2:
goto WriteDDPBit2;
default:
goto WriteDDPBit3;
}
/*
Write without transparency
*/
WriteDDPBit0:
SETPIXEL(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPBit1:
SETPIXEL(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPBit2:
SETPIXEL(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPBit3:
SETPIXEL(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPBit0;
/*
Write with transparency
*/
WriteDDPTBit0:
if (pixels&(3<<6))
SETPIXEL(x+0, y, (pixels>>6));
if (!--xsize)
return;
WriteDDPTBit1:
if (pixels&(3<<4))
SETPIXEL(x+1, y, (3&(pixels>>4)));
if (!--xsize)
return;
WriteDDPTBit2:
if (pixels&(3<<2))
SETPIXEL(x+2, y, (3&(pixels>>2)));
if (!--xsize)
return;
WriteDDPTBit3:
if (pixels&(3<<0))
SETPIXEL(x+3, y, (3&(pixels)));
if (!--xsize)
return;
pixels = *(++p);
x+=4;
goto WriteDDPTBit0;
}
}
#endif /* (LCD_MAX_LOG_COLORS > 2) */
/*
*****************************************
*
* Draw Bitmap 4 BPP
* no optimizations
*
*****************************************
*/
#if (LCD_MAX_LOG_COLORS > 4)
static void DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixels;
/*
// Jump to right entry point
*/
pixels = *p;
if (GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) {
if ((Diff&1) ==0)
goto WriteTBit0;
goto WriteTBit1;
} else {
if ((Diff&1) ==0)
goto WriteBit0;
goto WriteBit1;
}
/*
Write without transparency
*/
WriteBit0:
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteBit1:
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteBit0;
/*
Write with transparency
*/
WriteTBit0:
if (pixels>>4)
SETPIXEL(x+0, y, *(pTrans+(pixels>>4)));
if (!--xsize)
return;
WriteTBit1:
if (pixels&0xf)
SETPIXEL(x+1, y, *(pTrans+(pixels&0xf)));
if (!--xsize)
return;
x+=2;
pixels = *(++p);
goto WriteTBit0;
}
#endif /* (LCD_MAX_LOG_COLORS > 4) */
/*
*****************************************
*
* Draw Bitmap 8 BPP
* no optimizations
*
*****************************************
*/
#if (LCD_MAX_LOG_COLORS > 16)
static void DrawBitLine8BPP(int x, int y, U8 const*p, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX pixel;
if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS)==0) {
if (pTrans) {
for (;xsize > 0; xsize--,x++,p++) {
pixel = *p;
SETPIXEL(x, y, *(pTrans+pixel));
}
} else {
for (;xsize > 0; xsize--,x++,p++) {
SETPIXEL(x, y, *p);
}
}
} else { /* Handle transparent bitmap */
if (pTrans) {
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
SETPIXEL(x+0, y, *(pTrans+pixel));
}
}
} else {
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
SETPIXEL(x+0, y, pixel);
}
}
}
}
}
#endif /* (LCD_MAX_LOG_COLORS > 16) */
/*
*********************************************************
*
* Exported, but not currently supported
*
*********************************************************
*/
/*
*****************************************
*
* LCD_L0_SetLUTEntry
*
*****************************************
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR Color) {
Pos = Pos;
Color = Color;
}
/*
*********************************************************
*
* Exported routines
*
*********************************************************
*/
/*
*****************************************
*
* LCD_L0_On
*
*****************************************
*/
void LCD_L0_On(void) {
LCD_WRITECMD0(0xaf);
}
/*
*****************************************
*
* LCD_L0_Off
*
*****************************************
*/
void LCD_L0_Off(void) {
LCD_WRITECMD0(0xae);
}
/*
*****************************************
*
* LCD_L0_XorPixel
*
*****************************************
*/
void LCD_L0_XorPixel(int x, int y) {
XORPIXEL(x, y);
}
/*
*****************************************
*
* LCD_L0_SetPixelIndex
*
*****************************************
*/
void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex) {
SETPIXEL(x, y, ColorIndex);
}
/*
*****************************************
*
* LCD_L0_GetPixelIndex
*
*****************************************
*/
unsigned int LCD_L0_GetPixelIndex(int x, int y) {
U8 ColorIndex = GETPIXEL(x, y);
return ColorIndex;
}
/*
*****************************************
*
* LCD_L0_DrawPixel
*
*****************************************
*/
void LCD_L0_DrawPixel(int x, int y) {
SETPIXEL(x, y, COLOR);
}
/*
*****************************************
*
* LCD_L0_DrawHLine
*
*****************************************
*/
void LCD_L0_DrawHLine (int x0, int y, int x1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
while (x0 <= x1) {
XORPIXEL(x0, y);
x0++;
}
} else {
while (x0 <= x1) {
SETPIXEL(x0, y, COLOR);
x0++;
}
}
}
/*
*****************************************
*
* LCD_L0_DrawVLine
*
*****************************************
*/
void LCD_L0_DrawVLine (int x, int y0, int y1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
while (y0 <= y1) {
XORPIXEL(x, y0);
y0++;
}
} else {
while (y0 <= y1) {
SETPIXEL(x, y0, COLOR);
y0++;
}
}
}
/*
*****************************************
*
* LCD_L0_FillRect
*
*****************************************
*/
void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
for (; y0 <= y1; y0++) {
LCD_L0_DrawHLine(x0, y0, x1);
}
}
/*
*****************************************
*
* LCD_L0_DrawBitmap
*
*****************************************
*/
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 DrawBitLineXBPP
*/
for (i=0; i<ysize; i++) {
switch (BitsPerPixel) {
case 1:
DrawBitLine1BPP(x0, i + y0, pData, Diff, xsize, pTrans);
break;
#if (LCD_MAX_LOG_COLORS > 2)
case 2:
DrawBitLine2BPP(x0, i + y0, pData, Diff, xsize, pTrans);
break;
#endif
#if (LCD_MAX_LOG_COLORS > 4)
case 4:
DrawBitLine4BPP(x0, i + y0, pData, Diff, xsize, pTrans);
break;
#endif
#if (LCD_MAX_LOG_COLORS > 16)
case 8:
DrawBitLine8BPP(x0, i + y0, pData, xsize, pTrans);
break;
#endif
}
pData += BytesPerLine;
}
}
/*
*****************************************
*
* LCD_L0_SetOrg
*
*****************************************
*/
int OrgX, OrgY;
void LCD_L0_SetOrg(int x, int y) {
OrgX = x;
OrgY = y;
}
/*
*****************************************
*
* LCD_L0_Init
*
*****************************************
*/
int LCD_L0_Init(void) {
GUI_DEBUG_LOG("\nLCD_Init()");
LCD_INIT_CONTROLLER();
/* set cursor to illegal value */
Page = Offset = 0xfff;
/* clear LCD */
{
int pg;
for (pg = 0; pg < ((LCD_YSIZE_PHYS + 3) >> 2); pg++) {
int x = LCD_XSIZE_PHYS;
WRITE_PAGE(pg);
WRITE_OFFSET(0);
while(x--) {
WRITE_DATA(0);
}
}
}
/* clear aVRam */
memset(aVRam, 0, sizeof(aVRam));
/* turn off */
LCD_Off();
return 0;
}
#else
void LCD15E05(void) { } /* avoid empty object files */
#endif /* LCD_COMPILE_DRIVER */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -