Hello to everyone,
I'm trying to implement a simple knob using memory devices containing transparency.
Memory device for the knob is displayed correctly whereas memory device for the background loses its transparency.
When checking data at the background device transparency is present.
Here is the code (screen size 320*240) and screenshots:
Display All
Expecting to see the following:
But see this instead:
This had been seen using simulation v5.44 (GUISim.lib from SEGGER package) and real hardware using STemWin v5.44 (STemWin_CM7_wc32_ot.a from ST package).
Thanks,
Alex.
I'm trying to implement a simple knob using memory devices containing transparency.
Memory device for the knob is displayed correctly whereas memory device for the background loses its transparency.
When checking data at the background device transparency is present.
Here is the code (screen size 320*240) and screenshots:
C Source Code
- #include "DIALOG.h"
- KNOB_Handle hKnob;
- GUI_MEMDEV_Handle hMem, hMemBk, hMemPrev;
- int i, x0, y0, x1, y1;
- // Callback for desktop window to draw some data
- static void _cbBk(WM_MESSAGE * pMsg) {
- switch (pMsg->MsgId) {
- case WM_PAINT:
- // Fill desktop with a color
- GUI_SetBkColor(GUI_BLUE);
- GUI_Clear();
- // Display background text
- GUI_SetFont(GUI_FONT_8X16X3X3);
- GUI_DispStringHCenterAt("Background", 160, 100);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- void MainTask(void) {
- GUI_Init();
- WM_MULTIBUF_Enable(1);
- WM_SetSize(WM_HBKWIN, 320, 240);
- // Callback for desktop window
- WM_SetCallback(WM_HBKWIN, _cbBk);
- // Create background memdevice
- // Fill it with transparency
- // Draw circle and tickmarks with semitransparency
- hMemBk = GUI_MEMDEV_CreateFixed32(0, 0, 200, 200);
- hMemPrev = GUI_MEMDEV_Select(hMemBk);
- GUI_SetBkColor(GUI_TRANSPARENT);
- GUI_Clear();
- GUI_PreserveTrans(1);
- GUI_SetPenSize(30);
- GUI_SetColor((0x40ul << 24) | GUI_LIGHTGRAY);
- GUI_AA_DrawCircle(100, 100, 80);
- GUI_SetPenSize(1);
- GUI_SetColor((0x40ul << 24) | GUI_WHITE);
- for (i = 0; i < 360000; i += 30000) {
- x0 = 75 * GUI__SinHQ(i) * 0.0000152587890625 + 100;
- y0 = 75 * GUI__CosHQ(i) * 0.0000152587890625 + 100;
- x1 = 85 * GUI__SinHQ(i) * 0.0000152587890625 + 100;
- y1 = 85 * GUI__CosHQ(i) * 0.0000152587890625 + 100;
- GUI_AA_DrawLine(x0, y0, x1, y1);
- }
- GUI_PreserveTrans(0);
- // Create rotating memdevice
- // Fill it with transparency
- // Draw filled circle with point
- hMem = GUI_MEMDEV_CreateFixed32(0, 0, 200, 200);
- GUI_MEMDEV_Select(hMem);
- GUI_SetBkColor(GUI_TRANSPARENT);
- GUI_Clear();
- GUI_PreserveTrans(1);
- GUI_SetColor(GUI_RED);
- GUI_AA_FillCircle(100, 100, 67);
- GUI_SetColor(GUI_WHITE);
- GUI_AA_FillCircle(100, 50, 5);
- GUI_PreserveTrans(0);
- // Return context to LCD
- GUI_MEMDEV_Select(hMemPrev);
- // Create knob, set ticksize, set memdevices
- hKnob = KNOB_CreateEx(60, 20, 200, 200, WM_HBKWIN, WM_CF_SHOW, GUI_ID_KNOB0);
- KNOB_SetTickSize(hKnob, 300);
- KNOB_SetBkDevice(hKnob, hMemBk);
- KNOB_SetDevice(hKnob, hMem);
- while (1) {
- GUI_Delay(50);
- }
- }
Expecting to see the following:
But see this instead:
This had been seen using simulation v5.44 (GUISim.lib from SEGGER package) and real hardware using STemWin v5.44 (STemWin_CM7_wc32_ot.a from ST package).
Thanks,
Alex.
The post was edited 3 times, last by LexaGB ().