Commit Graph

129 Commits

Author SHA1 Message Date
Jehan d5670644b4 app: make painting with applicator working in multi-drawable mode. 2021-09-14 17:59:47 +02:00
Jehan 977807985b app: fix broken source painting offset.
As expected from early changes of code, painting was widely broken with
offsetted layers, because previous code used to process the drawable
offset earlier in the painting process, on paint tool level, whereas now
the tool gives coordinates in image space to the paint core (because it
gives a list of drawables which may have different offsets, hence image
space is the only valid coordinates space). This means the various paint
core algorithms must handle each drawable's offset at actual painting
time.
2021-09-14 17:59:47 +02:00
Jehan 8934d43975 app: make painting possibly multi-drawable aware.
- Make the various virtual methods of GimpPaintCore use a list of
  drawables as argument instead of a single drawable.
- gimp_brush_core_eval_transform_dynamics() can work with an image as
  argument rather than a drawable as it doesn't actually depends on
  specific drawable data.
- New function gimp_paint_tool_enable_multi_paint() to be used in init()
  method of paint tools to announce that this tool can work with
  multiple layers selected.
- Use gimp_paint_tool_enable_multi_paint() in the GimpSourceTool base
  class only for now.

This is a first step for multi-layer drawing, but we don't want it to be
possible in just any random cases, which is why I add a special function
to advertize this capability. We will use it for special-casing the
clone (as well as heal and perspective tools most likely) tool to work
on several layers at once. At this step, it is still very bugged and not
really working properly. In particular, since we don't process the
drawable offset early anymore (because it makes no sense when we pass a
list of drawables with different offsets), I suspect that all the
offset-related code will be very broken.
2021-09-14 17:59:47 +02:00
Ell 95429ad704 Issue #3723 - Symmetry Painting with random colour isn't symmetrical
In GimpPaintbrush, calculate grad_point in
_gimp_paintbrush_motion() independently of any stroke, and pass
its value down to GimpPaintbrush::get_paint_params() at each
stroke, so that the color is the same for all strokes, even when
using a color/random dynamics.
2019-08-02 22:28:59 +03:00
Ell 86f4d4d41d app: don't add fg color to history in GimpEraser
Add GimpPaintbrush::get_color_history_color() virtual function,
which should return the color to be added to the color history upon
painting, if any.  The default implementation returns the
foreground color, when not using a pixmap brush or color-from-
gradient.

Override this function in GimpEraser, to return the background
color when the affected drawable has no alpha channel, instead of
overriding GimpPaintCore::paint() for this purpose.  This avoids
erroneously adding both the background and foreground colors to the
history.
2019-05-29 05:26:40 -04:00
Ell aba4eef916 app: derive GimpEraser from GimpPaintbrush
In GimpPaintbrush, factor out the code responsible for determining
the current dab's paint parameters and content to a new
GimpPaintbrush::get_paint_params() virtual function.

Derive GimpEraser from GimpPaintbrush, instead of directly from
GimpBrushCore, implementing get_paint_params() appropriately.
This allows GimpEraser to reuse the paint-buffer content across
dabs, improving performance.
2019-05-26 14:47:44 -04:00
Ell b63af476bd app: use gimp_symmetry_get_transform() in paint code
Use gimp_symmetry_get_transform() instead of
gimp_symmetry_get_operation() throughout the paint code, where
possible.  This allows us to combine the symmetry transform with
the ordinary brush transform, simplifying the code, improving
performance, and avoiding multiple resamplings.  This also fixes
the paint-buffer size when using mandala symmetry with non-round
brushes, avoiding artifacts.
2019-05-26 14:45:39 -04:00
Ell edc99531e6 app: in GimpPaintbrush, reuse existing paint buffer
In GimpPaintbrush, avoid refilling the paint buffer at each dab if
the paint color/pixmap hasn't changed, as gimp_paint_core_paste()
no longer modifies the buffer since the commit before last.

Additionally, fix color-from-gradient dynamics when the image has a
profile.
2019-05-15 10:54:45 -04:00
Ell 5b09af4390 app: improve gimp_brush_core_color_area_with_pixmap()
Reimplement gimp_brush_core_color_area_with_pixmap(), which copies
the brush's dab to the paint buffer when using a pixmap brush, in
terms of gimp-gegl-loops.  This simplifies the functions,
parallelizes processing, and transparently handles float brushes.

Replace the "mode" parameter of the function with an "apply_mask"
parameter, which specifies whether to apply the brush's mask to
the dab as part of copying.  Avoid applying the mask in
GimpPaintbrush; previously, we would erroneously apply the mask
twice when using the paintbrush tool: once when copying the
dab to the paint buffer, and again when pasting the paint buffer
to the canvas.

We still apply the mask in GimpSmudge, which results in the same
double-application behavior, however, this might be less practical
to fix.
2019-02-24 13:22:20 -05:00
Michael Natterer 6938d11716 Issue #1997 - Colors not properly converted to image's color space
Add a Babl space parameter to gimp_gegl_color_new() and all utility
functions using it. Pass NULL if the GimpRGB actually is sRGB, pass
the image's layer space if the color was already converted using
gimp_pickable_srgb_to_image_color() or similar.
2018-08-09 20:04:44 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 485094b9da app: fix painting with the new layer mode code
by creating temp buffers matching the format needed by the
GimpLayerMode's process_pixels() function.
2017-01-21 00:27:48 +01:00
Michael Natterer 4fefc3817c Bug 766988 - Colors applied to images are not color managed
Color manage colors applied when painting, and when filling, merging,
resizing and transforming drawables.
2016-05-29 17:51:06 +02:00
Michael Natterer ed821c8184 app: formatting cleanup in gimppaintbrush.c 2016-03-13 13:15:19 +01:00
Jehan 76f573c981 Bug 648776 - mirror symmetries.
You can now set any paint tool to mirror painting relatively
horizontal/vertical axis or a central point (any combination of these 3
symmetries).
This has been implemented as a new multi-stroke core, where every stroke
is actually handled as a multi-stroke (default of size 1).
This is also the first usage of custom guides for symmetry guiding.
Current version has to be activated in the playground.
2016-02-02 21:15:13 +01:00
Jehan c7adff4f6f Revert "app: save gradient first and last color with dynamics color output..."
This reverts commit 15b5b2c8b3.
This feature is "undiscoverable" according to Mitch, and we are not sure
how much the endpoint colors are special to the user.
2015-10-08 19:33:07 +02:00
Jehan 15b5b2c8b3 app: save gradient first and last color with dynamics color output...
in the recently used colors palette.
2015-09-30 17:30:50 +02:00
Jehan 52f6a2aeb4 app: save color history when a color is used.
Now the history of recently used colors is not updated when selecting
in the color dialog anymore, but when a color is actually used.
Tools supported right now are: Ink, MyPaint brush, all PaintBrush tools,
bucket fill and eraser (background color on non-alpha drawables).
Moreover from now on, colors already saved are properly moved to first
position when reused.
2015-09-30 16:39:05 +02:00
Michael Natterer 7449316898 app: add gimp_dynamics_is_output_enabled()
and use it to further simplify stuff. Almost no place needs to use a
GimpDynamicsOutput directly now.
2015-04-19 21:58:36 +02:00
Michael Natterer ca07026642 app: simplify handling of the force output in paint methods 2015-04-19 21:27:48 +02:00
Alexia Death ace4234a98 app: make all tools capable of dynamic force respect the options slider 2015-01-19 10:55:56 +02:00
Michael Natterer 548df1fa32 app: change brush-hardness and brush-force range to [0.0..1.0]
and set a factor of 100 on the GUI.
2014-11-17 23:17:13 +01:00
Alexia Death 2a7dbbd438 app: fix force slider dynamics interacttion to just dynamics when activated 2014-11-17 17:05:54 +02:00
Alexia Death d0862180c4 app: fix force default handling 2014-11-17 15:40:33 +02:00
Alexia Death 32e545277b app: fixes for force and hardness 2014-11-17 15:24:59 +02:00
Alexia Death 4421070a6a app: add explicit paint options sliders for hardness and force 2014-11-17 13:13:18 +02:00
Michael Natterer 5d8824f42e app: move all GimpBrush members to a private struct
Add and use accessors for width, height, x_axis and y_axis.
2014-10-12 01:16:32 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer a3a62b4546 app: add shortcut functions gimp_dynamics_get_foo_value()
and use them for simple use cases instead of dynamics_get_output() and
output_get_foo_value().
2012-05-02 17:51:19 +02:00
Michael Natterer 9a4d84e683 app: port gimp_brush_core_color_area_with_pixmap() to GeglBufferIterator
This can be simplified, needs revisiting.
2012-05-02 17:51:03 +02:00
Michael Natterer 95cb77edc9 app: change gimp_image_get_format() to take a base_type and a with_alpha boolean
which kills almost all remaining use of GimpImageType.
2012-05-02 17:51:03 +02:00
Michael Natterer 42a5f01be3 app: rename TempBuf to GimpTempBuf 2012-05-02 17:51:00 +02:00
Michael Natterer 0e9581b956 app: pass the paint area's coords to gimp_brush_core_color_area_with_pixmap()
They are no longer stored in the paint area TempBuf.
2012-05-02 17:50:58 +02:00
Michael Natterer 9ac79ddc9c app: port paintbrush and eraser to paint to GEGL buffers 2012-05-02 17:50:47 +02:00
Michael Natterer 50d7242b87 app: remove gimp_image_transform_rgb()
and use gimp_rgba_get_pixel() instead.
2012-05-02 17:50:43 +02:00
Michael Natterer 7f437d7d53 app: remove gimp_image_get_foreground,background()
and use gimp_context_get_foreground,background_pixel() instead.
2012-05-02 17:50:43 +02:00
Michael Natterer 0810bd2e44 app: make gimp_image_transform_rgb() transform the alpha too
and remove explicit alpha setting in the returned array in most places.
2012-05-02 17:46:00 +02:00
Michael Natterer dc8d6a3977 app: use gimp_image_transform_rgb() instead of transform_color()
instead of fiddling with gimp_rgb_get_uchar() manually.
2012-05-02 17:45:52 +02:00
Michael Natterer cc47b2a600 libgimpwidgets/color: move the cairo color utility functions to libgimpcolor
Add CAIRO_CFLAGS to a lot of Makefiles to make this possible, and
because they pull in cairo via the libgimp headers.
2011-04-28 15:50:39 +02:00
Michael Natterer e3c0a4e549 app: move all GimpDynamics members to private 2011-03-03 18:43:56 +01:00
Michael Natterer 15fd08747d Bug 595170 - brush - color from gradient works wrong in greyscale
Convert the gradient color to the drawable's type before using it.
2010-06-27 01:55:21 +02:00
Alexia Death 78a4cae2d5 app: Rewire the the feature formely known as harndess back to gui as force 2010-04-09 00:44:52 +03:00
Alexia Death 355f1bfd56 app: Fix tabs to spaces for dynamics 2009-12-19 17:36:27 +02:00
Alexia Death b95dda6eea app: Fix dynamics mixing for inputs&outputs that have paint options toggles 2009-12-18 20:51:23 +02:00
Michael Natterer 0c81d491fb Change coords in GimpDynamicsOutput from call-by-value to "const GimpCoords*" 2009-10-27 14:30:20 +01:00
Michael Natterer e094dc5627 Whitespace fix 2009-10-13 20:21:58 +02:00
Michael Natterer aae7c2ef38 Bail out early if dynamic opacity results in 0.0
Same change needed anywhere, more to come.
2009-10-13 20:18:55 +02:00
Michael Natterer 77faffe4b7 Rename the output members of GimpDynamics from foo_dynamics to foo_output 2009-10-12 14:45:12 +02:00
Michael Natterer dab5f9e691 Rename all GimpDynamicsOutput functions to gimp_dynamics_output_foo() 2009-10-11 15:54:59 +02:00
Michael Natterer 330d406acc Move dynamics includes to the .c files where they belong 2009-10-11 15:41:54 +02:00