[Gimp-developer] Custom layer mode combination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Maybe some of you can remember that, when I joined this list
about two months ago, I proposed a "programable
layer combine mode" for the GIMP.

The basic idea is that besides the "normal" "addition" " darken only"
layer modes, to implement a "custom mode". In it, the user gets to
type a c-like expression of what to do with the pixel values
in each channel when combining the layer.

For example: RD=(R2 + R1) /2; GD=G2; BD= B1;
will average the red component, pick the green component from
the upper layer, and the blue component from the underlying image.

Another example:
ED=VD> 0.5? DARKEN_ONLY : LIGHTEN_ONLY;
If the Pixel value is greater than 0.5 (50%), then combine it as in
the Darken Only mode, else, use Normal mode.

And it also works as a "paint mode", so custom paint mode comes as a bonus with this feature.

I had little time to fuss with it over the first month, and now I could
manage to get some work going on - still only on a  few hours per week.

I should make it clear that although I'd like to see it in the GIMP, at this time it's not what concerns me. If people think it's a nice feature, it can be made to work in a clean way before August 10th - actually, it already does work in a clean way, just lack features.

If no one is interested, I will appreciate help and feedback nonetheless, and once it's finished, I will just publish the patch to a stable version of the GIMP on my page.

However, I am getting some results now, so, I'd like to bring
the discussion here, for there is a lot there is unknown to me
in the GIMP tree.


(From here on, this message should be "readable" by people familiar] to the source code of the gimp. I mean - if you are confused with this, just skip the rest of the mail.)

First of all, I have the "engine" fairly complete in the
app/paint-funcs/paint-funcs-generic.h file. Unfortunattely, I am working
off-town, and can only recompile my GIMP, and hack it at all
on the weekend.


And now, I am thinking on
a way to get the custom combination data getting to it. For testing, so far,I had hardcoded the combiantion expression on the source file.


As far as I have thought, I'd like to feed it through a call in the
combine_sub_region() paint-funcs.c function, passing extra data
if mode==GIMP_CUSTOM_LAYER_MODE  than it passes to the
other functions. Actually, it will have to be this way.

At the same time the most obvious way to keep track of this data
is putting it in image parasites. So, if a layer has got a custom mode,
it's mode is attached to it in a parasite.

One issue I am having at the moment is that I'cannot figure out how
to get the Parasite data from inside the "combine_sub_region" function -
that function doesn't seen to be aware of in which image it is
operating.  I think that once I have the image id, it's allright
to call the parasite functions on the libgimp-base api from within there.


One other doubt I have is where to put the ENUMs I need for the operators inside the engine. I can see the easier way is to add them to app/bse/base-enums.h.
Is there any problem with it?


And, while away from home, I try to get more familiarized with the code through browsing the cross referenced code on the developers page. But that only shows the files up to line 206. Is that correct? Is tehre a way to see the whole code files from that site?

So far...any feed back is welcome.

Thanks everybody.


JS -><-




[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux