Commit Graph

103 Commits

Author SHA1 Message Date
Shubham 2a41fc7ee4 app: Blink lock when layer expansion is prevented by lock
In layer expansion if user is trying to draw outside the layer boundary
with expand option turned on but the "Lock position and size" enabled,
the lock square will be blinked. If user is painting on layer mask, the
corresponding layer's lock will be blinked. It will be blinked only
once per stroke.
2023-11-25 16:19:43 +00:00
Shubham 5fdee7c5e7 app: gimp_paint_core_expand_drawable will return boolean
This function returns TRUE if the drawable is expanded. Otherwise, it
will return FALSE. This removes the need to check width and height of
the drawable to infer the same.
2023-11-25 16:19:43 +00:00
Shubham 5191c17fb7 app: Fix layer expansion while painting with symmetry enabled 2023-11-25 16:19:43 +00:00
Shubham 4a953e5b59 app: Separate function for layer expansion while painting
Created a separate function gimp_paint_core_expand_drawable that handles
layer expansion while painting. The gimp_brush_core_get_buffer function
now uses this function to expand drawable. It has been separated so that
it can be reused for ink tool.
2023-11-25 16:19:43 +00:00
Shubham becb23c926 app: Make undo work when layers are expanded during painting
Undo now restores layer to original size if it was expanded while
painting.
2023-11-25 16:19:43 +00:00
Jehan b86c927210 app: fixing painting with a selection. 2021-09-14 17:59:47 +02:00
Jehan d5670644b4 app: make painting with applicator working in multi-drawable mode. 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 2523808e4a app: add gimp_paint_core_{set_show_all,get_image_pickable}()
GimpPaintCore operates indipendently of a display, and hence needs
to be explictly told when operating in "show all" mode, affecting
the result of paint tools operating in "sample merged" mode.  Add
gimp_paint_core_set_show_all() for that purpose, and call it,
passing the current display's "show all" mode, in GimpPaintTool.
This controls which pickable (the image itself, or its projection)
is used as the sampling source, as per
GimpPaintCore::saved_proj_buffer, and as returned by the new
gimp_paint_core_get_image_pickable() function.
2019-09-06 20:10:30 +03:00
Ell c7d8d9ba2e app: use MASK_COMPONENTS algorithm in gimp_paint_core_{paste,replace}()
Remove the mask_components_onto() gimppaintcore-loops function, and
the GimpPaintCore::comp_buffer member.  Instead, in
gimp_paint_core_paste() and gimp_paint_core_replace(), use the
MASK_COMPONENTS algorithm, added in the previous commit.
2019-02-16 09:56:30 -05:00
Ell 4fefab1798 app: fix line-angle constraint when xres != yres
Fix gimp_constrain_line() and friends to properly constrain line
angles when the image's horizontal and vertical resolutions are
different, and dot-for-dot is disabled.
2018-07-15 19:09:06 -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
Ell 984ed6cefd app: constrain line angles in display space, not image space
Add an offset_angle parameter to gimp_constrain_line(), which
offsets the radial lines by a given angle.

Add gimpdisplayshell-utils.[ch], with two new functions:

  - gimp_display_shell_get_constrained_line_offset_angle():
    Returns the offset angle to be passed to
    gimp_constrain_line(), in order to constrain line angles in
    display space, according to the shell's rotation angle and
    flip mode.

  - gimp_display_shell_constrain_line():  A convenience function
    which calls gimp_constrain_line() with the said offset angle.

Use the new functions in all instances where we constrain line
angles, so that angles are constrained in display space, rather
than image space.

The only exception is GimpEditSelectionTool, which keeps
constraining angles in image space, since it's not entirely obvious
that we want to constrain angles of dragged layers/selections in
display space.
2017-12-22 06:32:24 -05: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 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00: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
Michael Natterer d1795ac204 Bug 700193 - undoing paint tools doesn't update last_coords properly
paint_core->start_coords is in fact the last stroke's endpoint and
only used for storing it in GimpPaintCoreUndo, so the last endpoint
can be resotred for straight-line painting after an undo. Make the
code actually doing that.
2013-07-15 00:41:43 +02:00
Michael Natterer 741792875e app: add the GimpApplicator back for painting, but make its use optional
Default to using the new code. This is out of pure curiosity how
GEGL changes affect painting with a purely graph-based method.
2013-05-21 18:55:03 +02:00
Daniel Sabo cd91144f9e Faster paintcore
Directly access the brush and paint buffers rather than using
GEGL iterators.

Replicate the relevant parts of GimpApplicator using direct
access.
2013-05-21 04:03:28 -07:00
Michael Natterer e254fd7c4d app: actually commit the rest of the patch... 2012-05-26 12:42:52 +02:00
Michael Natterer 36fb008197 app: port GimpPaintCore's paste and replase APIs to GeglBuffer 2012-05-02 17:50:54 +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 7b5252ac54 app: replace GimpPaintCore::get_paint_area() by ::get_paint_buffer()
and remove the public TempBuf based get_paint_area() API.
2012-05-02 17:50:51 +02:00
Michael Natterer 12ac0bea13 app: add gimp_paint_core_get_paint_buffer()
which is the same as gimp_paint_core_get_paint_area() but returns a
GeglBuffer to paint to, not a TempBuf.
2012-05-02 17:50:47 +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 7c2c671703 app: make gimp_paint_core_get_orig_image,proj() return GeglBuffers
and change their users accordingly, getting rid of temp buffers and
useless copies.
2012-05-02 17:50:44 +02:00
Michael Natterer eb2e658408 app: replace GimpPaintCore->canvas_buf by a GeglBuffer 2012-05-02 17:50:43 +02:00
Michael Natterer c9d0386e0c app: replace GimpPaintCore->saved_proj_tiles by a GeglBuffer 2012-05-02 17:50:43 +02:00
Michael Natterer 6c59c45612 app: replace GimpPaintCore's undo_tiles by a GeglBuffer
and simply use a dumb straight copy of the drawable, it's GEGL's job
to do proper COW.
2012-05-02 17:46:10 +02:00
Alexia Death d32fa80d1d app: Move smooth to painttool and clean up the rest 2011-09-14 20:44:45 +03:00
Michael Natterer 6a1b93be1c app: don't include "libgimpmath/gimpvectors.h" in any header
It's types are generally known because it's already included
in core-types.h.
2011-04-17 23:44:45 +02:00
Alexia Death 41b1bd36da app: Fix smooth intreaction with airbrush 2011-03-16 22:08:19 +02:00
Alexia Death 803df9b58a app: Make smooth paint core internal 2011-01-09 22:59:01 +02:00
Michael Natterer c29aefccc2 app: fix coding style in the new smoothing code 2011-01-08 22:18:56 +01:00
Alexia Death 339deed1da app: Clean up smooth so it would be acceptable for master 2011-01-08 22:19:27 +02:00
Alexia Death 082aa272a4 app: G-Pen algorithm for GIMP trunk. Now smoothing function works for Ink and Brush tools.
Rebased/fixed to go on top of current master. Next commit will add cleanup.
Had to change author tag because gnome is not accepting random stuff
in email fields. Original author is tarai, from gimp painter project
in sourceforge.
2011-01-08 22:17:26 +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 53c661312b Add GimpCoords* parameter to gimp_paint_core_interpolate()
Pass the current coords to the function instead of setting them
on the paint core before calling it. Doesn't exactly make the code
in the paint tool  simpler, but that needs further refactoring anyway.
2009-05-25 20:49:34 +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 42b28066b8 Move the straight line constrain code to GimpPaintCore.
* app/paint/gimppaintcore.[ch]: add gimp_paint_core_round_line()

* app/tools/gimppainttool.c: remove gimp_paint_tool_round_line() and call
above new function instead.
2009-04-22 21:22:08 +02:00
Michael Natterer 50199a542c Made GimpCoords* parameter of GimpPaintCore::start() const.
* app/paint/gimppaintcore.[ch]: made GimpCoords* parameter of
GimpPaintCore::start() const.

* app/paint/gimpbrushcore.c
* app/paint/gimpclone.c
* app/paint/gimpheal.c
* app/paint/gimpperspectiveclone.c
* app/paint/gimpsourcecore.c: changed accordingly.
2009-04-17 22:29:25 +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 39af762f61 More merging from SOC 2006's vector layer branch:
2008-10-25  Michael Natterer  <mitch@gimp.org>

	More merging from SOC 2006's vector layer branch:

	* app/core/gimpitem.[ch]: add "gboolean push_undo" to
	GimpItem::stroke().

	* app/core/gimpdrawable-stroke.[ch]
	* app/paint/gimppaintcore-stroke.[ch]
	* app/paint/gimppaintcore.[ch] (gimp_paint_core_finish): add
	"push_undo" parameters here too.

	* app/actions/select-commands.c
	* app/actions/vectors-commands.c
	* app/core/gimpchannel.c
	* app/core/gimpselection.c
	* app/dialogs/stroke-dialog.c
	* app/tools/gimppainttool.c
	* app/vectors/gimpvectors.c
	* tools/pdbgen/pdb/edit.pdb
	* tools/pdbgen/pdb/paint_tools.pdb
	* tools/pdbgen/pdb/paths.pdb: pass TRUE all over the place.

	* app/pdb/edit-cmds.c
	* app/pdb/paint-tools-cmds.c
	* app/pdb/paths-cmds.c: regenerated.


svn path=/trunk/; revision=27398
2008-10-25 11:59:03 +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 b2ef4856b0 set core->saved_proj_tiles to NULL after unrefing them.
2007-03-31  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimppaintcore.c (gimp_paint_core_start): set
	core->saved_proj_tiles to NULL after unrefing them.

	* app/paint/gimppaintcore.h: whitespace fixes.


svn path=/trunk/; revision=22210
2007-03-31 16:43:41 +00:00
Michael Natterer 83d3a750d4 include "libgimpmath/gimpmathtypes.h" instead of "libgimpmath/gimpmath.h".
2007-03-09  Michael Natterer  <mitch@gimp.org>

	* app/core/core-types.h: include "libgimpmath/gimpmathtypes.h"
	instead of "libgimpmath/gimpmath.h".

	* app/core/gimpbrush.h
	* app/paint/gimppaintcore.h
	* app/paint/gimpperspectiveclone.h
	* app/text/gimptext.h
	* app/tools/gimptransformtool.h: include gimpvector.h and
	gimpmatrix.h explicitely where they are needed in public structs.

	* app/*/*.c
	* tools/pdbgen/pdb/paths.pdb: include "libgimpmath/gimpmath.h"
	where needed.

	* app/pdb/paths_cmds.c: regenerated.


svn path=/trunk/; revision=22084
2007-03-09 13:00:01 +00:00
Michael Natterer 792ba89818 app/paint/gimppaintcore-undo.[ch] removed...
2007-02-03  Michael Natterer  <mitch@gimp.org>

	* app/paint/gimppaintcore-undo.[ch]
	* app/paint/gimpink-undo.[ch]: removed...

	* app/paint/Makefile.am
	* app/paint/paint-types.h
	* app/paint/gimppaintcoreundo.[ch]
	* app/paint/gimpinkundo.[ch]: ...and added as proper undo classes.

	* app/paint/gimppaintcore.[ch]
	* app/paint/gimpink.c: push undos using the new classes.


svn path=/trunk/; revision=21842
2007-02-03 18:48:00 +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