Hello to everyone,
I'm working with the simulation (latest version 5.50) and I'd like to understand using GUI_AA_DrawPolyOutline()/GUI_AA_DrawPolyOutlineEx() functions.
I want to draw a simple antialiased polygon with a frame filled with inner color.
Here is the code:
Display All
The result is the polygon filled with the gray color instead of the red color. Using GUI_AA_DrawPolyOutlineEx() function ends up with the same result.
I suggest that GUI_AA_DrawPolyOutline()/GUI_AA_DrawPolyOutlineEx() functions use the backround colour to fill the polygon.
Then in my case if I want to have a red color I need to set a transparent backround color:
Display All
But in this case the result is the polygon filled with the white color.
What am I doing wrong? I expect to see the following:
Thanks,
Alex.
I'm working with the simulation (latest version 5.50) and I'd like to understand using GUI_AA_DrawPolyOutline()/GUI_AA_DrawPolyOutlineEx() functions.
I want to draw a simple antialiased polygon with a frame filled with inner color.
Here is the code:
C Source Code
- #include "DIALOG.h"
- // Polygon points
- GUI_POINT Plgn[] = {{-20, 20},
- {-20, -100},
- {0, -120},
- {20, -100},
- {20, 20},
- {0, 0}};
- void MainTask(void) {
- GUI_Init();
- // Fill background with the gray color
- GUI_SetBkColor(GUI_GRAY);
- GUI_Clear();
- // Draw polygon filled with the red color
- GUI_SetColor(GUI_RED);
- GUI_AA_FillPolygon(Plgn, GUI_COUNTOF(Plgn), 160, 160);
- // Draw white contour of the polygon
- GUI_SetColor(GUI_WHITE);
- GUI_AA_DrawPolyOutline(Plgn, GUI_COUNTOF(Plgn), 3, 160, 160);
- // The result is the polygon filled with the gray color
- while (1);
- }
The result is the polygon filled with the gray color instead of the red color. Using GUI_AA_DrawPolyOutlineEx() function ends up with the same result.
I suggest that GUI_AA_DrawPolyOutline()/GUI_AA_DrawPolyOutlineEx() functions use the backround colour to fill the polygon.
Then in my case if I want to have a red color I need to set a transparent backround color:
C Source Code
- ...
- // Draw white contour of the polygon with settting a transparent background
- // Set white contour color
- GUI_SetColor(GUI_WHITE);
- // Enable considering the alpha channel
- GUI_EnableAlpha(1);
- // Set transparent backround color
- GUI_SetBkColor(GUI_TRANSPARENT);
- // Draw contour of the polygon
- GUI_AA_DrawPolyOutline(Plgn, GUI_COUNTOF(Plgn), 3, 160, 160);
- // Disable alpha
- GUI_EnableAlpha(0);
- ...
What am I doing wrong? I expect to see the following:
Thanks,
Alex.