Page 1 of 1

Blend Modes

Posted: Sun Nov 03, 2019 7:34 am
by mycelium
I think it would be useful for some designs to have different blend modes.
For example, if you want to draw sparks or other light effects you would use a additive mode.

https://en.wikipedia.org/wiki/Blend_modes

Re: Blend Modes

Posted: Tue Nov 05, 2019 12:37 am
by MtnViewJohn
The cross-platform graphics library, AGG, supports all of the blending modes, but I have only used the default source-over-dest mode. I can look into adding blending mode to the shape state.

Re: Blend Modes

Posted: Sat Nov 09, 2019 1:46 am
by mycelium
I look forward to playing with it!

Re: Blend Modes

Posted: Mon Jan 06, 2020 12:26 pm
by MtnViewJohn
Hi Mycelium,

I'm preparing a beta of Context Free v3.3 with this blending feature for you to check out. Do you use Windows or Mac?

Re: Blend Modes

Posted: Mon Jan 13, 2020 4:12 am
by mycelium
I use mac os

Re: Blend Modes

Posted: Mon Jan 20, 2020 9:42 am
by MtnViewJohn
Right now what I have implemented is a blend adjustment that you add to a shape that changes the blending mode for that shape and all of its child shapes:

Code: Select all

SCENE { blend CF::Xor x 0.25 y -0.25 s 0.5 alpha -0.2}
The flag following the blend keyword is either a Porter-Duff compositing mode:
CF::Clear, CF::Src, CF::Dest, CF::SrcOver, CF::DestOver, CF::SrcIn, CF::DestIn, CF::SrcOut, CF::DestOut, CF::SrcAtop, CF::DestAtop

Or a color blending mode:
CF::Xor, CF::Plus, CF::Multiply, CF::Screen, CF::Overlay, CF::Darken, CF::Lighten, CF::ColorDodge, CF::ColorBurn, CF::HardLight, CF::SoftLight, CF::Difference, CF::Exclusion

You don't have to remember all of these, there is a new menu item under the Edit menu: Insert Blend/Composite.

But I really don't know if this is the right way to do it. Is it correct to mix together blending and compositing and only allow one of the total at a time? Should designers be able to specify a blending mode and a compositing mode?

ETA: From reading the CSS Compositing and Blending spec it looks like I need to provide blending and compositing as separate operations. I will create a composite/comp adjustment to complement the new blend adjustment.

Re: Blend Modes

Posted: Sat Feb 15, 2020 1:55 pm
by MtnViewJohn
After looking at this further I think that implementing full blending and compositing would require a much more complicated drawing model. So I am only doing color blending.

Re: Blend Modes

Posted: Sat Feb 15, 2020 5:51 pm
by MtnViewJohn
There is a beta version with blending modes at ContextFree3.3beta.dmg

Re: Blend Modes

Posted: Sun Feb 16, 2020 7:06 am
by mycelium
Hello John,
I downloaded the beta version that seems to work good on my Mac (mac os x 10.14.6). I think that having color blending is useful, I hope to post soon an example in the gallery!

Compositing operation maybe would require to split current "alpha" command in two:
* "alpha" that paints on the global alpha map of the image (and could be both positive and negative);
* "opacity" that only specify the transparency/opacity of the current color;
But I don't know if this feature is a big improvement considering the possible ambiguity of the two commands.

Just for brainstorming:
A thing that could be nice, maybe, to have an additive mode where colors keep luminosity while changing the hue, and also progressively "burn" to white when go over maximum value of a single RGB channel. Something like the simulation of light captured by a camera.

thanks!

Re: Blend Modes

Posted: Tue Feb 18, 2020 11:24 pm
by MtnViewJohn
I uploaded a new beta ContextFree3.3beta.dmg with an additional blending mode: CF::Clear. Technically, this is a Porter-Duff compositing mode. The CF::Clear "blending" mode draws with transparency. It allows you to punch transparent holes into shapes.