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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://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;
|
|
|
|
gdouble angle;
|
|
|
|
gdouble hardness;
|
|
|
|
gdouble aspect_ratio;
|
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,
|
2016-01-28 02:13:17 +08:00
|
|
|
GimpPaintApplicationMode mode,
|
|
|
|
GeglNode *op);
|
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,
|
2016-01-28 02:13:17 +08:00
|
|
|
GimpPaintApplicationMode mode,
|
|
|
|
GeglNode *op);
|
2011-04-06 04:11:27 +08:00
|
|
|
|
|
|
|
void gimp_brush_core_color_area_with_pixmap
|
|
|
|
(GimpBrushCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const GimpCoords *coords,
|
2016-01-28 02:13:17 +08:00
|
|
|
GeglNode *op,
|
2012-04-14 14:41:08 +08:00
|
|
|
GeglBuffer *area,
|
2012-04-08 05:38:46 +08:00
|
|
|
gint area_x,
|
|
|
|
gint area_y,
|
2011-04-06 04:11:27 +08:00
|
|
|
GimpBrushApplicationMode mode);
|
|
|
|
|
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,
|
2016-01-28 02:13:17 +08:00
|
|
|
GeglNode *op,
|
2011-04-06 04:11:27 +08:00
|
|
|
GimpBrushApplicationMode brush_hardness,
|
|
|
|
gdouble dynamic_hardness);
|
|
|
|
|
|
|
|
void gimp_brush_core_eval_transform_dynamics
|
2011-04-06 15:11:25 +08:00
|
|
|
(GimpBrushCore *paint_core,
|
2011-04-06 04:11:27 +08:00
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
const GimpCoords *coords);
|
|
|
|
|
2010-03-15 08:20:13 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
#endif /* __GIMP_BRUSH_CORE_H__ */
|