2018 R4 loss of transparency in Canvas

  1. 6 weeks ago

    Julian M

    Dec 11 Pre-Release Testers, Xojo Pro San Francisco Bay Area
    Edited 6 weeks ago

    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.

    -image-

    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.

  2. Paulo V

    Dec 11 Porto Alegre, Brasil

    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

  3. Julian M

    Dec 11 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

  4. Greg O

    Dec 11 Xojo Inc

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

  5. 5 weeks ago

    Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

  6. Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

  7. Greg O

    Dec 12 Xojo Inc

    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:

    me.Transparent = TargetMacOS
  8. Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

  9. Julia T

    Dec 12 Sandy Hook, Connecticut

    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.

  10. Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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

  11. Julian S

    Dec 12 Pre-Release Testers, Xojo Pro UK

    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?

  12. Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    Feedback Case #54430
    Here's the link to the case with a demo project. Curious if it's system dependent?

  13. Sam R

    Dec 12 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

    @Julian S 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.

  14. Julian M

    Dec 12 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

  15. Julian M

    Dec 13 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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.

    -image-
    -image-

    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

  16. Sam R

    Dec 13 Pre-Release Testers, Xojo Pro Hengchun, Pingtung, Taiwan

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

    Good catch and weird! Make sure you file a feedback bug report and include your sample project.

  17. Julian M

    Dec 13 Pre-Release Testers, Xojo Pro San Francisco Bay Area

    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

  18. Michael D

    Dec 14 Pre-Release Testers, Xojo Pro

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

  19. 4 weeks ago
    Edited 4 weeks ago

    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.

or Sign Up to reply!