Blend Modes

Let the developers know what you think of the software and what can be done to either improve the CFDG language or the Context Free program.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
mycelium
Posts: 29
Joined: Tue Aug 28, 2007 4:21 am
Location: Italy
Contact:

Blend Modes

Post 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

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post 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.

mycelium
Posts: 29
Joined: Tue Aug 28, 2007 4:21 am
Location: Italy
Contact:

Re: Blend Modes

Post by mycelium »

I look forward to playing with it!

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post 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?

mycelium
Posts: 29
Joined: Tue Aug 28, 2007 4:21 am
Location: Italy
Contact:

Re: Blend Modes

Post by mycelium »

I use mac os

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post 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.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post 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.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post by MtnViewJohn »

There is a beta version with blending modes at ContextFree3.3beta.dmg

mycelium
Posts: 29
Joined: Tue Aug 28, 2007 4:21 am
Location: Italy
Contact:

Re: Blend Modes

Post 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!

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Blend Modes

Post 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.

Post Reply