I have many alpha images. For example:
Display All
Every pixel is descripted as a single byte that represents the "quantity" of the image respect the background. Of course, the content of those images is only the shape.
I draw alpha images with GUI_SetColor(), that selects the color of the shape, and GUI_DrawBitmap() that really draws the bitmap on the screen. It works very well during the simulation at the PC, and it seems working well on the embedded target when the background is dark (black) or blue (GUI_BLUE). When the background is light (GUI_RED or GUI_GREEN) the alpha blending doesn't work well. The shape isn't smooth. I don't know if it is correct, I think the real color used are calculated if the background was always black.
My driver is GUIDRV_FLEXCOLOR_F66709. Here it is the initialization.
Display All
So I don't use cache (and I can't use cache for RAM restrictions). So I think emWin is forced to read back the color of pixels during drawing of an alpha image. One cause of my problem could be a wrong read back. For example, the behaviour I observed can be explined if the driver reads back always zero (black colors). So the alpha drawing works (or appears good) when the background is black or dark.
How could I check if this is correct? I know ILI9341 supports read back.
C Source Code
- static GUI_CONST_STORAGE unsigned char acopen[] = {
- /* ABS: 005 Pixels @ 000,000*/ 0, 5, 0xFF, 0xF4, 0xC5, 0x51, 0x02,
- /* RLE: 011 Pixels @ 005,000*/ 11, 0x00,
- /* ABS: 009 Pixels @ 016,000*/ 0, 9, 0x15, 0x7A, 0xEE, 0x74, 0x04, 0x5D, 0xD3, 0xDA, 0x6B,
- /* RLE: 010 Pixels @ 006,001*/ 10, 0x47,
- /* ABS: 009 Pixels @ 016,001*/ 0, 9, 0x32, 0x00, 0x7B, 0x0D, 0x00, 0x00, 0x01, 0x4C, 0xC4,
- /* RLE: 011 Pixels @ 006,002*/ 11, 0xFF,
- /* ABS: 002 Pixels @ 017,002*/ 0, 2, 0x32, 0x16,
- /* RLE: 006 Pixels @ 000,003*/ 6, 0x00,
- /* ABS: 003 Pixels @ 006,003*/ 0, 3, 0x3B, 0xB3, 0xFE,
- /* RLE: 008 Pixels @ 009,003*/ 8, 0xFF,
- /* RLE: 001 Pixels @ 017,003*/ 1, 0x47,
- /* RLE: 009 Pixels @ 018,003*/ 9, 0x00,
- /* ABS: 002 Pixels @ 008,004*/ 0, 2, 0x2C, 0xA4,
- /* RLE: 007 Pixels @ 010,004*/ 7, 0xFF,
- /* RLE: 001 Pixels @ 017,004*/ 1, 0x47,
- /* RLE: 011 Pixels @ 018,004*/ 11, 0x00,
- /* RLE: 001 Pixels @ 010,005*/ 1, 0x9E,
- /* RLE: 006 Pixels @ 011,005*/ 6, 0xFF,
- /* RLE: 001 Pixels @ 017,005*/ 1, 0x47,
- /* RLE: 011 Pixels @ 018,005*/ 11, 0x00,
- /* ABS: 002 Pixels @ 010,006*/ 0, 2, 0x0F, 0xFD,
- /* RLE: 005 Pixels @ 012,006*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,006*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,006*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,007*/ 1, 0xD4,
- /* RLE: 005 Pixels @ 012,007*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,007*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,007*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,008*/ 1, 0xB8,
- /* RLE: 005 Pixels @ 012,008*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,008*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,008*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,009*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,009*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,009*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,009*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,010*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,010*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,010*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,010*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,011*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,011*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,011*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,011*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,012*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,012*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,012*/ 1, 0x47,
- /* RLE: 009 Pixels @ 018,012*/ 9, 0x00,
- /* ABS: 004 Pixels @ 008,013*/ 0, 4, 0x4E, 0x00, 0x00, 0xB7,
- /* RLE: 005 Pixels @ 012,013*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,013*/ 1, 0x47,
- /* RLE: 008 Pixels @ 018,013*/ 8, 0x00,
- /* ABS: 005 Pixels @ 007,014*/ 0, 5, 0x44, 0xFF, 0x3A, 0x00, 0xB7,
- /* RLE: 005 Pixels @ 012,014*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,014*/ 1, 0x47,
- /* RLE: 008 Pixels @ 018,014*/ 8, 0x00,
- /* ABS: 005 Pixels @ 007,015*/ 0, 5, 0x3D, 0xFF, 0x4A, 0x00, 0xB7,
- /* RLE: 005 Pixels @ 012,015*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,015*/ 1, 0x47,
- /* RLE: 009 Pixels @ 018,015*/ 9, 0x00,
- /* ABS: 004 Pixels @ 008,016*/ 0, 4, 0x5F, 0x03, 0x00, 0xB7,
- /* RLE: 005 Pixels @ 012,016*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,016*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,016*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,017*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,017*/ 5, 0xFF,
- /* RLE: 001 Pixels @ 017,017*/ 1, 0x47,
- /* RLE: 012 Pixels @ 018,017*/ 12, 0x00,
- /* RLE: 001 Pixels @ 011,018*/ 1, 0xB7,
- /* RLE: 005 Pixels @ 012,018*/ 5, 0xFF,
- /* ABS: 003 Pixels @ 017,018*/ 0, 3, 0x47, 0x00, 0x24,
- /* RLE: 010 Pixels @ 001,019*/ 10, 0x00,
- /* ABS: 009 Pixels @ 011,019*/ 0, 9, 0xB7, 0xEA, 0xE7, 0xE7, 0xE7, 0xD2, 0x19, 0x36, 0x65,
- /* RLE: 010 Pixels @ 001,020*/ 10, 0x00,
- /* ABS: 002 Pixels @ 011,020*/ 0, 2, 0xB7, 0x17,
- /* RLE: 004 Pixels @ 013,020*/ 4, 0x00,
- /* ABS: 004 Pixels @ 017,020*/ 0, 4, 0x01, 0xA7, 0xEA, 0x1E,
- /* RLE: 009 Pixels @ 002,021*/ 9, 0x00,
- /* ABS: 012 Pixels @ 011,021*/ 0, 12, 0xB7, 0x6E, 0x5F, 0x5F, 0x5F, 0x75, 0xD8, 0xFF, 0xFF, 0xE0, 0x68, 0x08,
- /* RLE: 007 Pixels @ 004,022*/ 7, 0x00,
- /* RLE: 001 Pixels @ 011,022*/ 1, 0xB7,
- /* RLE: 010 Pixels @ 012,022*/ 10, 0xFF,
- /* ABS: 003 Pixels @ 003,023*/ 0, 3, 0xE8, 0x7A, 0x10,
- /* RLE: 005 Pixels @ 006,023*/ 5, 0x00,
- /* RLE: 001 Pixels @ 011,023*/ 1, 0xB7,
- /* RLE: 012 Pixels @ 012,023*/ 12, 0xFF,
- /* ABS: 007 Pixels @ 005,024*/ 0, 7, 0xF2, 0x8C, 0x1B, 0x00, 0x00, 0x00, 0xC7,
- /* RLE: 014 Pixels @ 012,024*/ 14, 0xFF,
- /* ABS: 005 Pixels @ 007,025*/ 0, 5, 0xF9, 0x9E, 0x2F, 0x3E, 0xFE,
- /* RLE: 007 Pixels @ 012,025*/ 7, 0xFF,
- 0}; /* 275 bytes for 494 pixels */
- GUI_CONST_STORAGE GUI_BITMAP bmopen = {
- 19, /* XSize */
- 26, /* YSize */
- 19, /* BytesPerLine */
- GUI_COMPRESS_RLE8, /* BitsPerPixel */
- (unsigned char *)acopen, /* Pointer to picture data */
- NULL, /* Pointer to palette */
- GUI_DRAW_RLEALPHA
- };
I draw alpha images with GUI_SetColor(), that selects the color of the shape, and GUI_DrawBitmap() that really draws the bitmap on the screen. It works very well during the simulation at the PC, and it seems working well on the embedded target when the background is dark (black) or blue (GUI_BLUE). When the background is light (GUI_RED or GUI_GREEN) the alpha blending doesn't work well. The shape isn't smooth. I don't know if it is correct, I think the real color used are calculated if the background was always black.
My driver is GUIDRV_FLEXCOLOR_F66709. Here it is the initialization.
C Source Code
- #define XSIZE_PHYS 320
- #define YSIZE_PHYS 240
- #define NUM_VSCREENS 1
- void LCD_X_Config(void) {
- GUI_DEVICE * pDevice;
- GUI_PORT_API PortAPI;
- CONFIG_FLEXCOLOR cfgFlexColor = { 0 };
- pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, COLOR_CONVERSION, 0, 0);
- if (DISPLAY_ORIENTATION & GUI_SWAP_XY) {
- LCD_SetSizeEx(0, YSIZE_PHYS, XSIZE_PHYS);
- if (NUM_VSCREENS > 0)
- LCD_SetVSizeEx(0, YSIZE_PHYS * NUM_VSCREENS, XSIZE_PHYS);
- } else {
- LCD_SetSizeEx(0, XSIZE_PHYS, YSIZE_PHYS);
- if (NUM_VSCREENS > 0)
- LCD_SetVSizeEx(0, XSIZE_PHYS, YSIZE_PHYS * NUM_VSCREENS);
- }
- cfgFlexColor.FirstCOM = 0;
- cfgFlexColor.FirstSEG = 0;
- cfgFlexColor.NumDummyReads = 1; // Sembra sia necessario per l'ILI9341
- cfgFlexColor.Orientation = DISPLAY_ORIENTATION;
- cfgFlexColor.RegEntryMode = 0; /* Gli altri bit per il registro che contiene l'orientation */
- GUIDRV_FlexColor_Config(pDevice, &cfgFlexColor);
- // GUIDRV_FlexColor_SetReadFunc();
- PortAPI.pfWrite16_A0 = LCD_X_8080_16_Write00_16;
- PortAPI.pfWrite16_A1 = LCD_X_8080_16_Write01_16;
- PortAPI.pfWriteM16_A1 = LCD_X_8080_16_WriteM01_16;
- PortAPI.pfReadM16_A1 = LCD_X_8080_16_ReadM01_16;
- GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI,
- GUIDRV_FLEXCOLOR_F66709,
- GUIDRV_FLEXCOLOR_M16C0B16);
- }
How could I check if this is correct? I know ILI9341 supports read back.