📄 guidemo_bitmap.c
字号:
/* RLE: 006 Pixels @ 106,122*/ 6, 0x01,
/* RLE: 096 Pixels @ 112,122*/ 96, 0x00,
/* RLE: 010 Pixels @ 048,123*/ 10, 0x01,
/* RLE: 014 Pixels @ 058,123*/ 14, 0x00,
/* RLE: 014 Pixels @ 072,123*/ 14, 0x01,
/* RLE: 020 Pixels @ 086,123*/ 20, 0x02,
/* RLE: 007 Pixels @ 106,123*/ 7, 0x01,
/* RLE: 095 Pixels @ 113,123*/ 95, 0x00,
/* RLE: 009 Pixels @ 048,124*/ 9, 0x01,
/* RLE: 014 Pixels @ 057,124*/ 14, 0x00,
/* RLE: 019 Pixels @ 071,124*/ 19, 0x01,
/* RLE: 014 Pixels @ 090,124*/ 14, 0x02,
/* RLE: 009 Pixels @ 104,124*/ 9, 0x01,
/* RLE: 096 Pixels @ 113,124*/ 96, 0x00,
/* RLE: 008 Pixels @ 049,125*/ 8, 0x01,
/* RLE: 012 Pixels @ 057,125*/ 12, 0x00,
/* RLE: 025 Pixels @ 069,125*/ 25, 0x01,
/* RLE: 007 Pixels @ 094,125*/ 7, 0x02,
/* RLE: 012 Pixels @ 101,125*/ 12, 0x01,
/* RLE: 095 Pixels @ 113,125*/ 95, 0x00,
/* RLE: 008 Pixels @ 048,126*/ 8, 0x01,
/* RLE: 012 Pixels @ 056,126*/ 12, 0x00,
/* RLE: 045 Pixels @ 068,126*/ 45, 0x01,
/* RLE: 093 Pixels @ 113,126*/ 93, 0x00,
/* RLE: 010 Pixels @ 046,127*/ 10, 0x01,
/* RLE: 012 Pixels @ 056,127*/ 12, 0x00,
/* RLE: 044 Pixels @ 068,127*/ 44, 0x01,
/* RLE: 092 Pixels @ 112,127*/ 92, 0x00,
/* RLE: 013 Pixels @ 044,128*/ 13, 0x01,
/* RLE: 010 Pixels @ 057,128*/ 10, 0x00,
/* RLE: 044 Pixels @ 067,128*/ 44, 0x01,
/* RLE: 093 Pixels @ 111,128*/ 93, 0x00,
/* RLE: 013 Pixels @ 044,129*/ 13, 0x01,
/* RLE: 009 Pixels @ 057,129*/ 9, 0x00,
/* RLE: 018 Pixels @ 066,129*/ 18, 0x01,
/* RLE: 004 Pixels @ 084,129*/ 4, 0x00,
/* RLE: 020 Pixels @ 088,129*/ 20, 0x01,
/* RLE: 097 Pixels @ 108,129*/ 97, 0x00,
/* RLE: 013 Pixels @ 045,130*/ 13, 0x01,
/* RLE: 008 Pixels @ 058,130*/ 8, 0x00,
/* RLE: 013 Pixels @ 066,130*/ 13, 0x01,
/* RLE: 014 Pixels @ 079,130*/ 14, 0x00,
/* RLE: 010 Pixels @ 093,130*/ 10, 0x01,
/* RLE: 102 Pixels @ 103,130*/ 102, 0x00,
/* RLE: 013 Pixels @ 045,131*/ 13, 0x01,
/* RLE: 007 Pixels @ 058,131*/ 7, 0x00,
/* RLE: 011 Pixels @ 065,131*/ 11, 0x01,
/* RLE: 130 Pixels @ 076,131*/ 130, 0x00,
/* RLE: 013 Pixels @ 046,132*/ 13, 0x01,
/* RLE: 006 Pixels @ 059,132*/ 6, 0x00,
/* RLE: 010 Pixels @ 065,132*/ 10, 0x01,
/* RLE: 132 Pixels @ 075,132*/ 132, 0x00,
/* RLE: 013 Pixels @ 047,133*/ 13, 0x01,
/* RLE: 005 Pixels @ 060,133*/ 5, 0x00,
/* RLE: 009 Pixels @ 065,133*/ 9, 0x01,
/* RLE: 134 Pixels @ 074,133*/ 134, 0x00,
/* RLE: 013 Pixels @ 048,134*/ 13, 0x01,
/* RLE: 004 Pixels @ 061,134*/ 4, 0x00,
/* RLE: 008 Pixels @ 065,134*/ 8, 0x01,
/* RLE: 141 Pixels @ 073,134*/ 141, 0x00,
/* RLE: 008 Pixels @ 054,135*/ 8, 0x01,
/* RLE: 003 Pixels @ 062,135*/ 3, 0x00,
/* RLE: 007 Pixels @ 065,135*/ 7, 0x01,
/* RLE: 143 Pixels @ 072,135*/ 143, 0x00,
/* RLE: 008 Pixels @ 055,136*/ 8, 0x01,
/* ABS: 002 Pixels @ 063,136*/ 0, 2, 0x00,
/* RLE: 007 Pixels @ 065,136*/ 7, 0x01,
/* RLE: 144 Pixels @ 072,136*/ 144, 0x00,
/* RLE: 008 Pixels @ 056,137*/ 8, 0x01,
/* RLE: 001 Pixels @ 064,137*/ 1, 0x00,
/* RLE: 007 Pixels @ 065,137*/ 7, 0x01,
/* RLE: 145 Pixels @ 072,137*/ 145, 0x00,
/* RLE: 007 Pixels @ 057,138*/ 7, 0x01,
/* RLE: 001 Pixels @ 064,138*/ 1, 0x00,
/* RLE: 008 Pixels @ 065,138*/ 8, 0x01,
/* RLE: 144 Pixels @ 073,138*/ 144, 0x00,
/* RLE: 008 Pixels @ 057,139*/ 8, 0x01,
/* RLE: 001 Pixels @ 065,139*/ 1, 0x00,
/* RLE: 007 Pixels @ 066,139*/ 7, 0x01,
/* RLE: 145 Pixels @ 073,139*/ 145, 0x00,
/* RLE: 007 Pixels @ 058,140*/ 7, 0x01,
/* RLE: 001 Pixels @ 065,140*/ 1, 0x00,
/* RLE: 008 Pixels @ 066,140*/ 8, 0x01,
/* RLE: 144 Pixels @ 074,140*/ 144, 0x00,
/* RLE: 007 Pixels @ 058,141*/ 7, 0x01,
/* ABS: 002 Pixels @ 065,141*/ 0, 2, 0x00,
/* RLE: 008 Pixels @ 067,141*/ 8, 0x01,
/* RLE: 144 Pixels @ 075,141*/ 144, 0x00,
/* RLE: 006 Pixels @ 059,142*/ 6, 0x01,
/* RLE: 003 Pixels @ 065,142*/ 3, 0x00,
/* RLE: 008 Pixels @ 068,142*/ 8, 0x01,
/* RLE: 142 Pixels @ 076,142*/ 142, 0x00,
/* RLE: 007 Pixels @ 058,143*/ 7, 0x01,
/* RLE: 004 Pixels @ 065,143*/ 4, 0x00,
/* RLE: 008 Pixels @ 069,143*/ 8, 0x01,
/* RLE: 139 Pixels @ 077,143*/ 139, 0x00,
/* RLE: 010 Pixels @ 056,144*/ 10, 0x01,
/* RLE: 004 Pixels @ 066,144*/ 4, 0x00,
/* RLE: 008 Pixels @ 070,144*/ 8, 0x01,
/* RLE: 136 Pixels @ 078,144*/ 136, 0x00,
/* RLE: 012 Pixels @ 054,145*/ 12, 0x01,
/* RLE: 005 Pixels @ 066,145*/ 5, 0x00,
/* RLE: 008 Pixels @ 071,145*/ 8, 0x01,
/* RLE: 135 Pixels @ 079,145*/ 135, 0x00,
/* RLE: 011 Pixels @ 054,146*/ 11, 0x01,
/* RLE: 007 Pixels @ 065,146*/ 7, 0x00,
/* RLE: 007 Pixels @ 072,146*/ 7, 0x01,
/* RLE: 136 Pixels @ 079,146*/ 136, 0x00,
/* RLE: 010 Pixels @ 055,147*/ 10, 0x01,
/* RLE: 007 Pixels @ 065,147*/ 7, 0x00,
/* RLE: 008 Pixels @ 072,147*/ 8, 0x01,
/* RLE: 135 Pixels @ 080,147*/ 135, 0x00,
/* RLE: 010 Pixels @ 055,148*/ 10, 0x01,
/* RLE: 008 Pixels @ 065,148*/ 8, 0x00,
/* RLE: 007 Pixels @ 073,148*/ 7, 0x01,
/* RLE: 136 Pixels @ 080,148*/ 136, 0x00,
/* RLE: 009 Pixels @ 056,149*/ 9, 0x01,
/* RLE: 009 Pixels @ 065,149*/ 9, 0x00,
/* RLE: 007 Pixels @ 074,149*/ 7, 0x01,
/* RLE: 136 Pixels @ 081,149*/ 136, 0x00,
/* RLE: 007 Pixels @ 057,150*/ 7, 0x01,
/* RLE: 010 Pixels @ 064,150*/ 10, 0x00,
/* RLE: 007 Pixels @ 074,150*/ 7, 0x01,
/* RLE: 137 Pixels @ 081,150*/ 137, 0x00,
/* RLE: 005 Pixels @ 058,151*/ 5, 0x01,
/* RLE: 012 Pixels @ 063,151*/ 12, 0x00,
/* RLE: 006 Pixels @ 075,151*/ 6, 0x01,
/* RLE: 154 Pixels @ 081,151*/ 154, 0x00,
/* RLE: 006 Pixels @ 075,152*/ 6, 0x01,
/* RLE: 153 Pixels @ 081,152*/ 153, 0x00,
/* RLE: 008 Pixels @ 074,153*/ 8, 0x01,
/* RLE: 148 Pixels @ 082,153*/ 148, 0x00,
/* RLE: 012 Pixels @ 070,154*/ 12, 0x01,
/* RLE: 148 Pixels @ 082,154*/ 148, 0x00,
/* RLE: 012 Pixels @ 070,155*/ 12, 0x01,
/* RLE: 148 Pixels @ 082,155*/ 148, 0x00,
/* RLE: 011 Pixels @ 070,156*/ 11, 0x01,
/* RLE: 150 Pixels @ 081,156*/ 150, 0x00,
/* RLE: 010 Pixels @ 071,157*/ 10, 0x01,
/* RLE: 150 Pixels @ 081,157*/ 150, 0x00,
/* RLE: 010 Pixels @ 071,158*/ 10, 0x01,
/* RLE: 151 Pixels @ 081,158*/ 151, 0x00,
/* RLE: 008 Pixels @ 072,159*/ 8, 0x01,
/* RLE: 153 Pixels @ 080,159*/ 153, 0x00,
/* RLE: 006 Pixels @ 073,160*/ 6, 0x01,
/* RLE: 081 Pixels @ 079,160*/ 81, 0x00,
0
}; /* 1927 for 25760 pixels */
static const GUI_BITMAP _bmLadyBug = {
160, /* XSize */
161, /* YSize */
40, /* BytesPerLine */
GUI_COMPRESS_RLE4, /* BitsPerPixel */
_acLadyBug, /* Pointer to picture data (indices) */
&_PalLadyBug /* Pointer to palette */
,GUI_DRAW_RLE4
};
/*********************************************************************
*
* GUIDEMO_Bitmap
*
**********************************************************************
*/
void GUIDEMO_Bitmap(void) {
int XSize = LCD_GetXSize();
int YSize = LCD_GetYSize();
GUIDEMO_ShowIntro("Bitmaps",
"Showing"
"\ndifferent bitmaps with"
"\nand without compression");
GUI_SetBkColor(GUI_BLUE);
GUI_Clear();
#if GUI_WINSUPPORT & GUI_SUPPORT_MEMDEV
WM_EnableMemdev(WM_HBKWIN);
#endif
#if GUIDEMO_LARGE
GUI_DrawBitmap(&_bmLadyBug, 20, 50);
GUI_SetFont(&GUI_Font13_1);
GUI_DispStringAt("RLE Compressed bitmaps", 10, 10);
GUIDEMO_Wait();
GUI_Clear();
GUI_DispStringAt("1/2/4/8 bpp bitmaps", 10, 10);
GUI_DrawBitmap(&GUIDEMO_bm4bpp, 20, 50);
GUIDEMO_Delay(4000);
GUIDEMO_NotifyStartNext();
/* Tile display with image */
{
int ix, iy;
for (ix = 0; ix < XSize / GUIDEMO_bm4bpp.XSize + 1; ix++) {
for (iy = 0; iy < YSize / GUIDEMO_bm4bpp.YSize + 1; iy++) {
GUI_DrawBitmap(&GUIDEMO_bm4bpp,
GUIDEMO_bm4bpp.XSize * ix ,
GUIDEMO_bm4bpp.YSize * iy);
}
}
}
GUIDEMO_Delay(2000);
GUIDEMO_NotifyStartNext();
GUIDEMO_ShowInfo("Bitmaps may also be\nmagnified and rotated");
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(&GUI_Font16_1);
{
int i, tm;
double xMul, Angle;
for (i = 200; (i < 3000) && !GUIDEMO_CheckCancel();) {
tm = GUI_GetTime();
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, i, i);
GUI_DispStringHCenterAt("Bitmaps can be magnified...", XSize / 2, 100);
GUI_Exec();
while ((GUI_GetTime() < (tm + 10)) && !GUIDEMO_CheckCancel());
i += (GUI_GetTime() - tm) * 6;
}
GUIDEMO_Delay(2000);
GUIDEMO_NotifyStartNext();
GUI_Clear();
GUI_DispStringHCenterAt("...and rotated.", XSize / 2, ((YSize + GUIDEMO_bm4bpp.YSize) >> 1) + 5);
for (Angle = 0; Angle < PI4 && !GUIDEMO_CheckCancel();) {
tm = GUI_GetTime();
xMul = cos(Angle) * 1000;
GUI_ClearRect((XSize - GUIDEMO_bm4bpp.XSize) >> 1, (YSize - GUIDEMO_bm4bpp.YSize) >> 1, (XSize + GUIDEMO_bm4bpp.XSize) >> 1, (YSize + GUIDEMO_bm4bpp.YSize) >> 1);
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, xMul, 1000);
GUI_Exec();
while ((GUI_GetTime() < (tm + 10)) && !GUIDEMO_CheckCancel());
Angle += (GUI_GetTime() - tm) / 250.0f;
}
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, 1000, 1000);
}
GUIDEMO_Wait();
#else
{
const GUI_BITMAP * pBm;
int TextModeOld = GUI_SetTextMode(GUI_TM_XOR);
GUI_SetFont(&GUI_Font8_ASCII);
pBm = &_bmLadyBug;
GUI_DrawBitmap(pBm, (XSize - (int)pBm->XSize) / 2, (YSize - (int)pBm->YSize) / 2);
GUI_DispStringAt("RLE Compressed bitmaps", 8, 10);
GUIDEMO_Wait();
GUI_Clear();
GUI_SetTextMode(GUI_TM_TRANS);
pBm = &GUIDEMO_bm4bpp;
GUI_DrawBitmap(pBm, (XSize - (int)pBm->XSize) / 2, (YSize - (int)pBm->YSize) / 2);
GUI_DispStringAt("1/2/4/8 bpp bitmaps", 8, 10);
GUIDEMO_Wait();
GUI_Clear();
{
int i, tm;
double xMul, Angle;
for (i = 200; (i < 2000) && !GUIDEMO_CheckCancel();) {
tm = GUI_GetTime();
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, i, i);
GUI_DispStringAt("Bitmaps can be magnified...", 8, 10);
GUI_Exec();
while ((GUI_GetTime() < (tm + 10)) && !GUIDEMO_CheckCancel());
i += (GUI_GetTime() - tm) * 6;
}
GUIDEMO_Delay(2000);
GUIDEMO_NotifyStartNext();
GUI_Clear();
for (Angle = 0; Angle < PI4 && !GUIDEMO_CheckCancel();) {
tm = GUI_GetTime();
xMul = cos(Angle) * 1000;
GUI_ClearRect((XSize - GUIDEMO_bm4bpp.XSize) >> 1, (YSize - GUIDEMO_bm4bpp.YSize) >> 1, (XSize + GUIDEMO_bm4bpp.XSize) >> 1, (YSize + GUIDEMO_bm4bpp.YSize) >> 1);
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, xMul, 1000);
GUI_DispStringAt("...and rotated.", 8, 10);
GUI_Exec();
while ((GUI_GetTime() < (tm + 10)) && !GUIDEMO_CheckCancel());
Angle += (GUI_GetTime() - tm) / 250.0f;
}
GUI_DrawBitmapEx(&GUIDEMO_bm4bpp, XSize / 2, YSize / 2, GUIDEMO_bm4bpp.XSize / 2, GUIDEMO_bm4bpp.YSize / 2, 1000, 1000);
GUI_DispStringAt("...and rotated.", 8, 10);
}
GUIDEMO_Wait();
GUI_SetTextMode(TextModeOld);
}
#endif
#if GUI_WINSUPPORT & GUI_SUPPORT_MEMDEV
WM_DisableMemdev(WM_HBKWIN);
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -