options.premultipliedAlpha not passed to context

Looking at the source for Engine (or rather ThinEngine) I have noticed that all options sent to the constructor gets passed on to the getContext as per the documentation:

(Optional) options: EngineOptions
defines further options to be sent to the getContext() function

…except for premultipliedAlpha.

That option is instead only used to set an internal parameter inside of engine which doesn’t seem to be used for very much? It also doesn’t look like an error in the code.

Git blame unfortunately only gives “engine splitting part 2” unless you start checking out old revisions and files. So does anyone know why this context option is actively ignored?

The reason I’m asking is that I seem to be getting a typical premultiplied alpha issue with my render buffer. I am using clearColor set to (0, 0, 0, 0) and I am currently getting black fringing on antialiased edges when composing the canvas against a white background color in the body.

It doesn’t seem that setting the premultipliedAlpha flag on the context actually helps for this, but I am trying to find all the pieces of the puzzle right now.

Well, where do you see that premultipliedAlpha is not shared with the getContext?

My bad, sorry.

I read the source incorrectly and got confused by premultipliedAlpha breaking the "if options.foo === ... {options.foo = ... }" pattern surrounding it. I see now that it all that row does is update the default true internal variable to false if the options states it should be false.

Back to trying to figure out why we get black fringing in the edges blended with the transparent clear color. Unfortunately I can’t reproduce it in PG which is highly annoying.

1 Like

Located the reason for our broken antialiasing, or at least what flag causes it for us: