Alpha blending not work

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

  • Alpha blending not work

    Hello.
    In the library STemWin540_CM4_IAR_ARGB.а alpha blending does not work. In the library STemWin540_CM4_IAR.A alpha blending works.
    Checked various options with functions: GUI_EnableAlpha(), GUI_SetAlpha(), GUI_SetUserAlpha().
    Is it a library or configuration problem?
  • Hi,

    I gave it a try with the 'Hello World' project offered by STM.

    I have changed the library to ARGB and set the define GUI_USE_ARGB to 1 (setting the define is quite important since it is used in some header files, too).
    Further I have moved the GUI memory into the external RAM at address 0xC0000000 to be able to allocate more memory (although, this is not required to run a Hello World application). Take care, at 0xC0200000 starts the framebuffer.

    After doing the steps above I tried the application below and it on my display appeared a Hello World with an overlay of 50% red.

    C Source Code

    1. #include "GUI.h"
    2. /*********************************************************************
    3. *
    4. * Public code
    5. *
    6. **********************************************************************
    7. */
    8. /*********************************************************************
    9. *
    10. * MainTask
    11. */
    12. void MainTask(void) {
    13. GUI_Clear();
    14. GUI_SetFont(&GUI_Font20_1);
    15. GUI_DispStringAt("Hello world!", (LCD_GetXSize()-100)/2, (LCD_GetYSize()-20)/2);
    16. GUI_EnableAlpha(1);
    17. GUI_SetColor(0x80FF0000);
    18. GUI_FillRect(0, 0, LCD_GetXSize() - 1, LCD_GetYSize() - 1);
    19. GUI_EnableAlpha(0);
    20. while(1);
    21. }
    Display All


    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    It shouldn't matter which IAR version or even which toolchain you are using.

    Which color conversion are you using, GUICC_M8888I?
    Which device are you using?

    I did the test on a STM32F746 Discovery using a clean project for this evalboard from the STM32F7 Cube package.

    Regards
    Sven
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • I fixed it.
    Could not work for you, because problem in the driver.
    You need to fix the function DMA2D_MixColors()


    #if (GUI_USE_ARGB == 1)
    #define DMA2D_ALPHA_CMP_COLOR 0x00000000
    #else
    #define DMA2D_ALPHA_CMP_COLOR 0xFF000000
    #endif


    static LCD_COLOR DMA2D_MixColors(LCD_COLOR Color, LCD_COLOR BkColor, U8 Intens)
    {
    if((BkColor & 0xFF000000) == DMA2D_ALPHA_CMP_COLOR)
    return Color;


    uint32_t ColorFG = Color ^ DMA2D_ALPHA_CMP_COLOR;
    uint32_t ColorBG = BkColor ^ DMA2D_ALPHA_CMP_COLOR;


    ...

    return (ColorDst ^ DMA2D_ALPHA_CMP_COLOR);
    }


    I think other functions using Alpha, also need to be fixed.



    Why is the function GUI_FillReсt() draws lines? At a resolution of 800 x 480, the test case draws a polygon for a very long time. In fact, there is DMA2D, but it does not fully use the library. This is very sad.