# 2018 R4 loss of transparency in Canvas 

**URL:** <https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605>\
**Category:** General\
**Created:** [December 11, 2018, 8:11pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605 "2018-12-11T20:11:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 11, 2018, 8:11pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/1 "2018-12-11T20:11:37Z")

</div>

Well something happened with R4 that breaks my whole UI. Not so happy about that. Bigger issues is I can’t figure out what the fix is.

The window below looks fine in R3, no black background on the canvas. In r4 some of my canvas images display a back background where as others are correctly transparent.

The icons in the middle section of the window all have the same settings but one has the black background artifact, the others do not.  
The top portion of the window has canvas over a rectangle, the middle section has canvases over a page panel.  
All the options in the inspector window under behavior heading are disabled.

![](https://www.dropbox.com/s/xeeimp0c0hwi4me/Screen%20Shot%202018-12-11%20at%2011.13.26%20AM.png?raw=1)

Would like to file a bug report but right now i’m not sure how to reproduce. Specifically why it affects some canvases but not others. Just rolled back to R3 and everything works again, so that rules out the images being corrupted.

---

<div class="post-metadata">

**Author:** ![Paulo\_Vargas](https://forum.xojo.com/user_avatar/forum.xojo.com/paulo_vargas/32/232_2.png) [@Paulo\_Vargas](https://forum.xojo.com/u/Paulo_Vargas)\
**Post date:** [December 11, 2018, 8:50pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/2 "2018-12-11T20:50:30Z")

</div>

Hello, Julian

Try to put new canvas with the same images and see if it does not solve, I had a problem similar to some time ago and only to solve deleting the old canvas and putting new ones in the project

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 11, 2018, 9:26pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/3 "2018-12-11T21:26:11Z")

</div>

I’ll test later, that said if this is the issue there is a change to the way the project code is being compiled rather than the project just being corrupted. Also the size and scope of my project make this a major undertaking so not really a work around in this case.

I’m also seeing the issue when I draw directly into a canvas. I have a canvas class that creates a recessed group box and this also shows a strange artifact around the line and arc drawing methods.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [December 12, 2018, 1:04am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/4 "2018-12-12T01:04:30Z")

</div>

Make sure that the Transparent property is True on the canvases that are black.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 12, 2018, 4:51pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/5 "2018-12-12T16:51:55Z")

</div>

Forgot one detail that makes this more interesting. This is running on macOS. I’ve never had any issues with transparency on mac, Windows sure. We just went through and per the latest guidelines removed the transparency flag from many of our controls to improve drawing speed.

Is it not true that transparency should have no effect on mac?

Any insights on to what may have changed under the hood since the R3? We were really happy with the improvement introduced in R3 for windows, was not expecting to have to deal with issue on macOS now.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 12, 2018, 11:55pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/6 "2018-12-12T23:55:08Z")

</div>

Okay so I can confirm that setting transparency does resolve the issue but here’s the questions:

1. The behavior in R3, and supported by the docs, is that transparency on Mac should have no effect on a canvas - In R4 with my app it does. Is that the expected behavior?

To provide some more detail I created a new test project with the same assets placed over a new window and the project worked as expected with the PNG assets appearing with a transparent background. So there’s some combination of factors in my app that’s causing the problem. The oddest part is that controls with the same properties on the same page, only some will show the issues.

Also I’m currently running in dark mode on my mac but the windows have a custom color and supportdarkmode is set to false.

IT’s very difficult for me to upload my app so any other thoughts? still trying to find a way to replicate the issue in a sample project.

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [December 13, 2018, 12:15am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/7 "2018-12-13T00:15:13Z")

</div>

This isnt a bug. Whats changed is that while it didnt matter before, now it does. A new canvas dragged to a layout will have the Transparent property set to True on macOS. If you need different values per platform, you can set it in the open event with something like:

```auto
me.Transparent = TargetMacOS
```

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 13, 2018, 12:34am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/8 "2018-12-13T00:34:19Z")

</div>

Just so I’m interpreting that correctly:

The transparency property on macOS now has an effect.  
The transparency property, which wast needed in the past to have transparency, is now needed…at least in some cases.

---

<div class="post-metadata">

**Author:** ![Julia\_Truchsess](https://forum.xojo.com/user_avatar/forum.xojo.com/julia_truchsess/32/499_2.png) [@Julia\_Truchsess](https://forum.xojo.com/u/Julia_Truchsess)\
**Post date:** [December 13, 2018, 12:40am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/9 "2018-12-13T00:40:56Z")

</div>

The only reference to transparency in the Release Notes for r4 is

“53628 Framework » Macintosh (Cocoa) Listbox now obeys the Transparent property on macOS.”

Seems the release notes are incomplete.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 13, 2018, 12:51am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/10 "2018-12-13T00:51:29Z")

</div>

Okay I finally was able to make a sample project that shows the issue. All the canvases on the page have the transparency property set to off, but half of them are transparent like in previous version. The others are not. No idea why the difference, will link to feedback one I have it created

---

<div class="post-metadata">

**Author:** ![anon20074439](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@anon20074439](https://forum.xojo.com/u/anon20074439)\
**Post date:** [December 13, 2018, 12:54am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/11 "2018-12-13T00:54:54Z")

</div>

Having not played around with macos much, what woild be the use case for disabling canvas transparency on macos? Saving one call to fillrect with a black background?

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 13, 2018, 1:01am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/12 "2018-12-13T01:01:38Z")

</div>

\<[https://xojo.com/issue/54430](https://xojo.com/issue/54430)\>  
Here’s the link to the case with a demo project. Curious if it’s system dependent?

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [December 13, 2018, 1:15am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/13 "2018-12-13T01:15:24Z")

</div>

> [@417740:@](#):
>
> Having not played around with macos much, what woild be the use case for disabling canvas transparency on macos? Saving one call to fillrect with a black background?

Internally there are performance improvements, if you don’t need transparency, you can disable it and then the system doesn’t need to refresh any underlying controls, when refreshing it.

As far as Apple are concerned, unless you need transparency you should turn this off.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 13, 2018, 2:12am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/14 "2018-12-13T02:12:09Z")

</div>

With the changes to the windows architecture we updated our app, disabling transparency as this was no longer needed in most cases and dramatically improved performance on windows. Now with this release Id have to turn transparency on for all controls on a macOS build which has never been needed in the past. I havent tried this on windows but its introduced a feeling that the ui is a moving target and we cant keep modifying controls on hundreds of windows to adapt to the latest best practices for the framework.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 14, 2018, 12:58am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/15 "2018-12-14T00:58:55Z")

</div>

Okay this is a weird one!!

I can now reproduce the issue and it seems to be related to labels in Rectcontrols. Placing a label within a rectangle affects the transparency of a canvas control. Moving the label outside of the rectangle produces results identical to R3 projects.

![](https://www.dropbox.com/s/2x6zigayoxtstyc/BreakingBehavior.png?raw=1)  
 ![](https://www.dropbox.com/s/4csq4xphv6qasao/Expected.png?raw=1)

Nothing was changed to the canvas and it contains no image. Transparency is set to “off”. Simply changing the parent of the label causes the canvas to be rendered with a black background. I’m guessing some of the optimization to the label control is responsible. I would call this a bug as the state of a canvas should not be impacted by controls that do not overlap with it.

Steps to reproduce are below:  
Tested in macOS 10.14, darkmode on.

1. Create a new desktop project  
Add a canvas to window, set transparency to false  
Add a rectangle to window, set the fill color to any color other than white (not sure this is required). Do not overlap.  
Add a label in the main window, not within the rectangle. Set text color to white ( not sure this is necessary)

//Test 1, same behavior as R3  
Run the app and the canvas is not visible

//Test 2, different behavior from R3, Not expected behavior  
Move the label into the rectangle  
run the app  
The canvas is rendered with a black fill

---

<div class="post-metadata">

**Author:** ![Sam\_Rowlands](https://forum.xojo.com/user_avatar/forum.xojo.com/sam_rowlands/32/265_2.png) [@Sam\_Rowlands](https://forum.xojo.com/u/Sam_Rowlands)\
**Post date:** [December 14, 2018, 1:12am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/16 "2018-12-14T01:12:20Z")

</div>

[quote=417908:@Julian Mussi]Steps to reproduce are below:  
Tested in macOS 10.14, darkmode on.[/quote]  
Good catch and weird! Make sure you file a feedback bug report and include your sample project.

---

<div class="post-metadata">

**Author:** ![Julian\_Mussi](https://forum.xojo.com/user_avatar/forum.xojo.com/julian_mussi/32/445_2.png) [@Julian\_Mussi](https://forum.xojo.com/u/Julian_Mussi)\
**Post date:** [December 14, 2018, 2:42am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/17 "2018-12-14T02:42:34Z")

</div>

Yeah theres an attached case and sample project if anyone wants to test on a different version of macOS or sign onto the case. #54430

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [December 15, 2018, 2:07am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/18 "2018-12-15T02:07:38Z")

</div>

Could this be related to [https://forum.xojo.com/50285-clearrect-uses-wrong-background-colour-in-dark-mode](https://forum.xojo.com/50285-clearrect-uses-wrong-background-colour-in-dark-mode) ?

---

<div class="post-metadata">

**Author:** ![Carlo\_Rubini](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/94ad74/32.png) [@Carlo\_Rubini](https://forum.xojo.com/u/Carlo_Rubini)\
**Post date:** [December 21, 2018, 5:06am UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/19 "2018-12-21T05:06:48Z")

</div>

I think LR should be updated about this, because it still states that Transparent works on Windows only,  
While dragging a new canvas in a project, it has Transparent ON by default.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:29pm UTC](https://forum.xojo.com/t/2018-r4-loss-of-transparency-in-canvas/46605/20 "2020-10-29T19:29:33Z")

</div>


