📄 ks0108.c
字号:
/* 逐点显示,描出水平线 */
/*==========================*/
do
{
GUI_Point(x0, y0, color);
x0++;
}while(x1>=x0);
/*==========================*/
}
/******************************************************************************************************************
* 函数名称:GUI_RLine()
* 功 能:在LCM12864的显示缓冲区画竖直线。
* 入口参数:x0 垂直线起点所在列的位置
* y0 垂直线起点所在行的位置
* y1 垂直线终点所在行的位置
* color 对于黑白色或蓝白色LCM12864,为0时灭,为1时显示
* 出口参数:无
/*******************************************************************************************************************/
void GUI_RLine(u8 x0, u8 y0, u8 y1, u8 color)
{
u8 bak;
if(y0>y1){bak = y1;y1 = y0;y0 = bak;} // 对y0、y1大小进行排列,以便画图
/* 逐点显示,描出竖直线 */
/*==========================*/
do
{
GUI_Point(x0, y0, color);
y0++;
}while(y1>=y0);
/*==========================*/
}
/******************************************************************************************************************
//接口函数
//接口函数
//接口函数
//接口函数
//接口函数
/******************************************************************************************************************/
static PIXELCOLOR GetPixel(int x, int y) {
U8 Mask;
Mask=1<<(y&7);
return (LCM12864_DisplayBuffer[y>>3][x]&Mask) ? 1 : 0;
}
/******************************************************************************************************************
//接口函数
//接口函数
//接口函数
//接口函数
//接口函数
/******************************************************************************************************************/
void LCD_L0_SetPixelIndex(int x, int y, int ColorIndex) {
GUI_Point(x,y,ColorIndex);
}
/******************************************************************************************************************
//接口函数
//接口函数
//接口函数
//接口函数
//接口函数
/******************************************************************************************************************/
static void XorPixel(int x, int y) {
u8 Index;
Index = GetPixel(x,y);
GUI_Point(x,y, LCD_NUM_COLORS-1-Index);
}
/******************************************************************************************************************
//接口函数
//接口函数
//接口函数
//接口函数
//接口函数
/******************************************************************************************************************/
void LCD_L0_XorPixel(int x, int y) {
XorPixel(x, y);
}
/******************************************************************************************************************
//接口函数
//接口函数
//接口函数
//接口函数
//接口函数
/******************************************************************************************************************/
/*
*********************************************************
* *
* LCD_L0_DrawHLine optimized *
* *
* 16 bit bus, Using BITBLT *
* *
*********************************************************
*/
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)
{
GUI_Point(x0, y, COLOR);
x0++;
}
}
}
/*
*********************************************************
* *
* LCD_L0_DrawVLine optimized *
* *
* 16 bit bus, using BITBLT *
* *
*********************************************************
*/
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) {
GUI_Point(x, y0, COLOR);
y0++;
}
}
}
/*
*********************************************************
* *
* LCD_FillRect *
* *
*********************************************************
*/
void LCD_L0_FillRect(int x0, int y0, int x1, int y1) {
#if !LCD_SWAP_XY
for (; y0 <= y1; y0++) {
LCD_L0_DrawHLine(x0,y0, x1);
}
#else
for (; x0 <= x1; x0++) {
LCD_L0_DrawVLine(x0,y0, y1);
}
#endif
}
/*
*********************************************************
* *
* LCD_L0_SetLUTEntry *
* *
*********************************************************
*/
void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {
}
/*
*********************************************************
* *
* LCD_Init : Init the display *
* *
*********************************************************
*/
int LCD_L0_Init(void) {
GUI_ClearScreen();
}
/*
*********************************************
* *
* Draw Bitmap 1 BPP *
* *
*********************************************
/************************************************************/
static void DrawBitLine1BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {
LCD_PIXELINDEX Index0 = *(pTrans+0);
LCD_PIXELINDEX Index1 = *(pTrans+1);
x+=Diff;
/*
// Jump to right entry point
*/
switch (GUI_Context.DrawMode & (LCD_DRAWMODE_TRANS|LCD_DRAWMODE_XOR)) {
case 0: /* Write mode */
do {
LCD_L0_SetPixelIndex(x++,y, (*p & (0x80>>Diff)) ? Index1 : Index0);
if (++Diff==8) {
Diff=0;
p++;
}
} while (--xsize);
break;
case LCD_DRAWMODE_TRANS:
do {
if (*p & (0x80>>Diff))
LCD_L0_SetPixelIndex(x,y, Index1);
x++;
if (++Diff==8) {
Diff=0;
p++;
}
} while (--xsize);
break;
case LCD_DRAWMODE_XOR:;
do {
if (*p & (0x80>>Diff)) {
int Pixel = GetPixel(x,y);
LCD_L0_SetPixelIndex(x,y, LCD_NUM_COLORS-1-Pixel);
}
x++;
if (++Diff==8) {
Diff=0;
p++;
}
} while (--xsize);
break;
}
}
/*
*********************************************************
* *
* Universal draw Bitmap routine *
* *
*********************************************************
*/
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;
}
pData += BytesPerLine;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -