Drawing multiple times necessary to achieve good looking antialiasing

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

    • Drawing multiple times necessary to achieve good looking antialiasing

      Hi,

      I have the problem, that drawing an antialiased object doesn't look good if i just draw it once.
      I wrote a little test to compare the different level of AA in a state machine:

      C Source Code

      1. case 5:
      2. GUI_ClearRect(100, 17, 118, 37);
      3. GUI_ClearRect(radius + 75 - 1, 0, radius + 115, 15);
      4. GUI_AA_SetFactor(6); // 1 (no anti aliasing, default: 3; maximum: 6.
      5. for (int x = 0; x < y + 1; x++)
      6. {
      7. GUI_AA_DrawRoundedRect(100, 17, 118, 37, radius);
      8. }
      9. GUI_DispStringAt("AA factor 6.", 0 + 40, 0 + 40);
      10. break;
      In the following picture you can see the different steps of AA. The left one is without while the one on the right is with the highest AA level.
      You can see that the rounded rect on the right looks bad in comparison to the other AA circles. This happens when I remove the for loop in the code above and run GUI_AA_DrawRoundesRect just once.
      In all examples if have seeen the AA objects get just written once. I have to write it several times. If the AA level is 6 I have to draw it 6 times in a for loop to look good. If the AA level is 2 I have to draw it 2 times in a for loop to look good.




      The same thing happens if I use memory devices and DrawAuto and HiRes:

      C Source Code

      1. GUI_MEMDEV_DrawAuto(&aAuto[6], &Param.AutoInfo, _DrawRect, &Param);
      2. static void _DrawRect(void * p)
      3. {
      4. PARAM_testCase002 * pParam = (PARAM_testCase002 *) p;
      5. /* Fixed background */
      6. GUI_AA_DisableHiRes();
      7. if (pParam->AutoInfo.DrawFixed)
      8. {
      9. GUI_ClearRect(pParam->x1, pParam->y1, pParam->x2 + 1, pParam->y2 + 1);
      10. }
      11. /* Moving Part */
      12. GUI_AA_EnableHiRes();
      13. GUI_SetPenSize(1);
      14. for (int i = 0; i < pParam->factor; i++)
      15. {
      16. GUI_AA_DrawRoundedRect(pParam->x1 * pParam->factor, pParam->y1 * pParam->factor, pParam->x2 * pParam->factor, pParam->y2 * pParam->factor,
      17. pParam->radius * pParam->factor);
      18. }
      19. GUI_AA_DisableHiRes();
      20. }
      Display All
      Here you can see the how the code above looks when the for loop is removed and GUI_AA_DrawRoundedRect is just done once for each rounded rect.


      Are some of my settings wrong?
      I use the FlexColor Driver, 565 Color, Cache enabled, GUI_NUM_LAYERS set to 1.

      Drawing multiple times takes a long time. Using memory devices helps a lot but it still takes quite a bit of time.

      Best regards
      Lukas
    • Hi,

      I can't find any issue.

      With a pensize of 1 an anti aliased line gets pretty thin and getting more grayish (with black and white). You might try to set another pensize (maybe 2).

      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.