switching a bitmap between opaque and transparent - invisible

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

    • switching a bitmap between opaque and transparent - invisible

      Hi All,

      I realized the way I asked my question previously was not very clear. I have window which has a background image, on top which are widgets and some small bitmaps, working exactly as required. Three of the bitmaps I would like to appear 100% transparent normally, invisible, so the user does not see them, but when a flag is set they are opaque. Is this just the matter of setting the GUI_SetAlpha() to the appropriate value before drawing the bitmap, then re-setting after so nothing else is changed? triggered with WM_PAINT.

      Kind Regards

    • Hi Mike,

      Not sure if my ideas are valid or not, but figured I'd mention what I think my approach would be, a couple different possibilites:

      1) Create 'Window' widgets that are the size of your BMPs, and just have the BMPs displayed with the WM_PAINT callback for each window widget...

      You can use the 'WM_HideWindow/WM_ShowWindow() APIs to make them go away or be shown..

      (I'm currently doing a very similar setup with 4 buttons off my 'main menu' in my design)

      2) Create 'IMAGE' Widgets instead of the 'WINDOW' widget above, and do pretty much the same as above, hide/show the image widgets based on your flag setting..

      I just wanted to put this out there, as another option instead of going down the transparency route, I was playing with that route as well, when trying to figure out how to have a full 800x480 JPG image as my wallpaper, and have buttons overtop...

      initially I was going to do transparency, first going 2 hardware layers, then trying to do it via the emWin transparency route, but wasn't having much luck, so I did it what seemed to be the easier route, just showing/hiding the respective widgets/windows..