Hello to everyone,
I'm trying to draw some transparent text on the background that filled with a vertical gradient. I'd like to have a text with transparent and gray framed characters, so the background could be seen through it. But instead of transparency I've got black characters.
Here is some code from the simulator (also in attach):
Display All
Here's what I got:
![](https://forum.segger.com/index.php/Attachment/2945-scr1-png/?thumbnail=1&s=128654f42d6b3622bb88c4241868ff94c9ffcdbb)
Further if I call GUI_SetColor(GUI_TRANSPARENT) after GUI_EnableAlpha(1) then the text become completely unvisible including frame:
![](https://forum.segger.com/index.php/Attachment/2946-scr2-png/?thumbnail=1&s=128654f42d6b3622bb88c4241868ff94c9ffcdbb)
Where is my mistake?
Thanks for your time,
Alex.
I'm trying to draw some transparent text on the background that filled with a vertical gradient. I'd like to have a text with transparent and gray framed characters, so the background could be seen through it. But instead of transparency I've got black characters.
Here is some code from the simulator (also in attach):
C Source Code: main.c
- #include "GUI.h"
- #include "DIALOG.h"
- #define RECOMMENDED_MEMORY (1024L * 5)
- GUI_RECT pRect;
- void MainTask(void) {
- GUI_Init();
- WM_MULTIBUF_Enable(1);
- if (GUI_ALLOC_GetNumFreeBytes() < RECOMMENDED_MEMORY) {
- GUI_ErrorOut("Not enough memory available.");
- return;
- }
- // Fill the screen with a gray color
- GUI_SetBkColor(GUI_GRAY);
- GUI_Clear();
- // Set the recrangle area for text in the middle of the screen (320 * 240)
- pRect.x0 = 120;
- pRect.y0 = 110;
- pRect.x1 = 200;
- pRect.y1 = 130;
- // Fill the text area with the red -> blue vertical gradient
- GUI_DrawGradientV(pRect.x0, pRect.y0, pRect.x1, pRect.y1, GUI_RED, GUI_BLUE);
- // Set the framed font
- GUI_SetFont(GUI_FONT_20F_ASCII);
- // Set the frame color of the characters
- GUI_SetBkColor(GUI_GRAY);
- // Set the transparency of the characters
- GUI_SetColor(GUI_TRANSPARENT);
- // Enable alpha channel
- GUI_EnableAlpha(1);
- // Draw text in the middle of the text area
- GUI_DispStringInRect("EmWin", &pRect, GUI_TA_HCENTER | GUI_TA_VCENTER);
- // Disable alpha channel
- GUI_EnableAlpha(0);
- while(1)
- {
- }
- }
Further if I call GUI_SetColor(GUI_TRANSPARENT) after GUI_EnableAlpha(1) then the text become completely unvisible including frame:
Where is my mistake?
Thanks for your time,
Alex.