Commit Graph

221 Commits

Author SHA1 Message Date
63f1ec4101 app, libgimp, plug-ins: remove the _LINEAR layer mode variants
Missing: PDB API to set the various sub-modes we now have for layer modes.
2017-02-19 23:15:59 +01:00
Ell
d42f5c4253 app: don't depend on mask alignment for SSE compositing 2017-02-18 20:56:21 -05:00
Ell
f2ea995316 app: fix infinite recursion when compositing unaligned buffers 2017-02-18 20:24:51 -05:00
Ell
eff87d4fcb app: make blend/composite attributes of color-erase immutable 2017-02-17 18:19:32 -05:00
Ell
60466dce3e app: implement the different composite modes for anti-erase mode 2017-02-17 18:19:32 -05:00
Ell
15f5d5780e app: implement the different composite modes for replace mode 2017-02-17 18:19:32 -05:00
Ell
b6d7be4a0f app: implement the different composite modes for behind mode 2017-02-17 18:19:32 -05:00
Ell
7a755d5b52 app: implement the different composite modes for dissolve mode 2017-02-17 18:19:32 -05:00
Ell
d1a0c253c2 app: implement the different composite modes for normal mode 2017-02-17 18:19:32 -05:00
Ell
7402127505 app: remove GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA and friends
Instead, add a gimp_layer_mode_get_format() function, which takes
the layer mode, composite space, and blend space, and returns the
I/O format.

Currently, we always use the composite space format as the I/O
format.  This simplifies gimp_composite_blend(), and gives us
composite-space support for the "special" layer mode ops for free.
2017-02-17 18:19:32 -05:00
Ell
50d8455890 app: avoid some GCC warnings due to unhandled switch cases 2017-02-17 18:19:32 -05:00
Ell
e30d235ede app: derive the layer-mode menu layout entirely from the info arrays
Replace the 'with-behind' and 'with-replace' properties with a
single 'context' property, and use it to select the included
layer modes, according to their context mask.

Add a dummy GIMP_LAYER_MODE_SEPARATOR value to the GimpLayerMode
enum, and use it to explicitly mark the menu separators in the
layer-mode group arrays; add separators to the layer-mode menu
accordingly.

Update the rest of the code to use 'context' instead of 'with-behind'
and 'with-replace'.  In particular, in the layers and layer options
dialogs, select the right context based on whether or not the
selected layer is a group.
2017-02-17 06:26:32 -05:00
Ell
c3d2f57e28 app: add GimpLayerModeContext enum
A bitmask, specifying in which contexts a layer mode is applicable.
Can be a combination of:

  - LAYER: usable as a layer mode for actual layers.
  - GROUP: usable as a layer mode for layer groups.  Currently, all
    modes that specify LAYER also specify GROUP, and vice versa,
    but the planned pass-through mode will be GROUP only.
  - PAINT: can be used as a paint mode.
  - FADE: can be used for fading.

Add a 'context' field to _GimpLayerModeInfo, and provide context
masks to all the modes.

Use the context mask for validation when setting a layer's mode.
The next commit will use the mask when populating the layer mode
menus.
2017-02-17 05:57:13 -05:00
Ell
33f470fb0f app: more layer mode info
Make the layer mode arrays more readable, and fill in more fields,
even for modes that don't use them yet.  Fix a few existing entries.
2017-02-17 05:36:58 -05:00
a2462907ca app: clean up gimpoperationlayermode.c a bit 2017-02-16 19:00:44 +01:00
ebd939cb6d app: merge the GimpLayerModeFunc into gimp-layer-modes.c's array
and remove gimplayermodefunctions.[ch].

Make gimp_operation_normal_process() a normal function and redirect to
SSE internally.
2017-02-15 02:25:44 +01:00
57360a0ddc Bug 778597 - Eraser paints transparent areas with BG color
Add a "paint_composite_mode" field to GimpLayerModeInfo and set the
mode of the eraser to SRC_ATOP. Defaulting to SRC_OVER for all
painting didn't quite do it for all modes.
2017-02-14 23:04:28 +01:00
Ell
df45936743 app: add more IMMUTABLE flags to the layer modes 2017-02-14 16:51:51 -05:00
cb733efe34 app: add layer mode flags to mark blend and compositing modes immutable
set all legacy modes to completely immutable and the LAB modes'
blend mode to immutable. Change GimpLayer setters and the UI
accordingly. Remove the LAB color spaces from the GUI, they can
only be used with the LAB blend modes anyway and not changed.
2017-02-13 22:12:39 +01:00
Ell
b3dea58cfd app: fix SRC_ATOP and DST_ATOP too
They can be affected by the same problem described in
commit 4c3a772cd8, although in the
case of SRC_ATOP, the affected pixels are always fully transparent.
2017-02-05 22:32:08 -05:00
Ell
4c3a772cd8 app: fix SRC_OVER composite mode
When the source alpha is zero, we don't calculate the blended color,
so `comp[b]` can be infinite or NaN, in which case the expression
`in[ALPHA] * (comp[b] - layer[b])` is NaN, rather than the expected
value of zero.
2017-02-05 21:39:40 -05:00
a3b8d0ceed app: some cleanup and adding const in gimp-layer-modes.c 2017-02-05 16:30:54 +01:00
daf206c745 app: make struct GimpLayerModeInfo private 2017-02-05 16:06:53 +01:00
2950fecf07 app: move layer mode enums and gimp-layer-modes.[ch] to operations/
and to operations/layer-modes/, respectively.

Add gimp_layer_modes_init() which asserts on the correct order of the
GimpLayerModeInfo array, and switch to accessing the array directly in
gimp_layer_mode_info().
2017-02-05 15:59:29 +01:00
Ell
1284715f11 app: fix composite mode of erase mode 2017-02-04 22:29:41 -05:00
Ell
8f4700b839 app: add "hard mix" blend mode
Similar to the Photoshop mode of the same name.  Assigns
either 0 or 1 to each of the channels, depending on whether the
sum of source and destination channel values is less than, or
greater than (or equals to), one, respectively.

This is equivalent to inverting the source, and using it to perform
per-pixel, per-channel threshold against the destination, which is
useful for various effects.
2017-02-04 21:30:56 -05:00
5c873bd93f Reintroduce a cleaner version of the linear light fix 2017-02-05 03:25:14 +03:00
005b16ee06 Revert "Resurrect previous version of the linear light formula and fix it"
This reverts commit 1366592f9f.
2017-02-05 03:22:07 +03:00
1366592f9f Resurrect previous version of the linear light formula and fix it 2017-02-05 01:32:56 +03:00
e69924b4eb Fix the linear light layer mode formula
This simpler version provides the rendering that matches
Photoshop's one.
2017-02-05 01:19:53 +03:00
7a000a0991 app: include composite mode in legacy layer mode info
Otherwise normal mode doesn't work due to optimizations.
2017-02-04 23:19:35 +01:00
0159d0b734 Fix the vivid light formula 2017-02-04 22:59:48 +03:00
Ell
1a2ef41492 app: fix handling of fully desaturated colors in lch chroma mode 2017-02-03 13:55:30 -05:00
eb93475deb app: improve data in layer mode info array 2017-02-03 16:05:21 +01:00
d97be7edd0 app: add repository of layer mode information 2017-02-03 01:53:10 +01:00
Ell
1214d4acf1 app: move all special-case mode processing optimizations to GimpOperationLayerMode
Stuff like passing "input" directly if "aux"'s opacity is 0, etc.
Used to be partly handled by normal mode, even though it applies
to other modes too.

Adjust the logic for the new compositing modes.

Add a GimpLayerModeAffectMask enum, and a corresponding
get_affect_mask() function to GimpOperationLayerMode, which
specifies which of the op's inputs, if any, are affected by the
mode, apart from the overlapping regions.  Most modes affect only
the overlapping regions, but dissolve and replace also affect the
rest of the input.  This information is used for determining if
the optimizations are applicable.
2017-02-02 17:40:05 -05:00
e957347dd6 app: build layer mode operations with SSE2 flags.
Some of the generic files still contain SSE2 code, in particular
gimpoperationlayermode.c. The reason why it often works without is that
native gcc will usually pre-define SSE macros by default.
To check this: gcc -dM -E - < /dev/null | grep SSE
Yet I had a case on a small netbook where the SSE macros were not
pre-defined even though supported. Consequently the build failed.
2017-02-02 21:41:15 +01:00
7447b505f9 app: tab and space cleaning. 2017-02-02 21:41:15 +01:00
Ell
c6a2a64604 app: add composite mode support to erase mode 2017-01-31 18:16:44 -05:00
9397aff96f app: add GIMP_LAYER_MODE_LUMA_DARKEN_ONLY and _LUMA_DARKEN_ONLY
which are perceptual versions of the new LUMINANCE_DARKEN_ONLY and
LUMINANCE_LIGHTEN_ONLY modes. Add the new modes to the UI.
2017-01-30 22:07:51 +01:00
e9a6d93197 app: add darken only, lighten only that uses luminance
These variations on darken only and lighten only have the advantage over the
componentvise versions that they always use the full triplet of either original
or new layer - meaning no new colors/hues will be introduced. This is similar
to how these modes operated/operates in picture publisher and photo-paint.
2017-01-29 22:27:28 +01:00
5389e8e417 app, libgimp: rename GIMP_LAYER_MODE_NORMAL to NORMAL_LINEAR
and NORMAL_NON_LINEAR to NORMAL, so it's consistent with all other
modes.
2017-01-28 21:38:52 +01:00
31241a984e app, libgimp: remove GIMP_LAYER_MODE_DARKEN,LIGHTEN_ONLY_LINEAR
There is no _LINEAR variant, the modes always do the same.
2017-01-25 22:08:06 +01:00
09af8dbca5 app: slight optimization of sse2 for src_atop 2017-01-25 21:14:14 +01:00
e1c1a5a9a8 app: implement SSE2 acceleration of src_atop 2017-01-25 12:54:20 +01:00
0fcf4ca59d app: remove gimpblendcomposite.h from Makefile.am, it's gone 2017-01-24 23:54:56 +01:00
579676cfe4 app: fix grain_extract behavior
The blending function of grain merge was being used instead of grain extract.
2017-01-24 19:19:19 +01:00
Ell
9128f3fc87 app: skip color calculation in the blend funcs if either dest or src ...
... is fully transparent, instead of just src.

The blend func results only affect the intersection of dest and src.
Run time is currently dominated by the compositing step for most modes,
so the difference in performance is pretty negligible, but it does make
a difference for the more expensive modes, like the HSV ones.
2017-01-24 11:27:40 -05:00
59471adfee app: remove default from gimp_layer_mode_get_blend_fun switch
This makes gcc warn when new cases have been added to the layer mode enum,
better than silently failing at runtime.
2017-01-24 02:53:39 +01:00
d836d94114 app: implement non-legacy blend modes in GimpOperationLayerMode
For operations needing to override default behavior sub-classes should still be
used.

This commit also enables pinligh, vividlight and linearlight blend mode modes
2017-01-23 23:47:56 +01:00