cancel
Showing results for 
Search instead for 
Did you mean: 

stemwin antialiasing color problem

molnardavid84
Associate II
Posted on August 28, 2015 at 10:57

Hi STM32 Users,

I would like to request your help in the following problem. I am using STM32F427VG and HX8357D with FMC controller in 16 bit mode RGB565. I successfully integrated the STemWin library with STM32Cube_FW_F4_V1.7.0. RED and BLUE color were swapped but after using GUICC_M565 it is solved. 

in LCDConf_FlexColor_Template.c at function void LCD_X_Config(void)

...

pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0);

...

GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B16);

...

The problem is with the anti-aliased circles (maybe other polygons are involved too). The colors which are used by the library is not correct. Look at the picture: there are Red green and blue circles on red green and blue rectangles. I think the red circle on red background shouldn't be seen. Attached the picture

https://goo.gl/photos/cq1wQaMWtXFFPwEo9

Any help would be appreciated

Thank you in advance,

Dave

#stemwin #stm32f4 #hx8367d
2 REPLIES 2
Posted on August 31, 2015 at 17:34

Hi molnar.david,

Try to use 24-bits resolution with RGB888,

normally you will get a better resolution,

since every color will be coded on 8 bits.

-Shahrzad-

molnardavid84
Associate II
Posted on September 01, 2015 at 14:00

Dear shahrzad,

Thank you for your answer.

I think 24 bit resolution would slow down a lot of processes and unmanagable by flexdriver with HX8357D (color format problems).

However I found a solution:

Convert data at dataRead function to correct fromat for stemwin:

/********************************************************************

*

*       LcdReadDataMultiple

*

* Function description:

*   Reads multiple values from a display register.

*/

static void LcdReadDataMultiple(U16 * pData, int NumItems) {

hx8357_setCSX(1);

*pData++ = hx8357_readData(); // dummy read

NumItems--;

while (NumItems--) {

uint16_t redgreen = hx8357_readData();    // highbyte red in 8 bit format, lowbyte green in 8 bit format

uint16_t bluered  = hx8357_readData();    // highbyte blue in 8 bit format, lowbyte red in 8 bit format

// 24 bit format color

uint8_t red   = (redgreen >> 😎 & 0xFF;

uint8_t green = redgreen & 0xFF;

uint8_t blue  = bluered >> 8;

uint16_t value= (uint16_t) (((uint16_t)(red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3));

*pData++ = value;

}

hx8357_setCSX(0);

}

 to read only once from display use: GUIDRV_FlexColor_SetReadFunc66709_B16(pDevice,GUIDRV_FLEXCOLOR_IF_TYPE_II);

Best regards,

Dave