Commit Graph

216 Commits

Author SHA1 Message Date
Jehan 4776b092bd app: action names set in GimpToolControl don't need the group name appended.
Not with the new GAction-based actions.
2023-04-12 22:07:08 +02:00
Jehan ebf99132eb app: create a new pixel-size-set action for Ink and Brush tools.
Once this is done, I got rid of the ugly hack I added over the already
ugly hack used on "*-set" enum actions.
2022-08-17 14:20:18 +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
Jehan 03af9da83b app: GimpTool multi-drawable aware.
Right now I don't change the logics of any of the tools, except that the
GimpTool class now stores a list of drawables instead of a single
drawable. This can be later used on a case-by-case basis to make various
tools actually work on multiple drawables.
2020-05-26 14:15:17 +02:00
Ell ef2818231f app: fix cursor precision of source tools
In GimpCloneTool, set the cursor precision to PIXEL_CENTER while
setting a source, and have GimpBrushTool snap the brush outline to
pixel centers.
2019-01-31 06:22:45 -05:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell e02a339e01 app: reorganize gimppainttool-paint, to allow use by subclasses
We'd like subclasses of GimpPaintTool to be able to issue paint
commands to the tool's paint-core (in particular, see the next
commit.)  Since paint commands should be executed on the paint
thread, the subclasses must not call the paint-core functions
directly, but should rather let gimppainttool-paint issue the
commands on their behalf.

Reorgainze gimppainttool-paint to make it usable for this purpose
by subclasses.  In particular, add
gimp_paint_tool_paint_core_paint() and
gimp_paint_tool_paint_core_interpolate(), which call the
corresponding paint-core functions on the paint thread.

Additionally, rename the {start,end,flush}_paint() virtual
functions of GimpPaintTool to paint_{start,end,flush}(), and rename
gimp_paint_tool_is_painting() to gimp_paint_tool_paint_is_active(),
so that all the gimppainttool-paint-related stuff are grouped under
the same namespace.
2018-04-16 09:56:39 -04:00
Ell 09b16f6cc0 app: avoid copying the brush boundary on each brush tool flush()
In GimpBrushTool, remember the settings used for the last cached
brush boundary, and avoid creating a new copy if the settings
didn't change.  This should lower the overhead of
gimp_brush_tool_flush_paint() when not using dynamics.
2018-04-14 18:43:11 -04:00
Ell 45c172a885 Bug 795257 - Segmentation fault crash using the clone tool
Commit f5cb1fed85, which performed
brush outline generation in GimpPaintTool in synchrony with the
paint thread, wasn't enough, since GimpSourceTool could still call
gimp_brush_tool_create_outline() directly during its
GimpDrawTool::draw() method, leading to the same race condition
when executed concurrently with the paint thread.

Partially revert the above commit, so that outline generation is
handled as before, as far as GimpPaintTool is concenered.  Instead,
add GimpPaintTool::{start,end,flush}_paint() virtual functions; the
first two are called when starting/ending painting using the paint
thread, while the third is called during the display-update
timeout, while the main thread and the paint thread are
synchronized.  This allows subclasses to perform non-thread-safe
actions while the threads are synchronized.

Override these functions in GimpBrushTool, and cache the brush
boundary in the flush() function.  Use the cached boundary in
gimp_brush_tool_create_outline() while painting, to avoid the above
race condition, both when this function is called through
GimpPaintTool, and through GimpSourceTool.
2018-04-14 10:14:58 -04:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Ell a0b73420ec app: add support for brush reflection
Add support for reflecting brushes as part of their transformation.
The reflection is performed as the last step of the transformation,
across the vertical axis.

The option to reflect the brush is not exposed in the UI, or
through the PDB, but is intended to be used for linking the brush
transformation to the view transformation, in the next commit.
2017-12-22 17:52:29 -05:00
Michael Natterer 2229d0aed8 Bug 740939 - No shortcut actions for changing tool's spacing, hardness and force
Add generic tool actions for spacing, hardness and force, and the
GimpToolControl infrasctructure to redirect them to tool-specific
actions. Add tool-specific actions for GimpBrushTool, GimpMybrushTool
and GimpWarpTool as redirect targets. Also fix some existing tool
action callbacks to use the right increase/decrease steps.
2016-03-22 23:54:40 +01:00
Alexia Death 59364ea76d app: separate fallback cursor from primary indicator cursor
Separate fallback use of a cursor from using a plain size
indicator cursor. Ink tool uses a plain circle as primary
drawing indicator instead of outline, totally different
use than a fallback, when brush is too small to be drawn.

Conflicts:
	app/tools/gimppainttool.c
2014-11-19 00:41:43 +02:00
Michael Natterer 242ccacdcc app: s/paint_brush/paintbrush/ in the paintbrush action code 2014-05-03 22:55:05 +02:00
Michael Natterer 0bdb74710a app: rename the value-1...value-4 actions to opacity, size, aspect, angle 2014-04-19 20:09:39 +02:00
Michael Natterer 6e726f248f app: use the right aspect and angle actions for GimpBrushTool 2014-04-19 19:53:40 +02:00
Michael Natterer d897188e32 app: also move the "draw brush outline" logic from brush to paint tool
So all paint tools honor the setting.

Add GimpPaintTool::get_outline() which either returns an outline, or
calls gimp_paint_tool_set_draw_cursor() and implement it in
GimpBrushTool and GimpInkTool. Handle all brush/circle/fallback
drawing in gimp_paint_tool_draw().
2014-04-12 15:03:15 +02:00
Michael Natterer 1ade034c49 app: move "show paint tool cursor" logic from GimpBrushTool to GimpPaintTool
Now all paint tools (also ink and mypaint brush) honor the setting and
can work without mouse cursor.
2014-04-12 12:54:08 +02:00
Michael Natterer 66010e6c6d Bug 623734 - No brush outline with dynamics set to 'size' on 'pressure'
Improve the logic in gimp_brush_tool_draw() and draw a brush-sized
circle if the actual brush outline got scaled away by dynamics.
2014-04-12 01:13:11 +02:00
Michael Natterer e8459beb24 app: don't create a fallback crosshair in gimp_brush_tool_create_outline()
Instead, draw the crosshair in gimp_brush_tool_draw() if create_outline()
didn't return an item *and* if there is no brush tool cursor.

In gimp_source_tool_draw(), don't add an additional crosshair if
create_outline() returned an item.

This fixes both "no cursor at all" and "both outline and crosshair
shown" for certain prefs settings conbinations (bug #623734).
2014-04-09 14:53:24 +02:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Michael Natterer 8b57ef51cc app: clean up the new brush outline stuff a bit 2011-06-30 09:27:43 +02:00
Alexia Death 3c3657f780 app: Refactor path code to support styles and add outline style for use in brush outline 2011-06-29 23:05:14 +03:00
Michael Natterer 91550117c7 app: fix GimpSourceTool's source position drawing for other displays
by adding the source outline's canvas item to the source display
directly. Poking in GimpDrawTool internals is gone and generally not
possible any longer since GimpCanvasItem based drawing.
2011-05-04 23:25:55 +02:00
Michael Natterer 0315f483e6 app: some general GimpPaintCore cleanup 2011-04-06 09:11:25 +02:00
Michael Natterer 21b8007b29 app: add GimpBrushCache which stores brush stuff based on transform parameters
such as masks and outlines. The cache is currently very stupid and
only cacheds the last transformed object. Add caches to GimpBrush for
its mask, its pixmap and its boundary, and remove the same caches and
a ton of members from GimpBrushCore. This involves adding lots of
const qualifiers because GimpBrush returns const pointers now for
trasnformed stuff.
2011-04-05 22:15:30 +02:00
Michael Natterer a50f668d87 app: GimpBrushCore: simplify brush and dynamics setting
by checking for an actual change in the setters. Remove the
"foo != core->foo" checks from all callers.
2011-04-05 19:05:55 +02:00
Michael Natterer 647a576cd4 app: use the new brush boundary API in GimpBrushTool 2011-04-04 21:14:57 +02:00
Michael Natterer ea34b145e8 app: some random tool cleanup 2011-04-04 00:01:30 +02:00
Michael Natterer 6a046d09e4 app: GimpBrushTool: don't split brush setting in two callbacks
The need to both connect() and connect_after() to "set-brush" is gone
because XOR drawing is gone.
2011-03-30 23:38:14 +02:00
Michael Natterer 2e406872c4 app: GimpBrushTool: don't set a BAD cursor permanently
by chaining up after setting it. Instead, don't set it and call
gimp_tool_set_cursor() directly when there is no brush or no dynamics.
2011-03-30 19:18:29 +02:00
Michael Natterer afa8a416c9 app: don't crash if GimpBrushTool has no dynamics to paint a brush outline
Also, set the BAD cursor when there isn't both brush and dynamics
available.
2011-03-24 20:21:57 +01:00
Michael Natterer 503a9cebce app: implement GObject::constructed() instead of ::constructor() 2011-01-13 10:06:07 +01:00
Michael Natterer 32926c9b6a app: implement GimpTool::options_notify()
instead of connecting to the tool options manually.
2010-11-10 14:20:33 +01:00
Alexia Death 8663b22c2a app: Fixes to brush scale->size replacement 2010-10-30 21:38:54 +03:00
Michael Natterer 22db39afd2 app: fix incomplete earlier s/GtkAnchorType/GimpHandleAnchor/ change 2010-10-18 20:13:09 +02:00
Michael Natterer 3de4d7263a app: Bug 631619 - Drawing artifacts spread by paintbrush outline on canvas
Add a transform matrix to GimpCanvasBoundary and get rid of the whole
BoundSeg transform code in boundary.c and gimpbrushcore.c, it was
impossible to get this right on that level. Also fix te extents of
GimpCanvasBoundary os it leaves no artifacts.
2010-10-09 22:00:19 +02:00
Michael Natterer 49f2204a8a app: add a newline 2010-10-05 09:08:56 +02:00
Michael Natterer 4492725110 app: add some (disabled) code that draws the untransformed brush outline 2010-09-26 22:27:55 +02:00
Michael Natterer b3af235e79 app: rename all gimp_draw_tool_draw_foo() functions
to gimp_draw_tool_add_foo() because that's what they do now.
2010-09-25 19:02:22 +02:00
Michael Natterer 7a6a57c42f app: remove code in draw() that special cases drawing vs. undrawing
GimpDrawTool::draw() is not used for undrawing any longer.
2010-09-24 21:18:45 +02:00
Michael Natterer 4d0c750327 app: get rid of "gboolean use_offsets" in the draw tool
and always pass image coordinates. Transform the coords manually in
the very few places which passed TRUE.
2010-09-23 19:23:27 +02:00
Alexia Death 054bd341bd app: fix incomplete revert 2010-03-19 21:21:01 +02:00
Alexia Death 1e8ec625df Revert "app: Fix the code that disables outline to be a bit neater"
This reverts commit 58d82dcadc.
2010-03-19 21:21:01 +02:00
Alexia Death 656eb53aad Revert "app: Do not show brush outline when painting"
This reverts commit 031dc8e68a.
2010-03-19 21:21:01 +02:00
Alexia Death 58d82dcadc app: Fix the code that disables outline to be a bit neater 2010-03-17 00:36:19 +02:00
Alexia Death 031dc8e68a app: Do not show brush outline when painting
It takes resourses and jsut gets in the way of seeing the real brush
2010-03-16 23:48:56 +02:00
Alexia Death bd2f852ac1 app: make off-canvas changes have effect on brush outline 2010-03-16 21:53:34 +02:00
Alexia Death 44a5a34d7e app: Make brush boundaries dynamic aswell 2010-03-15 02:55:15 +02:00
Michael Natterer c5b856f16f Use gimp_display_get_image() instead of display->image 2009-10-06 19:20:44 +02:00