antialiased text

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

  • antialiased text

    Dear all,

    I am trying to use the antialias 'method' when displaying strings with STemWin.

    But frankly speaking I do not see much difference between using 'aliased' fonts or anti-aliased fonts.

    I tried not only with my application but also with the GUIDEMO_AntialiasedText() demo function provided together with STemWin

    Might it be because I am using these settings:


    #define COLOR_CONVERSION_0 GUICC_8666
    #define DISPLAY_DRIVER_0 GUIDRV_LIN_8

    is there any kind of limitation, when using antialias capability, related to the color profile?

    Thanks,
    Ezio
  • Thanks Adrian.

    May I ask what is the meaning of 'mixture' in the following statement (found in emWin 5.24 user manual)?

    "when using 4-bit antialiasing, a value of 15 displays the pixel
    in the current foreground color. An intensity of 10 means that the pixel color is a mixture
    of 10 shares of foreground color and 5 shares of background color.
    "

    Does it mean that a sort of alpha blending is to be performed in order to render the font?

    If I do not call the GUI_EnableAlpha function is it still possible to get the mixture performed?

    How is it the mix among colors performed?

    Thanks,
    Ezio

    The post was edited 1 time, last by ezio_noventa ().

  • Hello Ezio,

    Yes, this is a sort of alpha blending. 4-bit AntiAliasing means that the smoothed edges may contain pixels of one of 16 alpha levels: Opaque, transparent and 14 levels which require the foreground and background colors to be mixed in a certain ratio. It is not required to call the function GUI_EnableAlpha(), but it is required to have the emWin AntiAliasing component in the package.

    Best regards,
    Adrian
  • Thanks Adrian.

    I am using STemWin, in the documentation I read:

    STemWin supports antialiased drawing of:
    • Text (Font Converter is required to create AA fonts)
    • Arcs (GUI_AA_DrawArc())
    • Circles (GUI_AA_FillCircle())
    • Lines (GUI_AA_DrawLine())
    • Polygons (GUI_AA_DrawPolyOutline() and GUI_AA_FillPolygon())

    so I assume antialiasing component is present.

    You say that GUI_EnableAlpha() is not required, however in your antialiased text sample source code


    http://www.segger.com/admin/uploads/userfiles/file/emWin/samples/src/AA_Text.c

    I read

    void MainTask(void) {
    GUI_Init();
    GUI_EnableAlpha(1);
    _DrawScreen();
    while (1) {
    GUI_Delay(100);
    }
    }


    so I assumed alpha blending was needed.


    If it is not needed and consider I need to set 8 bit per pixel and 6 levels per color do I have to use a palette with trasparency?

    Or is it possible to get font antialiasing with a palette that is both alpha blending-less transparency-less? Namely using GUICC_8666?

    Thanks,
    Ezio
  • Hello Ezio,

    The function GUI_EnableAlpha() is not required to draw AA text. Calling GUI_EnableAlpha(1) makes subsequent drawing operations consider the alpha channel of color values. Besides antialiased text, the sample AA_Text performs further actions, which require Alpha Blending.

    Best regards,
    Adrian
  • Thanks Adrian.

    Actually I think that the issue might be in the mix between the colors.

    I am doing some tests without explicitly defining a palette, so the library should use the default implicit 8666 palette.

    I did some tests with STM 324x9I-EVAL and they look positive.

    When I move to my board

    1) I get blue as default background color and light green as default foreground color (without any kind of explicit setting performed by myself)
    2) antialiased fonts (generated with font converter 5.24) do not get antialiased

    BR,
    Ezio
  • Dear Adrian,
    might it be that the issue in my antialiasing attempts is due to a lack of memory?

    In STemWin GUI_Private.h file I found this declaration

    GUI_EXTERN int GUI__BufferSize; // Required buffer size in pixels for alpha blending and/or antialiasing

    Do you think I should to allocate that buffer within GUI_X_Config() ?

    Thanks,
    Ezio
  • Hello Ezio,

    No, I do not think the buffer for AntiAliasing is too small. Please note that all parts which are not described in the emWin user manual should be considered as internal. Meaning that there is in any case no action required by the user.

    Please note that when displaying text, the text mode should be transparent in order to correctly mix the colors with the background. Further the display controller should provide reading back functionality if no display driver cache is used.

    Best regards,
    Adrian
  • Dear Adrian,


    I set the text mode as transparent, but nothing changed, I set also the COLOR_CONVERSION to a mode with transparency, like GUICC_88666I, again nothing changed.

    May be the malfunctioning is due to the lack of "reading back functionality", as you wrote.

    Can you kindly clarify what you mean with that?

    Thanks in advance,
    Ezio
  • Hello Ezio,

    Transparency (meaning Alpha Blending) requires the ability to mix colors. Colors can be mixed only if they are known. So either the display controller provides reading back functionality or you configure the emWin display driver to use a cache. Details on how to use a cache can be found in the emWin user manual.

    Best regards,
    Adrian