stemwin antialiasing color problem

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • stemwin antialiasing color problem

    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.

    C Source Code

    1. in LCDConf_FlexColor_Template.c at function void LCD_X_Config(void)
    2. ...
    3. pDevice = GUI_DEVICE_CreateAndLink(GUIDRV_FLEXCOLOR, GUICC_M565, 0, 0);
    4. ...
    5. GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B16);
    6. ...

    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

    (there is a black cirle on the buttom right corner drawn by pen just ignore it)

    Any help would be appreciated

    Thank you in advance,

  • Hi emWin Users,

    I found a solution for the problem. Just a brief summary

    C Source Code

    1. static void LcdReadDataMultiple(U16 * pData, int NumItems) {
    2. hx8357_setCSX(1);
    3. *pData++ = hx8357_readData(); // dummy read
    4. NumItems--;
    5. while (NumItems--) {
    6. uint16_t redgreen = hx8357_readData(); // highbyte red in 8 bit format, lowbyte green in 8 bit format
    7. uint16_t bluered = hx8357_readData(); // highbyte blue in 8 bit format, lowbyte red in 8 bit format
    8. // 24 bit format color
    9. uint8_t red = (redgreen >> 8) & 0xFF;
    10. uint8_t green = redgreen & 0xFF;
    11. uint8_t blue = bluered >> 8;
    12. uint16_t value= (uint16_t) (((uint16_t)(red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3));
    13. *pData++ = value;
    14. }
    15. hx8357_setCSX(0);
    16. }
    Display All

    void LCD_X_Config(void)

    C Source Code

    1. ...
    2. GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66709, GUIDRV_FLEXCOLOR_M16C0B16);
    3. GUIDRV_FlexColor_SetReadFunc66709_B16(pDevice,GUIDRV_FLEXCOLOR_IF_TYPE_II);...

    Best regards,
  • Hello,

    Please note that GUIDRV_FlexColor offers the possibility to change the way pixel data is read. In order to do so the function GUIDRV_FlexColor_SetReadFunc66709_B16() can be used. Details can be found in the according function description in the emWin user manual.

    Best regards,