2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2004-05-26 04:41:09 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2004-05-26 04:41:09 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-05-26 04:41:09 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2004-05-26 04:41:09 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GIMP_BRUSH_CORE_H__
|
|
|
|
#define __GIMP_BRUSH_CORE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "gimppaintcore.h"
|
2009-10-11 19:53:59 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
|
|
|
|
#define BRUSH_CORE_SUBSAMPLE 4
|
|
|
|
#define BRUSH_CORE_SOLID_SUBSAMPLE 2
|
2007-07-04 14:30:34 +08:00
|
|
|
#define BRUSH_CORE_JITTER_LUTSIZE 360
|
2004-05-26 04:41:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
#define GIMP_TYPE_BRUSH_CORE (gimp_brush_core_get_type ())
|
|
|
|
#define GIMP_BRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH_CORE, GimpBrushCore))
|
|
|
|
#define GIMP_BRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_CORE, GimpBrushCoreClass))
|
|
|
|
#define GIMP_IS_BRUSH_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BRUSH_CORE))
|
|
|
|
#define GIMP_IS_BRUSH_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_CORE))
|
|
|
|
#define GIMP_BRUSH_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BRUSH_CORE, GimpBrushCoreClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpBrushCoreClass GimpBrushCoreClass;
|
|
|
|
|
|
|
|
struct _GimpBrushCore
|
|
|
|
{
|
2012-04-09 02:25:49 +08:00
|
|
|
GimpPaintCore parent_instance;
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
GimpBrush *main_brush;
|
|
|
|
GimpBrush *brush;
|
|
|
|
GimpDynamics *dynamics;
|
|
|
|
gdouble spacing;
|
|
|
|
gdouble scale;
|
2017-12-23 05:53:56 +08:00
|
|
|
gdouble aspect_ratio;
|
2012-04-09 02:25:49 +08:00
|
|
|
gdouble angle;
|
2017-12-23 05:53:56 +08:00
|
|
|
gboolean reflect;
|
2012-04-09 02:25:49 +08:00
|
|
|
gdouble hardness;
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2019-05-27 02:21:09 +08:00
|
|
|
gdouble symmetry_angle;
|
|
|
|
gboolean symmetry_reflect;
|
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
/* brush buffers */
|
2012-04-09 02:25:49 +08:00
|
|
|
GimpTempBuf *pressure_brush;
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
GimpTempBuf *solid_brushes[BRUSH_CORE_SOLID_SUBSAMPLE][BRUSH_CORE_SOLID_SUBSAMPLE];
|
|
|
|
const GimpTempBuf *last_solid_brush_mask;
|
|
|
|
gboolean solid_cache_invalid;
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
const GimpTempBuf *transform_brush;
|
|
|
|
const GimpTempBuf *transform_pixmap;
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
GimpTempBuf *subsample_brushes[BRUSH_CORE_SUBSAMPLE + 1][BRUSH_CORE_SUBSAMPLE + 1];
|
|
|
|
const GimpTempBuf *last_subsample_brush_mask;
|
|
|
|
gboolean subsample_cache_invalid;
|
2005-10-05 04:16:52 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
gdouble jitter;
|
|
|
|
gdouble jitter_lut_x[BRUSH_CORE_JITTER_LUTSIZE];
|
|
|
|
gdouble jitter_lut_y[BRUSH_CORE_JITTER_LUTSIZE];
|
2004-05-26 04:41:09 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
GRand *rand;
|
2004-05-26 04:41:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GimpBrushCoreClass
|
|
|
|
{
|
|
|
|
GimpPaintCoreClass parent_class;
|
2004-05-26 17:32:03 +08:00
|
|
|
|
2004-05-28 04:48:49 +08:00
|
|
|
/* Set for tools that don't mind if the brush changes while painting */
|
|
|
|
gboolean handles_changing_brush;
|
|
|
|
|
2007-11-13 17:30:46 +08:00
|
|
|
/* Set for tools that don't mind if the brush scales while painting */
|
2009-02-06 05:47:57 +08:00
|
|
|
gboolean handles_transforming_brush;
|
2011-04-06 04:11:27 +08:00
|
|
|
|
2009-10-28 05:14:44 +08:00
|
|
|
/* Set for tools that don't mind if the brush scales mid stroke */
|
|
|
|
gboolean handles_dynamic_transforming_brush;
|
2004-06-23 20:19:28 +08:00
|
|
|
|
2009-08-20 06:40:33 +08:00
|
|
|
void (* set_brush) (GimpBrushCore *core,
|
|
|
|
GimpBrush *brush);
|
2009-10-12 19:00:16 +08:00
|
|
|
void (* set_dynamics) (GimpBrushCore *core,
|
|
|
|
GimpDynamics *brush);
|
2004-05-26 04:41:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-06 04:11:27 +08:00
|
|
|
GType gimp_brush_core_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
void gimp_brush_core_set_brush (GimpBrushCore *core,
|
|
|
|
GimpBrush *brush);
|
|
|
|
|
|
|
|
void gimp_brush_core_set_dynamics (GimpBrushCore *core,
|
|
|
|
GimpDynamics *dynamics);
|
|
|
|
|
|
|
|
void gimp_brush_core_paste_canvas (GimpBrushCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
gdouble brush_opacity,
|
|
|
|
gdouble image_opacity,
|
2017-01-09 06:00:19 +08:00
|
|
|
GimpLayerMode paint_mode,
|
2011-04-06 04:11:27 +08:00
|
|
|
GimpBrushApplicationMode brush_hardness,
|
|
|
|
gdouble dynamic_hardness,
|
2019-05-27 02:21:09 +08:00
|
|
|
GimpPaintApplicationMode mode);
|
2011-04-06 04:11:27 +08:00
|
|
|
void gimp_brush_core_replace_canvas (GimpBrushCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
gdouble brush_opacity,
|
|
|
|
gdouble image_opacity,
|
|
|
|
GimpBrushApplicationMode brush_hardness,
|
|
|
|
gdouble dynamic_hardness,
|
2019-05-27 02:21:09 +08:00
|
|
|
GimpPaintApplicationMode mode);
|
2011-04-06 04:11:27 +08:00
|
|
|
|
|
|
|
void gimp_brush_core_color_area_with_pixmap
|
|
|
|
(GimpBrushCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpCoords *coords,
|
2012-04-14 14:41:08 +08:00
|
|
|
GeglBuffer *area,
|
2012-04-08 05:38:46 +08:00
|
|
|
gint area_x,
|
|
|
|
gint area_y,
|
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-25 01:54:58 +08:00
|
|
|
gboolean apply_mask);
|
2011-04-06 04:11:27 +08:00
|
|
|
|
2012-04-09 02:25:49 +08:00
|
|
|
const GimpTempBuf * gimp_brush_core_get_brush_mask
|
2011-04-06 04:11:27 +08:00
|
|
|
(GimpBrushCore *core,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GimpBrushApplicationMode brush_hardness,
|
|
|
|
gdouble dynamic_hardness);
|
2019-05-15 21:59:03 +08:00
|
|
|
const GimpTempBuf * gimp_brush_core_get_brush_pixmap
|
2019-05-27 02:21:09 +08:00
|
|
|
(GimpBrushCore *core);
|
2011-04-06 04:11:27 +08:00
|
|
|
|
|
|
|
void gimp_brush_core_eval_transform_dynamics
|
2019-05-27 02:21:09 +08:00
|
|
|
(GimpBrushCore *core,
|
2021-08-17 05:46:32 +08:00
|
|
|
GimpImage *image,
|
2011-04-06 04:11:27 +08:00
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
const GimpCoords *coords);
|
2019-05-27 02:21:09 +08:00
|
|
|
void gimp_brush_core_eval_transform_symmetry
|
|
|
|
(GimpBrushCore *core,
|
|
|
|
GimpSymmetry *symmetry,
|
|
|
|
gint stroke);
|
2011-04-06 04:11:27 +08:00
|
|
|
|
2010-03-15 08:20:13 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
#endif /* __GIMP_BRUSH_CORE_H__ */
|