📄 lcdwin.c
字号:
}
}
#endif
/*********************************************************************
*
* _DrawBitLine8BPP
*/
#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
/*********************************************************************
*
* _DrawBitLine16BPP
*/
#if (LCD_BITSPERPIXEL > 8)
static void _DrawBitLine16BPP(int x, int y, U16 const * p, int xsize) {
LCD_PIXELINDEX pixel;
if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
for (;xsize > 0; xsize--,x++,p++) {
SETPIXEL(x, y, *p);
}
} else { /* Handle transparent bitmap */
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
SETPIXEL(x + 0, y, pixel);
}
}
}
}
#endif
/*********************************************************************
*
* _DrawBitLine24BPP
*/
#if (LCD_BITSPERPIXEL > 16)
static void _DrawBitLine24BPP(int x, int y, U32 const * p, int xsize) {
LCD_PIXELINDEX pixel;
if ((GUI_Context.DrawMode & LCD_DRAWMODE_TRANS) == 0) {
for (;xsize > 0; xsize--, x++, p++) {
SETPIXEL(x, y, *p);
}
} else { /* Handle transparent bitmap */
for (; xsize > 0; xsize--, x++, p++) {
pixel = *p;
if (pixel) {
SETPIXEL(x+0, y, pixel);
}
}
}
}
#endif
/*********************************************************************
*
* Exported code
*
**********************************************************************
*/
/*********************************************************************
*
* LCD_L0_DrawPixel
*
* Purpose: Writes 1 pixel into the display.
*/
void LCD_L0_DrawPixel(int x, int y) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
XORPIXEL(x, y);
} else {
SETPIXEL(x, y, LCD_COLORINDEX);
}
}
/*********************************************************************
*
* LCD_L0_DrawHLine
*/
void LCD_L0_DrawHLine(int x0, int y, int x1) {
if (GUI_Context.DrawMode & LCD_DRAWMODE_XOR) {
for (;x0 <= x1; x0++) {
XORPIXEL(x0, y);
}
} else {
for (;x0 <= x1; x0++) {
SETPIXEL(x0, y, LCD_COLORINDEX);
}
}
}
/*********************************************************************
*
* 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, LCD_COLORINDEX);
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
#if (LCD_BITSPERPIXEL > 8)
case 16:
_DrawBitLine16BPP(x0, i + y0, (const U16 *)pData, xsize);
break;
#endif
#if (LCD_BITSPERPIXEL > 16)
case 24:
_DrawBitLine24BPP(x0, i + y0, (const U32 *)pData, xsize);
break;
#endif
}
pData += BytesPerLine;
}
}
/*********************************************************************
*
* LCD_L0_SetOrg
*
* Purpose:
* Sets the original position of the virtual display.
* Has no function at this point with the PC-driver.
*/
void LCD_L0_SetOrg(int x, int y) {
LCDSIM_SetOrg(x, y, LCD_DISPLAY_INDEX);
}
/*********************************************************************
*
* Support for verification
*
* Purpose:
* The following routines are implemented, but have no functionility
* at this point. The reason is that these functions are supposed
* to supervise the hardware, which for obvious reasons can not be
* done in a simulation.
*/
#if LCD_VERIFY
int LCD_GetErrStat(void) {
return 0;
}
void LCD_ClrErrStat(void) {
}
int LCD_GetErrCnt (void) {
return 0;
}
#endif
/*********************************************************************
*
* LCD_On
* LCD_Off
*
* (Not supported in Simulation)
*/
void LCD_Off (void) {}
void LCD_On (void) {}
/*********************************************************************
*
* LCD_L0_SetLUTEntry
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {
LCDSIM_SetLUTEntry(Pos, color, LCD_DISPLAY_INDEX);
}
/*********************************************************************
*
* LCD_L0_Init
*/
int LCD_L0_Init(void) {
return 0;
}
int LCD_L0_CheckInit(void) {
return 0;
}
/*********************************************************************
*
* LCD_L0_ReInit
*
* Purpose:
* This routine is supplied for compatibility and interchangability of
* "C"-sources with embedded versions of the driver. It has no real
* effect in the PC-version as there is simply no need to re-initialize
* the LCD since it is just simulated anyhow.
*/
void LCD_L0_ReInit (void) {}
unsigned LCD_L0_GetPixelIndex(int x, int y) {
return LCDSIM_GetPixelIndex(x,y, LCD_DISPLAY_INDEX);
}
/*********************************************************************
*
* LCD_L0_XorPixel
*
* Purpose:
* Inverts 1 pixel of the display.
*/
void LCD_L0_XorPixel(int x, int y) {
XORPIXEL(x, y);
}
/*********************************************************************
*
* LCD_L0_SetPixelIndex
*
* Purpose:
* Writes 1 pixel into the display.
*/
void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex) {
SETPIXEL(x, y, ColorIndex);
}
/*********************************************************************
*
* LCD_L0_GetDevFunc
*/
void * LCD_L0_GetDevFunc(int Index) {
GUI_USE_PARA(Index);
return NULL;
}
#else
void LCDWin_c(void);
void LCDWin_c(void) { } /* avoid empty object files */
#endif /* defined(WIN32) && defined(LCD_USE_WINSIM) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -