[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: Patch: Many composite/blend modes mostly compatible to Adobe
From:       Silvio Heinrich <plassy () web ! de>
Date:       2011-02-05 21:47:53
Message-ID: 4D4DC589.6090802 () web ! de
[Download RAW message or body]

> Don't think we have forgotten about this patch :) I have played a bit with it.
> I still need to read the code in more depth, and check that it does not
> introduces a regression with respect to this bug
> https://bugs.kde.org/show_bug.cgi?id=176536 .
>
Ok, thx you are looking at it.
I can give a rough overview on how everything works.
I'ts acctually not much different from your approach but i wanted it a 
bit more generic.

The derivation tree is like this:

            KoCompositeOp
                        |
                KoCompositeOpBase
                  |           |
KoCompositeOpGenericSC   KoCompositeOpGenericHSL


The KoCompositeOpBase class is like your KoCompositeOpAlphaBase class
(but i didn't want to change it because I wasn't sure what sideeffects 
it may cause).

the KoCompositeOpGenericSC and KoCompositeOpGenericHSL are the classes
that do the compositing. The two classes take a constant function 
pointer as template parameter.
These function pointers are the blending functions.

So it should be easy to create new blending modes by just writing a 
blending function.
For example the darken blending function:

template<class T>
inline T cfDarkenOnly(T src, T dst) { return qMin(src, dst); }

Notice that the blending function does not need to handle transparency 
and masking, this is
done in the KoCompositeOpGenericSC and KoCompositeOpGenericHSL classes 
and works for all
blending modes equally :-) .

This function is then passed to an instance of KoCompositeOpGenericSC:

new KoCompositeOpGenericSC<Traits, &cfDarkenOnly>(colSpace, 
COMPOSITE_DARKEN, i18n("Darken"), KoCompositeOp::categoryLight());

Thats all.
It's not this much :-D .


_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic