Why is my canvas not transparent on MacOS?

I know there are many many posts here complaining about canvas transparency issues, but it seems they’re all about a lack of transparency under Windows. I have the opposite problem - under Windows it looks great but under MacOS not so much.

My canvas is painting an 8-bit RGB PNG image. The white background of the image has been removed in Photoshop (checkerboard shows) and it looks right in the Xojo IDE.

Under Windows 10 or 11 I see only the colored parts of the image - the rest is exactly the color of the window on which the canvas sits, which is the desired result.

Screen Shot 2023-02-10 at 5.49.29 PM

Under MacOS, the canvas has a visible background darker than the window, giving it a “dirty” look:

Screen Shot 2023-02-10 at 3.04.19 PM

Xojo 2021r2.1, MacOS Monterey.

Are you sure that the background is 100% transparent?

Oh, and make sure you call ClearRect before drawing.

That did the trick, thanks!

Wait, why does this work? The Canvas has some random color filling it that doesn’t match the window background color?

2 Likes

I was a little surprised, too.