Commit Graph

5086 Commits

Author SHA1 Message Date
Ell 1c68617302 app: use {begin,end}_render() and GimpTileHandlerProjectable ...
... in GimpProjection and gimp_display_shell_render() (the latter
is not really necessary, but whatever.)
2017-08-08 15:39:27 -04:00
Ell 426bc371cd app: add GimpTileHandlerProjectable
GimpTileHandlerProjectable is similar to GimpTileHandlerValidate,
except that it calls {begin,end}_render() on its associated
projectable before validating.
2017-08-08 15:39:27 -04:00
Ell f0aec02dff app: add gimp_projectable_{begin,end}_render()
In pass-through mode, the group layer-stack's input is connected to
the backdrop.  However, when rendering the group's projection, we
want to render the stack independently of the backdrop.
Unfortunately, we can't use the stack's graph as a subgraph of two
different graphs.

To work around that, the next few commits add a mechanism for a
projectable to be notified before and after its graph is being
rendered.  We use this mechanism to disconnect the stack's graph
from the backdrop before rendering the projection, and reconnect
it afterwards.  Yep, it's ugly, but it's better than having to
maintain n copies of (each node of) the graph (each nesting level
requires an extra copy.)

This commit adds {begin,end}_render() functions to GimpProjectable.
These functions should be called right before/after rendering the
projectable's graph.
2017-08-08 15:39:27 -04:00
Ell dc1d61ff91 app: handle excludes_backdrop in GimpGroupLayer
When any of the children of a pass-through group excludes its
backdrop, the group itself should exclude the backdrop too.  Override
get_excludes_backdrop() to follow this logic, and call
update_excludes_backdrop() when this condition might change.

Note that we always composite pass-through groups using src-over mode,
so to actually hide the backdrop, we need to disconnect it from the
group's mode node's input pad (and reconnect it, when the backdrop is
no longer hidden).
2017-08-08 15:39:27 -04:00
Ell 10371ec22f app: implement pass-through mode in GimpGroupLayer
Override GimpDrawable::get_source_node() for GimpGroupLayer.  Use
a node that contains both the drawable's buffer-source node, and the
layer stack's graph node.  Choose which one of these to connect to
the source node's output based on the group's layer mode: the stack
graph for pass-through mode, and the buffer-source node for all the
rest.

When in pass-through mode, connect the source node's input (which
receives the backdrop) to the stack graph's input.  Keep maintaining
the projection in pass-through mode.  ATM, the projection uses the
same graph as the source node, so it's rendered against the group's
backdrop -- we don't want that.  The next few commits fix it.

Update the group's drawable directly upon filter stack update in
pass-though mode, because the group's graph doesn't go through the
projection.

TODO: if any of the group's children (or a child of a nested pass-
through group, etc.) uses dst-atop/src-in, this needs special
attention.
2017-08-08 15:39:27 -04:00
Ell ac3190215b app: connect layer backdrop to source node's input
Make sure the input of the layer's filter node is connected to its
source node (when it has an input pad), so that, once we implement
pass-though mode, the group's source node can see the backdrop.
2017-08-08 15:39:27 -04:00
Ell 785a0834a2 app: add GimpDrawable::get_source_node() vfunc
For pass-through groups, we want to use the group's layer-stack
graph directly in its filter node, in place of the drawable's
buffer-source node.  Add a get_source_node() vfunc to GimpDrawable,
which defaults to returning the buffer-source node, and use it in
gimp_drawable_get_source_node() instead of using the buffer-source
node directly.  We'll later override this function for
GimpGroupLayer.
2017-08-08 15:39:26 -04:00
Ell 440d8d6855 app: add pass-through layer mode
Only add the enum-value/mode-info for now.  Pass-through mode
appears above normal mode, in the default group, for layer groups
only.
2017-08-08 15:39:26 -04:00
Michael Natterer c41e8eca86 Bug 785535 - Histogram not updating in real when filters are active
Add "gboolean with_filters" to gimp_drawable_calculate_histogram(),
which is passed as FALSE in almost all places, except the histogram
dockable where we want to see both the drawable's unmodified histogram
*and* the histogram after filters are applied.
2017-08-05 17:15:31 +02:00
Michael Natterer 12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Michael Natterer bf6c3cb4ba app: add gimp_drawable_has_filters()
which returns TRUE if the drawable has any visible filter.
2017-08-05 15:37:56 +02:00
Jehan 7c171b4df9 app: exclusive visibility in item group only toggles within the group.
Shift-click should actually toggle only within a given group. The new
capability of toggling only a sub-item, brought by commit 970e9ac is
still feasible in 2 steps: first toggling the parent (item group), then
the desired child.
It brings now a third possibility with exclusive toggle among many
children items, without touching other groups and top-level items.
2017-07-30 16:35:37 +02:00
Michael Natterer 7d5f1e44f2 app: change GimpSettings to store its time as gint64
and use GDateTime for handling it.
2017-07-23 15:18:55 +02:00
Michael Natterer bef155ef30 app: prepend "Last used: " to the names of the automatic filter presets
and add a tooltip about renaming them in order to save them
permanently.
2017-07-18 00:29:45 +02:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Michael Natterer 3f6e9e429d app: don't crash in gimp_tool_info_get_description()
Found and tracked down by Elle Stone.
2017-07-05 18:34:37 +02:00
Michael Natterer e21be2f3d9 app: rename GimpToolInfo's "blurb" and "help" members
to "label" and "tooltip". More standard names, less confusion.
2017-07-04 21:58:11 +02:00
Michael Natterer bcb6b77bde app: change GimpColorTool to not touch tool->display and tool->drawable
Instead, pass a GimpDisplay around in all virtual functions and use
that instead. Some preparation for more fancy subclasses using
GimpToolWidgets.
2017-06-30 21:23:29 +02:00
Michael Natterer 84e1f757ce app: store the snap offsets in GimpToolWidget
Rename gimp_tool_widget_snap_offsets() to set_snap_offsets(),
and add gimp_tool_widget_get_snap_offsets().

Also rename gimp_tool_widget_status() to set_status(), and
add new function and signal set_status_coords().
2017-06-24 21:09:18 +02:00
Jehan 970e9aca90 app: exclusive visibility toggle should also update same level items.
When toggling visibility of a child in an item group, we should also
toggle the visibility of other items in the same group, as well as
top-level items. Otherwise toggling exclusive visibility of any item in
a group is identical to toggling the parent's exclusive visibility,
which is simply absurd.
We still don't touch visibility of items in other groups.
2017-06-23 20:35:25 +02:00
Michael Natterer c3766b6109 app: make the points array const in gimp_channel_select_polygon() 2017-06-23 01:38:30 +02:00
Michael Natterer 96b8023091 app: add gimp_image_pick_vectors(), remove gimp_draw_tool_on_vectors() 2017-06-22 11:35:57 +02:00
Michael Natterer 523b73ff04 app: move guide and sample point picking to gimpimage-pick-item.[ch]
They are not actually items, but close enough.
2017-06-22 09:43:50 +02:00
Michael Natterer a72026820f app: rename gimpimage-pick-layer.[ch] to gimpimage-pick-item.[ch] 2017-06-22 08:17:40 +02:00
Ell c83f0e88af app: add virtual transform/type-conversion functions to GimpLayer
The GimpLayer implementation of the GimpItem transform functions,
and the GimpDrawable convert_type() function, apply their operation
to both the layer and its mask.  The subclasses of GimpLayer --
GimpGroupLayer and GimpTextLayer -- override some of these
functions, providing their own logic for the layer part, and
duplicating the mask part.

Avoid this duplication by adding a set of virtual transform and
type-conversion functions to GimpLayer.  Have the GimpLayer
implementaion of the corresponding GimpItem and GimpDrawable
functions use these functions to apply the operation to the layer,
while taking care of the mask themselves.  Have GimpLayer's
subclasses override the new virtual functions, instead of the
GimpItem and GimpDrawable ones.

Note that the existing implementation of convert_type() in
GimpTextLayer neglected to convert the mask, hence text layer masks
retained their old format after conversion.  This issue is fixed as
a side effect of this commit.
2017-06-17 13:42:41 -04:00
Michael Natterer 6cd91f1fde app: move the handle transform matrix calculation to gimp-transform-utils.[ch] 2017-06-17 10:03:24 +02:00
Ell 1c25a2f0bf app: remove double identity check from raster brush transform funcs
The identity parameter checks added to the raster brush
transformation functions in the previous commit are unnecessary,
since we're already testing for the identity matrix.  Remove them.
2017-06-14 15:47:29 -04:00
Ell c690ed6bf1 Bug 771616 - Changing parametric brush Hardness parameter doesn't work properly
Check if the brush parameters match the identity parameters, and
return the original brush mask/pixmap if they do, in the actual
mask/pixmap transformation virtual functions, instead of in their
wrappers.  While the identity parameters for raster brushes are
always scale=1, aspect-ratio=0, angle=0, and hardness=1, for
generated brushes they depend on the specific brush
parameterization.
2017-06-14 15:21:23 -04:00
Michael Natterer 18fe8f61a5 app: add GimpToolCompass, which is the entire canvas GUI of the measure tool 2017-06-11 23:38:55 +02:00
Ell 20ccc4ed59 app: pad flipped/rotated drawables with transparency, not bg color
... when clipping, if they have an alpha channel

Right now, this case is only reachable through PDB, but it will become
relevant for the flip tool soon.
2017-06-11 15:09:18 -04:00
Michael Natterer adb826fb39 app: allow filter actions to have hardcoded default operation settings
by encoding them directly in the string attached to all filter
actions. The code now supports both "gegl:some-operation" and
"gegl:some-operation\n<serialized config>".

Add "default_settings" to GimpGeglProcedure to store the settings of
the invoking action, much like the "default_run_mode" member.

Change filters-commands.c to parse the new operation string, create
GimpGeglProcedures with the deserialized settings, and use those
settings when the procedures are ran.

Change the filter history to be smarter about what is already in the
history, there can now be several different procedures with the same
name.

Remove the dilate and erode actions from the drawable group, and add
them to filters, they are just special cases of value-propagate with
fixed settings.
2017-06-03 22:08:43 +02:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Jehan 0dbdf232d5 app, menus: rename confusing layers-text-tool and vectors-path-tool.
"layers-text-tool" action shows as "Text Tool" while "vectors-path-tool"
shows as "Path Tool". That's very confusing with tools-text and
tools-vectors respectively.
These actions are mostly about entering in edit mode with the active
layer or path. For text layers, it will enter text edition on canvas,
whereas just open the attributes edition dialog on other layers. For
consistency, layers-text-edit is renamed as well too layers-edit-text.
This also fix the side effect of commits 10099bd and 526918b where I
didn't realize that layers-text-tool was also working on non text layers
on purpose (being very badly named). Now there is a separate layers-edit
and layers-edit-text.
Thanks to Pat David for English corrections. :-)
2017-05-16 00:04:24 +02:00
Ell 99ab780d9f app: update layer backdrop only after removing from stack
When a layer is removed from a layer stack, and its backdrop needs
invalidating, emit the UPDATE signals for the backdrop only after
the layer has been removed from the container.
2017-05-12 15:54:08 -04:00
Ell dd8e2e9b5e app: don't invalidate layer when invalidating its backdrop
Harmless, but unnecessary.
2017-05-12 15:54:07 -04:00
Ell 07ac78ef8d app: add GimpLayerStack
A subclass of GimpDrawableStack, for layer stacks.  Invalidates the
layers' backdrop as/when necessary, according to the value of their
excludes_backdrop property.

Make gimp_drawable_stack_update() protected, instead of private, so
that we can use it in GimpLayerStack.
2017-05-11 17:44:56 -04:00
Ell a051002295 app: add GimpLayer::excludes_backdrop property
A boolean flag, specifying whether the backdrop is clipped to the
layer.  That's the case when the layer's composite mode is dst-atop
or src-in.

This is a read-only property, derived from the other attributes of
the layer.  We compute its value through a virtual function, so that
GimpGroupLayer will eventually be able to specialize it for pass-
through groups.

The next commit uses this property to actually do something useful.
2017-05-11 17:44:55 -04:00
Ell b5974d3457 app: make LCH lightness select-criterion faster
babl already has a faster path for getting L only, than going
through LCH.
2017-05-11 17:44:55 -04:00
Michael Natterer 3f420614ff app, libgimpbase: allow to select colors by CIE L, C, and H
Add the additional enum values to enum GimpSelectCriterion, and
the few needed lines to gimppickable-contiguous-region.c.

It's horribly slow, but works.
2017-05-09 22:02:19 +02:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Ell 0ccb5e6bf9 app: don't prepare input color transform for source filters
... which don't have an input pad.  It CRITICALs.
2017-05-04 11:55:10 -04:00
Michael Natterer 722a1a1368 app: add gimp_edit_paste_as_new_image() and use it from GUI and PDB 2017-05-01 19:10:52 +02:00
Michael Natterer 536cc8531a app: keep the src image's resolution and unit in copied/cut GimpBuffers
and use them for the new image in "Paste as new image". We were using
the resolution and unit of the image the paste command was invoked
from, which is entirely random and useless.
2017-05-01 18:39:13 +02:00
Michael Natterer c2b7983c34 app: remove unused old render structs from gimpdrawable-blend.c 2017-05-01 02:27:46 +02:00
Michael Natterer 530b62a53e app: s/imagemap/drawablefilter/ in some comments 2017-04-30 21:15:26 +02:00
Ell 3ae9c12623 app: fix more leaks in gimp_image_merge_layers() 2017-04-23 11:07:22 -04:00
Ell 3f7b135a2a app: fix memory leak in gimp_image_merge_layers() 2017-04-23 10:50:42 -04:00
Michael Natterer bcc3437f5f Bug 344684 - Greyscale (no alpha) clipboard brushes are of the wrong type
Add a "mask-only" property to GimpBrushClipboard. When TRUE, only
create a brush mask (not a pixmap brush with mask and image).

Keep two clipboard brushes around: one classic "Clipboard Image" one
to be used as "stamp", and one new "Clipboard Mask" one that turns the
clipboard into a brush mask.
2017-04-19 17:33:44 -03:00
Michael Natterer 6eeb5c2ee2 app: support clipboard images in the clipboard brush and pattern 2017-04-19 16:52:10 -03:00
Ell 5255d91032 app: fix total weight calc. of hardness convolution kernel 2017-04-08 07:37:28 -04:00
Ell 670be1f880 app: fix brush offset when shrinking to compensate for blur 2017-04-08 06:50:43 -04:00
Ell 810f1fc722 app: disable brush blur caching
Blurring is much faster now, and the cache mostly gets in the way.
This is a quick hack to disable blur caching for now.
2017-04-08 05:15:55 -04:00
Ell 3bed373bff app: various brush hardness improvements
Fix brush shrinking used to compensate for the blur: avoid over-
shrinking the brush and changing its aspect ratio.

Change the way hardness maps to blur radius: hardness == 0 maps to
the largest radius such that, when the kernel is applied to the
middle pixel of the brush, the kernel is completely within the brush
bounds, taking brush shrinking into account, *assuming the brush is
a circle*.

Use the dimensions of the unrotated brush when calculating the blur
radius, so that rotation doesn't affect the blur amount (the blur
itself is not isotropic, though, and is applied after rotation, so
while the blur amount remains uniform, its effect does depend on the
brush angle.)

Get rid of the blur-radius upper limit -- it's fast enough to handle
large radii now.
2017-04-08 05:15:29 -04:00
Ell 257504cbc2 Bug 780859 - Brush hardness blur is slow
A few additional minor speedups.

Also, make sure we don't overflow for large blur radii.  Not a
problem yet, since the blur radius is capped, but soon...
2017-04-08 04:30:35 -04:00
Ell da30b86ffc Bug 780859 - Brush hardness blur is slow
Add a specialized convolution algorithm for the hardness blur.  It
uses the same kernel as before, but performs the convolution in
(amortized) O(1)-per-pixel time, instead of O(n^2), where n is the
size of the kernel (or the blur radius).

Note that the new code performs the convolution in the input color
space, instead of always using a linear space.  Since our brush
pixmaps (but the not masks) are currently perceptual, the result is
a bit different.
2017-04-07 10:25:21 -04:00
Jehan 79a0ca5927 app: "shift" property in tiling was to be soft-limited by image width. 2017-03-27 23:46:11 +02:00
Michael Natterer a0521a520f app: change the "XCF compat" stuff to "XCF compression"
Both in the GimpImage API and in the GUI. The toggle in the save
dialog now controls ZLIB compression directly. Changed the various
info labels accordingly. Ditch the XCF parasite that saved the XCF
compat mode.
2017-03-23 18:03:27 +01:00
Michael Natterer dd47e7bc3d Bug 731390 - XCF files have a max size of 4G
Enable 64 bit file offsets in XCF files, starting with newly added XCF
version 11.

We use at least version 11 if:

- we would use the previous version 10 (essentially skipping 10)
- the in-memory size of the image is larger than 4 Gig
2017-03-23 14:17:56 +01:00
Jehan bc344a9991 Bug 750180 - Fix different ways of writing Plug-in Plug-In Plugin.
It was agreed that we should write "plug-in" consistently. Only possibly
user-visible strings were updated.
Thanks to scootergrisen for a first patch which could not make it
after changing decision on the canonical writing.
2017-03-21 17:52:22 +01:00
Ell 5ea5458938 app: fix child offsets of a pasted layer group
Use gimp_item_translate() instead of gimp_item_set_offset() to set
a pasted item's position, so that the offsets of pasted layer group
children are updated correctly.  Otherwise, only the group itself
moves, while its children remain positioned relative to the top-left
corner of the image.
2017-03-17 05:25:24 -04:00
Ell 03756d0980 app: rename "Color (HSV) (legacy)" mode to "Color (HSL) (legacy)"
The color-space qualification is, in fact, a 2.9 thing, so there's no
historic reason to keep the wrong name for the legacy mode.
2017-03-16 06:23:30 -04:00
Ell 661c22c06f app: rename "Color (HSV)" mode to "Color (HSL)"
... since that's the color space it actually works in.

Keep the legacy "Color (HSV)" mode's name as is, wrong as it is,
since, well, that's what it used to be called...
2017-03-15 19:30:01 -04:00
Ell 3fa2c91502 app: remove mono-mix layer mode
This effectively reverts commit c6c0899655.

Removing due to lack of consensus.  We can always re-add it in the
future if we decide we want it.
2017-03-15 14:52:14 -04:00
Ell 1b0966d964 app: fix double node insertion to a graphless filter stack
When adding an item to a filter stack that doesn't have a graph yet,
calling gimp_filter_stack_update_last_node() may ultimately lead to
the invocation of gimp_filter_stack_get_graph(), which would create
a new graph, and add the item's node to it; gimp_filter_stack_add()
would then erroneously attempt to re-add the node to the graph.

Fix this by calling gimp_filter_stack_update_last_node() after
(potentially) adding the node to the graph in
gimp_filter_stack_add().
2017-03-12 20:26:13 -04:00
Ell ed0fda032d app: add split layer mode
Subtracts the source layer from the destination, such that
recompositing the result with the source using merge mode
reproduces the original content.
2017-03-10 18:56:32 -05:00
Ell 23e6984d46 app: add merge layer mode
Merge mode lays the source layer on top of the destination, same as
normal mode, however, it assumes the source and destination are two
parts of an original whole, and are therefore mutually exclusive.

This is useful for blending cut & pasted content without artifacts,
or for replacing erased content in general.
2017-03-10 18:56:32 -05:00
Ell c6c0899655 app: add mono-mix layer mode
Calculates the dot product of the two input colors, and uses that
as the value for all the output color's components.  Basically,
a per-pixel mono mixer.

Useful for custom desaturation, component extraction, and crazier
stuff (bump mapping!)
2017-03-10 16:33:14 -05:00
Ell dfb3ddc4d9 app: make erase mode an ordinary layer/paint mode
Include erase mode in the menu for layers and general paint tools.
This makes the eraser tool somewhat unnecessary, but allows for
interesting use cases (e.g., airbrush eraser, etc.)
2017-03-10 15:27:03 -05:00
Jehan 22247339ce Bug 779827 - Brushes in Symmetry Tiling mode are off by one pixel.
Computation for tiled brush position has to be done in integer, not
double, to avoid funky type conversion rounding.
2017-03-10 03:56:57 +01:00
Ell b22c09e7b7 app: implement color-erase mode as a GimpOperationLayerMode blendfun
... and get rid of the dedicated op.  This gives us support for all
the blend/composite options for this mode.

Rename COLOR_ERASE to COLOR_ERASE_LEGACY, with perceptual blending/
compositing and immutable everything, and add a new COLOR_ERASE
mode, defaulting to linear blending/compositing, with mutable
everything.  Modify affected code.
2017-03-08 14:13:51 -05:00
Ell a57c7fb129 app: fix bottom-of-stack dissolve layers using src-atop/in 2017-02-26 22:02:41 -05:00
Michael Natterer fb3d1e4508 app, pdb, libgimp: rename values of enum GimpConvertPaletteType 2017-02-26 20:55:00 +01:00
Michael Natterer ed1ab140fb app, pdb, libgimp: rename values of enum GimpConvertDitherType
being exported to libgimp, and having a non-exported value, this is a
horrible mess like with GimpLayerMode, but at least the cruft value
names are deprecated now.
2017-02-26 20:13:09 +01:00
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Michael Natterer 0c9d76d93a app: fix profile transforms in GimpDrawableFilter
Now that gimp:profile-transform is fixed, we simply need to give
it the right pixel format and things seem to work right.
2017-02-24 21:31:53 +01:00
Michael Natterer 8e2ad168af app: make GimpDrawableFilter's color management more correct
Need to convert both from the drawable's profile to the filter's input
format and from the filter's output format back to the drawable's
profile. This change fixes things for the case where the filter's
input and output formats are different.
2017-02-22 22:31:13 +01:00
Ell bb95793eff app: nicer formatting for GIMP_COMPONENT_MASK_ALL 2017-02-20 20:25:59 -05:00
Michael Natterer fa18c25e94 app: introduce XCF version 10 for the new layer modes
Also, list all modes explitly in gimp_image_get_xcf_version() (no
default:) so we get a compiler warning if we forget to to add new
modes here.
2017-02-20 18:31:21 +01:00
Michael Natterer 314ad956f8 app, libgimp: commit regenerated files after enum GimpLayerMode change
and reorder the GimpLayerModeInfo array correctly.
2017-02-20 18:21:12 +01:00
Elle Stone aaed8a6eb9 app: Bug 753163 - Add blend mode "RGB Luminance"
This adds a blend mode similar to CIE Luminance - but that does not alter
saturation.
2017-02-20 13:54:37 +01:00
Ell 1572bccc9f app: add support for subpixel image grids
In particular, this enables grids whose points of intersection
are at the middle of the image's pixels, which is useful for
undistorted painting with odd-sized brushes using tools other than
the pencil.

This commit also changes the grid visibility behavior, so that the
the visibiltiy of horizontal and vertical grid lines (depending on
the zoom level) is independent.
2017-02-19 18:13:41 -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
Michael Natterer 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
Michael Natterer 8634b5cbc3 app: make layer blend color space and compositing color space configurable
...they say it's going to get worse before it gets better...
2017-02-12 23:49:26 +01:00
Michael Natterer 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 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
Øyvind Kolås 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
Øyvind Kolås 3f91ad7f3c app: replace some layer mode logic with data driven functions 2017-02-04 20:04:17 +01:00
Michael Natterer 2a96d598c3 app: add internal and PDB API and UI to control a layer's composite mode
Largely based on a patch by Ell, with the enum type renamed and
various small changes. Adds another axis of configurability to the
existing layer mode madness, and is WIP too.
2017-02-02 00:38:25 +01:00
Ell d2f50e608d app: change composite mode of erase to SRC_ATOP 2017-01-31 18:22:46 -05:00
Michael Natterer 1924212dcf app: remove "default:" from the switch in gimp_layer_mode_get_operation()
and list all modes explicitly; preparation for moving all of this info
to some table of structs.
2017-01-31 22:48:03 +01:00
Michael Natterer 2dbf1b46b2 app: rename gimp_layer_mode_is_linear() to gimp_layer_mode_wants_linear_data() 2017-01-31 01:43:48 +01:00
Michael Natterer 8771361cb9 app: move arrays of magic GimpLayerMode knowledge to gimp-layer-modes.c
and provide API to access them.
2017-01-31 01:33:11 +01:00
Michael Natterer d348220997 app: remove the HSV modes from the default layer mode group 2017-01-30 22:07:51 +01:00
Michael Natterer 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
Øyvind Kolås 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
Michael Natterer 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
Michael Natterer 312e3ba4d2 app: add gimp_layer_mode_get_for_group()
which allows to find the "same" layer mode in another group.
2017-01-28 18:24:40 +01:00