Commit Graph

134 Commits

Author SHA1 Message Date
Shubham 8463544502 app: fix broken symmetry on offset layers
Painting with symmetry enabled on layers with offset was broken. Fixed
it.
2023-07-24 15:55:30 +00:00
Jehan 03edaf5cea app: fix more broken offset in other tools.
Similar to the source core fix, but a bit simpler because we don't have
to deal with a source and a target offset, let's fix offset handling in:
- Blur / Sharpen tool.
- Dodge / Burn tool.
- Ink tool.
- MyPaint brush tool.
- Smudge tool.
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 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 83184d1626 app: add incremental mode to the Dodge/Burn tool
Add an "Incremental" option to the Dodge/Burn tool, which,
similarly to the Paintbrush, Pencil, and Eraser tools, applies the
effect incrementally as the pointer moves.
2019-04-17 10:02:42 -04: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 b926de5ada Bug 783755 - Smudge should blend the smudged colors using linear RGB
Use GIMP_LAYER_MODE_NORMAL (not NORMAL_LEGACY) when falling back from
gimp_paint_core_replace() to gimp_paint_core_paste() for layers
without alpha. Adapt the format of the used paint buffers accordingly.
2017-08-12 21:35:47 +02: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 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
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
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
Michael Natterer a75a479d81 app: #include "core/gimpdynamicsoutput.c" in some files in paint/ 2015-02-15 20:05:30 +01: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 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
Michael Natterer 1a624d4df4 app: remove many includes of "gegl/gimp-gegl-utils.h" 2012-05-10 23:12:39 +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 a15056095b app: enable GimpDodgeBurn on indexed drawables 2012-05-02 17:51:11 +02:00
Michael Natterer 441120b6b5 app: use gimp_gegl_dodgeburn() in GimpDodgeBurn 2012-05-02 17:50:53 +02:00
Øyvind Kolås 6efd812d08 app: s/GIMP_GEGL_RECT/GEGL_RECTANGLE/
Defining GeglRectangle inline is so useful that it has been added to
GEGL.
2012-05-02 17:50:52 +02:00
Michael Natterer c5c555c834 app: add "take_ownerspip" param to gimp_temp_buf_create_buffer()
and get rid of some more intermediate buffer creation/destruction, and
some redundant temp_buf_free() plus g_object_unref().
2012-05-02 17:50:51 +02:00
Michael Natterer 1037c7e88b app: more GEGL in GimpDodgeBurn, still uses gimp_lut_process() 2012-05-02 17:50:49 +02:00
Michael Natterer 1dbadb772d app: rename GimpPaintCore->canvas_buf to ->paint_area
because that's what it's called in public API. This has confused me
long enough now.
2012-05-02 17:50:46 +02:00
Michael Natterer 2af0681587 app: don't create copies in gimp_paint_core_get_orig_image,proj()
and instead simply return the paint_core owned buffers. Also, move
graph creation and source buffer fiddling out of perspective clone's
inner loop, and set an area to be processed manually, which makes it
responsive again.
2012-05-02 17:50:46 +02:00
Michael Natterer e3c0a4e549 app: move all GimpDynamics members to private 2011-03-03 18:43:56 +01: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 005ddab84e Bail out early if dynamic opacity is 0.0 2009-10-13 20:30:54 +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
Alexia Death 3a041ad252 Lots of improvements on dynamics 2009-10-03 18:53:25 +03:00
Alexia Death 4aa3d3f7b0 Build fixes to the dynamics branch. it now builds. 2009-07-21 22:27:29 +03:00
zhenfeng zhao 96baac783f Fade dynamics. Add fade as one more dynamics driving factor on GUI. Implement fading dynamics calculation. Let fade work with all driven factors. Add pixel_dist parameter to get_dynamic_x. Adjusted function calls for get_dynamic_x.
* app/paint/gimppaintoptions.c: Add initialization for fading dynamics. Add fading related variables similar to Random. Adjust get_dynamics_mix function. Add fading calculation in get_dynamics_x functions. Adjust get_dynamic_x functions for fade dynamics.

	* app/paint/gimppaintoptions.h: Add fading_options in GimpDynamicOptions.

	* app/tools/gimppaintoptions-gui.c: Add the function fading_options_gui.

	* app/paint/gimpclone.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimpheal.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimpsmudge.c
	* app/paint/gimpairbrush.c
	* app/paint/gimpbrushcore.c
	* app/paint/gimpconvolve.c: Adjust function calls. get_dynamic_opacity function calls were adjusted to have one more parameter, paint_core->pixel_dist.

some key words:
get_dynamic_
pixel_dist
paint_core->pixel_dist
2009-07-11 15:45:54 -03:00
Michael Natterer 8423757d3f Add forgotten #include "libgimpbase/gimpbase.h" 2009-06-17 20:55:05 +02:00
Michael Natterer bdd8d8e3fb Use more x,y,width,height instead of x1,y1,x2,y2
(gimp_paint_core_get_orig_image)
(gimp_paint_core_get_orig_proj): changed parameters to x,y,width,height.
Update callers accordingly and use x,y,width,height there too except
in gimpperspectiveclone.c which does better with a bounding box.
2009-06-17 20:46:28 +02:00
Michael Natterer cee39b090f Add more GimpCoords* parameters to reduce usage of global paint_core states
Add GimpCoords* to GimpPaintCore::get_paint_area(),
gimp_brush_core_paste_canvas(), gimp_brush_core_replace_canvas(),
gimp_brush_core_get_brush_mask(), gimp_brush_core_color_area_with_pixmap()
and change callers accordingly.
2009-05-17 22:45:06 +02:00
Michael Natterer 07ba32d6f8 Stop accessing GimpPaintCore's coords members directly (no encapsulation yet).
* app/paint/gimppaintcore.[ch]: add
  gimp_paint_core_{get|set}_{current|last}_coords(), add "const GimpCoords*"
  parameter to ::paint() which gets core->cur_coords passed.

* app/paint/gimpsourcecore.[ch]: add "const GimpCoords*" to ::motion().

* app/paint/gimpbrushcore.c: use the new coords getters/setters instead
  of accessing GimpPaintCore members directly.

* app/paint/gimpairbrush.c
* app/paint/gimpclone.c
* app/paint/gimpconvolve.c
* app/paint/gimpdodgeburn.c
* app/paint/gimperaser.c
* app/paint/gimpheal.c
* app/paint/gimpink.c
* app/paint/gimppaintbrush.[ch]
* app/paint/gimpperspectiveclone.c
* app/paint/gimpsmudge.c: change implementations of GimpPaintCore::paint()
  and GimpSourceCore::motion() accordingly. app/paint/ is now virtually
  free of direct access to the paint core's coords members. More to come...
2009-05-03 12:08:21 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00
Michael Natterer 740ab5e633 renamed gimp_item_width() to gimp_item_get_width() and gimp_item_height()
2008-11-03  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: renamed
	gimp_item_width() to gimp_item_get_width() and
	gimp_item_height() to gimp_item_get_height().

	* app/actions/channels-commands.c
	* app/actions/drawable-commands.c
	* app/actions/layers-commands.c
	* app/core/<many>.c
	* app/dialogs/offset-dialog.c
	* app/dialogs/resize-dialog.c
	* app/dialogs/scale-dialog.c
	* app/display/gimpdisplayshell-dnd.c
	* app/display/gimpdisplayshell.c
	* app/paint/gimpbrushcore.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimpink.c
	* app/paint/gimppaintcore.c
	* app/paint/gimpsmudge.c
	* app/text/gimptextlayer-xcf.c
	* app/text/gimptextlayer.c
	* app/tools/gimpaligntool.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpforegroundselecttool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimprectangletool.c
	* app/tools/gimpregionselecttool.c
	* app/tools/gimptexttool.c
	* app/vectors/gimpvectors.c
	* app/vectors/gimpvectorsmodundo.c
	* app/widgets/gimptoolbox-dnd.c
	* app/widgets/gimpviewrendererdrawable.c
	* app/widgets/gimpviewrenderervectors.c
	* app/xcf/xcf-load.c
	* app/xcf/xcf-save.c
	* tools/pdbgen/pdb/drawable.pdb: changed accordingly.

	* app/pdb/drawable-cmds.c: regenerated.


svn path=/trunk/; revision=27531
2008-11-03 00:09:01 +00:00
Michael Natterer 5503e6a055 Add GEGL_CFLAGS and #includes as if gimpdrawable.h and gimpimage.h had a
2008-10-09  Michael Natterer  <mitch@gimp.org>

	Add GEGL_CFLAGS and #includes as if gimpdrawable.h and gimpimage.h
	had a GEGL dependency (they will have in the next commit, but I
	wanted to keep the commit separate).

	* app/dialogs/Makefile.am
	* app/file/Makefile.am
	* app/gui/Makefile.am
	* app/menus/Makefile.am
	* app/paint/Makefile.am
	* app/plug-in/Makefile.am
	* app/text/Makefile.am
	* app/vectors/Makefile.am
	* app/widgets/Makefile.am
	* app/xcf/Makefile.am: add GEGL_CFLAGS.

	* app/actions/*.c
	* app/core/*.c
	* app/dialogs/*.c
	* app/display/*.c
	* app/file/*.c
	* app/gui/*.c
	* app/menus/*.c
	* app/paint/*.c
	* app/pdb/gimppdb-utils.c
	* app/pdb/gimpprocedure.c
	* app/plug-in/*.c
	* app/text/*.c
	* app/tools/*.c
	* app/vectors/*.c
	* app/widgets/*.c
	* app/xcf/*.c: add <gegl.h> or replace <glib-object.h> by <gegl.h>
	to all files which include a drawable subclass or gimpimage.h

	* tools/pdbgen/app.pl: include <gegl.h> instead of <glib-object.h>
	in all generated files.

	* app/pdb/*-cmds.c: regenerated.

	* data/images/gimp-splash.png: the goat is still sleeping.
	By Aurore Derriennic.


svn path=/trunk/; revision=27202
2008-10-09 20:24:04 +00:00
Sven Neumann caa4c529f5 removed 'use_pressure' field from GimpPaintCore.
2008-07-17  Sven Neumann  <sven@gimp.org>

	* app/paint/gimppaintcore.[ch]: removed 'use_pressure' field 
from
	GimpPaintCore.
	
	* app/paint/gimppaintoptions.[ch]: removed 'use_pressure' 
parameter.

	* app/paint/gimpairbrush.c
	* app/paint/gimpbrushcore.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimpheal.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimpsmudge.c
	* app/tools/gimppainttool.c: changed accordingly.


svn path=/trunk/; revision=26225
2008-07-17 19:00:13 +00:00
Michael Natterer fe70064f00 Applied slightly modified and fixed patch from Alexia Death which adds a
2008-05-22  Michael Natterer  <mitch@gimp.org>

	Applied slightly modified and fixed patch from Alexia Death which
	adds a "random" axis to the paint dynamics and fixes some issues
	in the previous paint dynamics commits. Fixes bug #529431.

	* app/core/core-types.h: add a "random" axis to GimpCoords.

	* app/display/gimpdisplayshell-coords.c: set it to a random value.

	* app/display/gimpdisplayshell-callbacks.c: on button_press,
	use the dynamics from the last motion event to avoid blotches
	at the beginning of paint strokes.

	* app/paint/gimppaintoptions.[ch]: add random properties the same
	way we do pressure and velocity. Add get_dynamic_size(),
	get_dynamic_color() and get_dynamic_hardness() functions which
	look at all dynamic parameters of the passed coords.

	* app/tools/gimppaintoptions-gui.c: add gui for the random options.

	* app/paint/gimpbrushcore.[ch]: remove calc_brush_scale() and use
	gimp_paint_options_get_dynamic_size_instead().
	Add "dynamic_hardness" parameters to paste_canvas(),
	replace_canvas() and get_brush_mask().

	* app/paint/gimpairbrushoptions.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimpheal.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimpsmudge.c: calculate the dynamic hardness and pass
	it to above brush core functions. Use the get_dynamic_color() to
	calculate the gradient color.


svn path=/trunk/; revision=25758
2008-05-22 16:38:57 +00:00
Michael Natterer 82c2616f0f Applied modified patch from Alexia Death which adds velocity support to
2008-05-10  Michael Natterer  <mitch@gimp.org>

	Applied modified patch from Alexia Death which adds velocity
	support to paint tools in the spirit of the pressure support we
	already have. Fixes bug #529431.

	* app/display/gimpdisplayshell-coords.c
	(gimp_display_shell_eval_event): tweak velocity calculation to
	work in screen coordinates.

	* app/paint/gimppaintoptions.[ch]: add velocity options in the
	same way as there are pressure options. Add utility functions
	which return dynamic opatity and dynamic rate according to the the
	option's settings and some GimpCoords' pressure and velocity.

	* app/tools/gimppaintoptions-gui.c: add GUI for the velocity
	options.

	* app/paint/gimpbrushcore.h: remove PRESSURE_SCALE define, it's
	now in gimppaintoptions.h.

	* app/paint/gimpbrushcore.c (gimp_brush_core_interpolate):
	inerpolate velocity too.

	(gimp_brush_core_calc_brush_scale): take velocity into account.

	(gimp_brush_core_get_brush_mask): always pressurize the mask in
	the GIMP_BRUSH_PRESSURE because there always is velocity (unlike
	pressure which is only there on tablets).

	* app/paint/gimpairbrush.c
	* app/paint/gimpclone.c
	* app/paint/gimpconvolve.c
	* app/paint/gimpdodgeburn.c
	* app/paint/gimperaser.c
	* app/paint/gimpheal.c
	* app/paint/gimppaintbrush.c
	* app/paint/gimpsmudge.c: get opacity and rate from the new paint
	options utility functions which take both pressure and velocity
	into account.

	* app/paint/gimppaintbrush.c: take velocity into account when
	calculating the gradient color offset.

	* app/paint/gimpairbrush.c: do some additional fiddling with
	velocity in the asynchronous airbrush timeout.

	* app/paint/gimpairbrushoptions.c: override the velocity-size
	property and have it default to FALSE.


svn path=/trunk/; revision=25604
2008-05-10 10:03:21 +00:00
Michael Natterer f532e425e0 add g_return_if_fail().
2008-04-25  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimppaintoptions.c (gimp_paint_options_get_jitter):
	add g_return_if_fail().

	* app/paint/gimpheal.c (gimp_heal_motion)
	* app/paint/gimpdodgeburn.c (gimp_dodge_burn_motion): free stuff
	right after it's not used any longer, instead of at the end of the
	function.

	* app/paint/gimppaintbrush.c (_gimp_paintbrush_motion): move a
	statement to improve consistency with other motion() functions.


svn path=/trunk/; revision=25526
2008-04-25 13:39:36 +00:00
Sven Neumann 41237259c9 In all files, changed the standard copyright notice to say "GIMP - The GNU
2006-12-09  Sven Neumann  <sven@gimp.org>

        * In all files, changed the standard copyright notice to say
        "GIMP - The GNU Image Manipulation Program".
2006-12-09 21:33:38 +00:00
Sven Neumann 6ebcf700d1 removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15  Sven Neumann  <sven@gimp.org>

	* app/*/*.c:
	* lib*/*.c: removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15 09:46:31 +00:00
Sven Neumann 049872b361 app/*.[ch] converted tabs to spaces.
2006-04-12  Sven Neumann  <sven@gimp.org>

	* app/*.[ch]
	* app/*/*.[ch]: converted tabs to spaces.
2006-04-12 12:49:29 +00:00
Sven Neumann 905fdfcbed did a global gimage -> image substitution.
2006-03-28  Sven Neumann  <sven@gimp.org>

	* app/*: did a global gimage -> image substitution.
2006-03-28 17:08:36 +00:00