GithubHelp home page GithubHelp logo

Comments (5)

joaodasilva avatar joaodasilva commented on May 1, 2024 1

Glad to hear that & thanks for pinging back!

It's intentional that this works, it's just unclear why both calls are needed.

I certainly wanted transparency to be opt-in, and the default to be opaque black; but the clearRect implementation should suffice to make the window transparent. Let's keep the issue open to track that.

from windowjs.

joaodasilva avatar joaodasilva commented on May 1, 2024 1

This is fixed now. The problem was a synchronization between drawing to the window framebuffer and the skia state. It doesn't reproduce anymore since drawing exclusively with Skia.

This means that a single clearRect() calls is enough to get transparency. I.e. the default background is opaque black, but clearRect() makes it transparent.

from windowjs.

joaodasilva avatar joaodasilva commented on May 1, 2024

The window supports transparency but it's initially cleared with opaque black. So if you clear with a transparent color then you should see through the window.

You can try running examples/squares.js to see a semi-transparent window. The key code snippet is this:

const canvas = window.canvas;
canvas.clearRect(0, 0, canvas.width, canvas.height);
canvas.fillStyle = '#000000b0';
canvas.fillRect(0, 0, canvas.width, canvas.height);

Does that work for you?

Let's leave the issue open because the fillRect call in that snippet shouldn't be necessary, but it doesn't work without it; that's a bug :-)

from windowjs.

joaodasilva avatar joaodasilva commented on May 1, 2024

This is now documented at https://windowjs.org/doc/canvas#canvas.clearRect.

@Bellisario please ping the thread if that code snippet doesn't work on your machine, there might well be more bugs in the implementation.

from windowjs.

Bellisario avatar Bellisario commented on May 1, 2024

Thanks for your support.
Works using this this "loophole"!

from windowjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.