canvas transparency - again

  1. 6 weeks ago
    Edited 6 weeks ago

    Hello,
    if I put on a transparent png as backdrop to a canvas, why (and this is what I want) can I see the controls through when running on my Mac and when compiled for Windows it does not, the png is opaque to controls, not to the background? Red is the window background color, everything blue the png

    -image-

    Yes. I don't remember exactly when Direct2D was implemented, but indeed you cannot *easily* get the same transparency with 2018R1 through 2019R1.1.

    The only way to get an effect of transparency with latest Xojo Windows canvas, would be to take a screen shot of what is behind the canvas, and draw it on it.

    It should be possible, though, to bring back the truly transparent canvas in a plugin. It would just be necessary to create a custom control around a good old Win32 canvas !

    The reason why the canvas displays as transparent in the IDE is probably because the IDE does not show you the true control. Or that it still uses the Win32 control ;)

  2. Michel B

    Oct 8 Pre-Release Testers, Xojo Pro

    Because it uses Direct2D, Windows uses pseudo transparency, which means instead of being transparent, a canvas takes the color of it's parent.

    My solution was to stay with 2016R2.1 where the Windows version works like the Mac version, with truly transparent canvas.

  3. Edited 6 weeks ago

    Thanks Michel, i tested it with 2017R3 and there it works on windows, too.
    So, is the pseudo transparency related to Xojo in newer Versions? I guess I cannot use the "old" way in 2019.R1 like it was in 2016/2017, right?

    And, why does it display correct transparent in the GUI (on Xojo for Windows) and not in the compiled app?

  4. Michel B

    Oct 8 Pre-Release Testers, Xojo Pro Answer
    Edited 6 weeks ago

    Yes. I don't remember exactly when Direct2D was implemented, but indeed you cannot *easily* get the same transparency with 2018R1 through 2019R1.1.

    The only way to get an effect of transparency with latest Xojo Windows canvas, would be to take a screen shot of what is behind the canvas, and draw it on it.

    It should be possible, though, to bring back the truly transparent canvas in a plugin. It would just be necessary to create a custom control around a good old Win32 canvas !

    The reason why the canvas displays as transparent in the IDE is probably because the IDE does not show you the true control. Or that it still uses the Win32 control ;)

  5. Edited 6 weeks ago

    first i was so happy that flickering on a scrolling canvas was much reduced on windows in 2019r1, but that is the downside. I now have the choice between truly transparent canvas in R2016 (with flickering) or less flickering without true transparency in R2019....

    But, thanks again Michel for clearing that up.

  6. Michel B

    Oct 9 Pre-Release Testers, Xojo Pro

    There could be a way to obtain transparency in some cases, mind you not the example you posted.

    The example at below allows creating a window where everything in a mask picture that is white becomes transparent (shape.bmp).
    The very same technique of setting regions that become transparent can be used to create a canvas with pretty much any shape.
    Since under Windows the same declares can be used on Windows as well as controls (they are technically considered child windows), this example can be applied quite easily.

    /Applications/Xojo 2017 Release 2.1/Example Projects/Platform-Specific/Windows/CustomWindowShape

or Sign Up to reply!