[Gambas-devel] gb3: possible addition of image "modes", as in The GIMP

Kevin Fishburne kevinfishburne at ...590...
Sat Feb 12 04:32:05 CET 2011


In The GIMP, each layer has a "mode" that determines the algorithm used 
to blend it with the lower layers. The modes include:

Normal
Dissolve
Multiply
Divide
Screen
Overlay
Dodge
Burn
Hard light
Soft light
Grain extract
Grain merge
Difference
Addition
Subtract
Darken only
Lighten only
Hue
Saturation
Color
Value

Would it be feasible to add an implementation of at least some of these 
modes as a feature request for the gb.image.effect component?

Were it to be implemented, I can think of two ways of going about it:

1) An image can have an optional mode property, with the default being 
Normal. Every time the image is drawn the mode property would determine 
how it is blended with the destination image:

someimage = New Image(Width, Height, Color, Format, Mode)

2) The mode could be implemented as a parameter of a Draw method, such as:

destination.Draw(source, X, Y, Width, Height, SrcX, SrcY, SrcWidth, 
SrcHeight, Mode)

I wonder how simple or complex the GIMP source code is with regard to 
this. If it's small/clean/efficient, it might be pretty easy to 
implement. I just downloaded the source code and am searching through it 
trying to figure out where the algorithms are for layer compositing. 
Anyway, let me know what you all think about it, and I'll let you know 
if I find the corresponding GIMP code.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...590...
phone: (770) 853-6271





More information about the Devel mailing list