* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Reuse the blending
formula from the legacy Soft light. (Actually the formula comes
from legacy Overlay but legacy Overlay and Soft light blends
pixels exactly the same.) I hereby declare the porting of the
layer modes to this GEGL operation complete. Summary:
Completely works the same:
Normal, Dissolve, Behind, Color Erase, Erase, Anti Erase
Works the same for 100% opaque layers:
Lighten only, Screen, Dodge, Addition, Darken only, Multiply,
Dodge, Soft light, Hard light, Difference, Subtract, Grain
extract, Grain merge, Divide, Hue, Saturation, Color, Value
Works different but similar:
Overlay now uses the SVG 1.2 overlay formula which is different
but similar to legacy Overlay
Replace needs to be externally masked to not replace too much,
but that is outside the scope of the layer mode porting.
svn path=/trunk/; revision=27541
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Replaced the XXX for
Soft light with a FIXME.
svn path=/trunk/; revision=27514
* app/gegl/gimpoperation*.c: Prefix the GIMP GEGL operations with
"gimp:" instead of "gimp-" so we follow the GEGL prefix style and
better serialize to XML.
* app/tools/gimp*tool.c
* app/core/gimpdrawable-*.c
* app/core/gimpdrawable.c
* app/core/gimpimagemap.c
* app/core/gimpprojection.c: Changed accordingly.
svn path=/trunk/; revision=27512
* app/gegl/gimpoperationpointlayermode.c: Introduced helper macros
fooC to properly un-multiply pre-multiplied data without causing
NaNs. This fixes some compositing issues involving complete
transparency.
svn path=/trunk/; revision=27511
* app/gegl/gimpoperationpointlayermode.c: Renamed fooC aliases to
fooCa since they represent pre-multiplied color data.
svn path=/trunk/; revision=27510
* app/gegl/gimpoperationpointlayermode.c: Get rid of GRand in
process() and use a lut instead. A little benchmark showed a
performance improvement of 78%. Also added defines for the the
size of the area of which Dissolve repeats it dissolve pattern.
svn path=/trunk/; revision=27509
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Implemented Erase, Anti
Erase, Color Erase and Replace. These are not normal layer modes
and handle alpha in their own way. In addition to this, the
behavior of Replace doesn't map very well to GEGL which uses
infinite sized "layers".
Completely works the same:
o Erase
o Anti Erase
o Color Erase
Works different but similar:
o Replace
* app/paint-funcs/paint-funcs.[ch]: Expose
paint_funcs_color_erase_helper() so it can be used in the
GimpOperationPointLayerMode implementation. Once the migration is
complete this function can be moved entirely to the op and be
tailored to work on premultiplied data.
svn path=/trunk/; revision=27502
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Formating,
simplification and fixed operator precedence for the seed (not
that it matters much).
svn path=/trunk/; revision=27487
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): The GEGL API actually
allows us to handle the Dissolve layer mode as a point op. The
GEGL implementation of Dissolve uses a faster implementation for
deterministic behavior than the legacy Dissolve implementation.
The end result should be identical (although not on the
pixel-level).
Completely works the same:
o Dissolve
svn path=/trunk/; revision=27485
2008-10-29 Sven Neumann <sven@gimp.org>
Bug 558451 – Cannot build GIMP using Sun CC on Solaris 2.8
* app/pdb/gimp-pdb-compat.c
* app/gegl/gimpoperationtilesink.c
* app/gegl/gimpoperationtilesource.c
* app/tools/gimpgegltool.c: applied patches from Eric Lamarque
fixing the build using Sun CC on Solaris.
svn path=/trunk/; revision=27467
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Implemented the layer
modes Hue, Saturation, Color and Value.
Works the same for 100% opaque layers:
o Hue
o Saturation
o Color
o Value
* libgimpcolor/gimphsl.[ch]: Added gimp_hsl_set().
svn path=/trunk/; revision=27466
* app/gegl/gimpoperationpointlayermode.c
(gimp_operation_point_layer_mode_process): Put the existing blend
formulas in expanded switch cases again. We need to keep the more
complicated layer modes like Hue, Value and Saturation in expanded
switch cases anyway.
svn path=/trunk/; revision=27449
* app/gegl/gimpoperationpointlayermode.c: Clamp Addition and
Subtract so that we acheieve consistent blending results. Also,
our Addition is fine, it is the formula for 'plus' in the SVG 1.2
draft that is wrong as far as I can see.
svn path=/trunk/; revision=27421
* app/gegl/gimpoperationpointlayermode.c: Continue the quest of
overviewable and readable blend formulas. The macro now expands to
entire case-statements.
svn path=/trunk/; revision=27420
* app/gegl/gimpoperationpointlayermode.c: For blend modes with
conditions, fix so that the conditions are per color
channel. Acheived by introducing a nice little preprocessor macro.
svn path=/trunk/; revision=27412
* app/gegl/gimpoperationpointlayermode.c: Enable the [0..1]
clamping of the output for Dodge and Burn. Without the clamping
one gets inconsistent results when blending together identical
layers but with different opacities. Maybe we should make the
clamping configurable and introduce a HDR compositing mode or
something?
svn path=/trunk/; revision=27411
* app/gegl/gimpoperationpointlayermode.c: Implemented Grain
Extract and Grain Merge. Also corrected the formula for Divide.
Works the same for 100% opaque layers:
o Grain Extract
o Grain Merge
svn path=/trunk/; revision=27410
* app/gegl/gimpoperationpointlayermode.c: Implement a bunch of
layer modes. Use the exact SVG 1.2 formula for layer modes that
have a counterpart in SVG 1.2. Don't clamp the result to [0..1]
for Dodge and Burn though as we don't need to. Maybe we *should*
clamp from a compositing point of view, I'm not sure. Also
reformat the code a bit for readability.
Keep in mind that we now treat the opacity of all layers the same
indepentant of the layer mode. That is why most of the new
implementations doesn't work the same as the legacy ones when
transparency is involved, only when the layers are completely
opaque. Another important property for all layer modes implemented
below is that compositing onto complete transparency gives the
same result as if the layer would have been in Normal blending
mode.
The status of the new layer mode implementations compared to the
legacy implementations is as follows:
Completely works the same:
o Behind
Works the same for 100% opaque layers:
o Multiply
o Screen
o Difference
o Darken
o Lighten
o Dodge
o Burn
o Hard Light
o Subtract
o Divide
Works different but similar:
o Overlay
Work in progress:
o Soft Light
svn path=/trunk/; revision=27409
* app/gegl/gimpoperationpointlayermode.c: Completed the rename
with gimp:layer-mode -> gimp:point-layer-mode and also did some
formating.
* app/core/gimplayer.c: Changed accordingly.
svn path=/trunk/; revision=27408
* app/gegl/gimpoperationlayermode.[ch]: Rename to
* app/gegl/gimpoperationpointlayermode.[ch]: so that we can later
create a common GimpOperationLayerMode class/interface for
non-point layer modes like GimpOperationDissolveLayerMode.
* app/gegl/Makefile.am
* app/gegl/gimp-gegl.c
* app/gegl/gegl-types.h: Adjust accordingly.
svn path=/trunk/; revision=27401
GimpOperationLayerMode instantiable and add a GimpLayerModeEffects
property to it that we check in ::process() to blend pixels
together.
* app/gegl/gimpoperationlayermode.[ch]: Do the change described
above. Currently only Normal and Addition are implemented. Normal
so that we don't need a special case for the gegl:normal op. Also,
the Dissolve layer mode is not a point op and needs to be
implemented elsewhere.
* app/gegl/gimpoperation*mode.c: Removed.
* app/gegl/gimp-gegl-utils.[ch]: Removed
gimp_layer_mode_to_gegl_operation().
* app/core/gimplayer.c
* app/gegl/Makefile.am
* app/gegl/gimp-gegl.c: Adapt.
svn path=/trunk/; revision=27400
* app/gegl/gimpoperationlayermode.c: Make layer modes work on
premultiplied data. This makes compositing 40% faster on my test
image with 10 interlaced Normal and Addition mode layers.
* app/gegl/gimpoperationadditionmode.c: Switch to the
premultiplied algorithm and remove the experimental ones. The new
Addition mode has two important differences over the legacy
Addition mode:
o Addition mode now really is commutative as the GIMP
documentation says (this wasn't previously the case).
o Layers in Addition mode are just as opaque as Normal
layers. That is, their effect on the composite alpha channel
is the same. For discussion, refer to bug #387449.
svn path=/trunk/; revision=27396
* app/gegl/gimpoperationadditionmode.c: For alpha compositing
consistency, all layers should affect alpha in the same way
independent of layer mode. Replace the compositing algorithm with
a version without the flaws discovered so far in the previous
ones. Don't use it yet though as it requires premultiplied data.
svn path=/trunk/; revision=27382
* app/gegl/gimpoperation*mode.c: Refer to the input as 'in'
instead of 'src', the layer as 'layer' instead of 'aux', and the
result as 'out' instead of 'dest'.
svn path=/trunk/; revision=27329
* app/gegl/gimpoperationadditionmode.c: Refer to the input as 'in'
instead of 'src', the layer as 'layer' instead of 'aux', and the
result as 'out' instead of 'dest'. The old terminology clashes
with at least the SVG 1.2 compositing terminology [1] and there is
no reason for creating confusion.
[1] http://www.w3.org/TR/2004/WD-SVG12-20041027/rendering.html
svn path=/trunk/; revision=27321
* app/gegl/gimpoperationadditionmode.c: Use local variants of
channel offset defines, namely RED instead of RED_PIX etc, to
increase readability.
svn path=/trunk/; revision=27320
2008-10-13 Michael Natterer <mitch@gimp.org>
* app/gegl/gimp-gegl-utils.[ch]: remove function
gimp_bpp_to_babl_format_linear() and add "gboolean linear"
parameter to gimp_bpp_to_babl_format().
* app/gegl/gimpoperationtilesink.c (process)
* app/gegl/gimpoperationtilesource.c (prepare): simply pass
self->linear to above changed function instead of selecting
between the two old functions.
svn path=/trunk/; revision=27275
* app/gegl/gimpoperationadditionmode.c
(gimp_operation_addition_mode_process): Update with a new version
that is the best known so far (maybe it's even correct?).
svn path=/trunk/; revision=27269
2008-10-13 Michael Natterer <mitch@gimp.org>
* app/gegl/gimp-gegl-utils.c (gimp_layer_mode_to_gegl_operation):
remove warning because the missing layer modes are now
"implemented", ha ha.
svn path=/trunk/; revision=27252
2008-10-12 Michael Natterer <mitch@gimp.org>
* app/gegl/gimpoperationpointcomposer.[ch]: renamed this class...
* app/gegl/gimpoperationlayermode.[ch]: ...to this and add
an own process() virtual function so we are free to hack even
more badly in order to support legacy layer modes and proper
ones which do meningfiul things to alpha. Simply redirect
GeglOperationPointComposer's compose() calls to our own vfunc
for now.
* app/gegl/gegl-types.h
* app/gegl/Makefile.am: changed accordingly.
* app/gegl/gimpoperation*mode.[ch]: changed parent class and
implemented process() method accordingly.
svn path=/trunk/; revision=27251
2008-10-11 Michael Natterer <mitch@gimp.org>
* app/gegl/gimpoperationpointcomposer.[ch]: add an empty abstract
GeglOperationPointComposer subclass which can be used to hook in
common debug or test or whatever code for below layer modes.
* app/gegl/gimpoperation*mode.[ch]: add empty stubs of layer mode
operations which do nothing but copying input to output.
* app/gegl/Makefile.am
* app/gegl/gegl-types.h: add them here and reordered things a bit.
* app/gegl/gimp-gegl.c (gimp_gegl_init): register the new
operations.
* app/gegl/gimp-gegl-utils.c (gimp_layer_mode_to_gegl_operation):
return the new operations.
svn path=/trunk/; revision=27239
2008-10-09 Michael Natterer <mitch@gimp.org>
Address Bug 554983 – Layers Projection using GEGL
* app/gegl/gimp-gegl-utils.[ch]: add (imcomplete) function
gimp_layer_mode_to_gegl_operation() from bug #554983.
* app/core/gimpdrawable.[ch]: add gimp_drawable_get_source_node()
which returns a GimpOperationTileSource for the drawable's
tiles.
(gimp_drawable_real_set_tiles)
(gimp_drawable_configure): set the node's "tiles" property.
* app/core/gimplayer.[ch]: add gimp_layer_get_node() which returns
a GeglNode with proxy "input" and "output" pads to be plugged
into the projection graph. The node has children for opacity,
mask, layer mode and layer offset.
(gimp_layer_translate)
(gimp_layer_add_mask)
(gimp_layer_apply_mask)
(gimp_layer_set_opacity)
(gimp_layer_set_mode): reconfigure the respective nodes.
* app/core/gimpimage.[ch]: keep a "graph" node around and destroy
it in finalize(). Not even a stub, just a silly GEGL dependency.
svn path=/trunk/; revision=27204
2008-10-09 Michael Natterer <mitch@gimp.org>
* app/gegl/gimpcurvesconfig.c (gimp_curves_config_save_cruft):
when saving a curve of type GIMP_CURVE_FREE, don't use
gimp_curve_get_point() because that returns nothing for free
curves.
(gimp_curves_config_load_cruft): reset the curve before loading it.
* app/core/gimpcurve.c (gimp_curve_get_point): instead of above
mentioned uninitialized nonsense, at least return -1,-1 for free
curves.
svn path=/trunk/; revision=27190