lcd44b0.c

来自「开发环境:ADS 1.2 目标平台:ARM:S3C44B0 显示屏:tft」· C语言 代码 · 共 763 行 · 第 1/2 页

C
763
字号
      		RemPixels--;      		Pixels <<=1;      		x++;    	} while (--xsize);  	}}/*    *********************************************    *                                           *    *      Draw Bitmap 2 BPP                    *    *                                           *    **********************************************/#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 (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;}#endif/*    *********************************************    *                                           *    *      Draw Bitmap 4 BPP                    *    *                                           *    **********************************************/#if (LCD_MAX_LOG_COLORS > 4)static void  DrawBitLine4BPP(int x, int y, U8 const*p, int Diff, int xsize, const LCD_PIXELINDEX*pTrans) {  U8 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/*    *********************************************    *                                           *    *      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 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/*    *********************************************    *                                           *    *      Draw Bitmap 8 BPP  (256 colors)      *    *                                           *    **********************************************/#if (LCD_MAX_LOG_COLORS > 256)static void  DrawBitLine16BPP(int x, int y, U16 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/***********************************************************                                                       **         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;  	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_MAX_LOG_COLORS > 256)                case 16:                    DrawBitLine16BPP(x0, i+y0, (U16*)pData, xsize, pTrans);                    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.*/int OrgX, OrgY;void LCD_L0_SetOrg(int x, int y) {  	OrgX = x;  	OrgY = y;}/***********************************************************                                                       **       LCD_On                                          **       LCD_Off                                         **                                                       ***********************************************************/void LCD_Off          (void) {	Delay(100);    Delay(100);}void LCD_On           (void) {	Delay(100);    Delay(100);}void LCD_Init_Controler() {InitLCD();}unsigned int LCD_L0_GetPixelIndex(int x, int y) {  	return GetPixelIndex(x,y);}/***********************************************************                                                       **                   LCD_L0_SetLUTEntry                  **                                                       ***********************************************************/void LCD_L0_SetLUTEntry(U8 Pos, LCD_COLOR color) {}/***********************************************************                                                       **       LCD_L0_ReInit : Re-Init the display             **                                                       **********************************************************ReInit contains all of the code that can be re-executed at any point withoutchanging or even disturbing what can be seen on the LCD.Note that it is also used as a subroutine by LCD_Init().*/void  LCD_L0_ReInit(void) {  	LCD_Init_Controler();                     /* macro defined in config */}/***********************************************************                                                       **       LCD_Init : Init the display                     **                                                       ***********************************************************/int LCD_L0_Init(void) {    GUI_DEBUG_LOG("\nLCD_Init()");    /* Init controllers (except lookup table) */    LCD_L0_ReInit();    LCD_Off();    return 0;    /* Init successfull ! */}/***********************************************************                                                       **       LCD_L0_CheckInit                                **                                                       **  Check if display controller(s) is/are still          **  properly initialized                                 **                                                       **********************************************************Return value:	0 => No error, init is O.K.*/int LCD_L0_CheckInit(void) {    return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?