2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +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
|
1997-11-25 06:05:25 +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
|
1997-11-25 06:05:25 +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/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#ifndef __GIMP_PAINT_CORE_H__
|
|
|
|
#define __GIMP_PAINT_CORE_H__
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#include "core/gimpobject.h"
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
|
|
|
|
#define GIMP_TYPE_PAINT_CORE (gimp_paint_core_get_type ())
|
|
|
|
#define GIMP_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCore))
|
|
|
|
#define GIMP_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
|
|
|
|
#define GIMP_IS_PAINT_CORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_PAINT_CORE))
|
|
|
|
#define GIMP_IS_PAINT_CORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_PAINT_CORE))
|
|
|
|
#define GIMP_PAINT_CORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_PAINT_CORE, GimpPaintCoreClass))
|
2001-02-28 03:18:01 +08:00
|
|
|
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
typedef struct _GimpPaintCoreClass GimpPaintCoreClass;
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
struct _GimpPaintCore
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2004-05-28 04:48:49 +08:00
|
|
|
GimpObject parent_instance;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
gint ID; /* unique instance ID */
|
2006-09-03 21:16:58 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
gchar *undo_desc; /* undo description */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2013-07-15 06:41:43 +08:00
|
|
|
GimpCoords start_coords; /* the last stroke's endpoint for undo */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
GimpCoords cur_coords; /* current coords */
|
|
|
|
GimpCoords last_coords; /* last coords */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
GimpVector2 last_paint; /* last point that was painted */
|
2003-07-14 22:50:41 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
gdouble distance; /* distance traveled by brush */
|
|
|
|
gdouble pixel_dist; /* distance in pixels */
|
2002-02-16 01:44:05 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
gint x1, y1; /* undo extents in image coords */
|
|
|
|
gint x2, y2; /* undo extents in image coords */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
gboolean use_saved_proj; /* keep the unmodified proj around */
|
2002-02-13 22:50:37 +08:00
|
|
|
|
2012-03-30 22:24:09 +08:00
|
|
|
GeglBuffer *undo_buffer; /* pixels which have been modified */
|
|
|
|
GeglBuffer *saved_proj_buffer; /* proj tiles which have been modified */
|
2012-03-30 22:38:52 +08:00
|
|
|
GeglBuffer *canvas_buffer; /* the buffer to paint the mask to */
|
2013-05-21 19:03:28 +08:00
|
|
|
GeglBuffer *comp_buffer; /* scratch buffer used when masking components */
|
2012-04-02 03:59:36 +08:00
|
|
|
GeglBuffer *paint_buffer; /* the buffer to paint pixels to */
|
2012-04-01 00:28:18 +08:00
|
|
|
gint paint_buffer_x;
|
|
|
|
gint paint_buffer_y;
|
2011-01-08 02:45:29 +08:00
|
|
|
|
2013-05-21 19:03:28 +08:00
|
|
|
GeglBuffer *mask_buffer; /* the target drawable's mask */
|
|
|
|
gint mask_x_offset;
|
|
|
|
gint mask_y_offset;
|
2012-05-26 18:42:52 +08:00
|
|
|
|
2013-05-22 00:52:40 +08:00
|
|
|
GimpApplicator *applicator;
|
|
|
|
|
2013-05-21 19:03:28 +08:00
|
|
|
GArray *stroke_buffer;
|
1997-11-25 06:05:25 +08:00
|
|
|
};
|
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
struct _GimpPaintCoreClass
|
2001-02-27 13:21:12 +08:00
|
|
|
{
|
2002-02-15 03:31:16 +08:00
|
|
|
GimpObjectClass parent_class;
|
2001-02-27 13:21:12 +08:00
|
|
|
|
2004-05-26 04:41:09 +08:00
|
|
|
/* virtual functions */
|
2012-04-02 03:20:12 +08:00
|
|
|
gboolean (* start) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
const GimpCoords *coords,
|
|
|
|
GError **error);
|
|
|
|
|
|
|
|
gboolean (* pre_paint) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time);
|
|
|
|
void (* paint) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
2016-01-28 02:13:17 +08:00
|
|
|
GimpSymmetry *sym,
|
2012-04-02 03:20:12 +08:00
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time);
|
|
|
|
void (* post_paint) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState paint_state,
|
|
|
|
guint32 time);
|
|
|
|
|
|
|
|
void (* interpolate) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
guint32 time);
|
|
|
|
|
|
|
|
GeglBuffer * (* get_paint_buffer) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
2017-01-21 07:27:48 +08:00
|
|
|
GimpLayerMode paint_mode,
|
2012-04-02 03:20:12 +08:00
|
|
|
const GimpCoords *coords,
|
|
|
|
gint *paint_buffer_x,
|
2016-01-28 02:13:17 +08:00
|
|
|
gint *paint_buffer_y,
|
|
|
|
gint *paint_width,
|
|
|
|
gint *paint_height);
|
2012-04-02 03:20:12 +08:00
|
|
|
|
|
|
|
GimpUndo * (* push_undo) (GimpPaintCore *core,
|
|
|
|
GimpImage *image,
|
|
|
|
const gchar *undo_desc);
|
2001-02-27 13:21:12 +08:00
|
|
|
};
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
GType gimp_paint_core_get_type (void) G_GNUC_CONST;
|
2002-02-16 01:44:05 +08:00
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
void gimp_paint_core_paint (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpPaintState state,
|
|
|
|
guint32 time);
|
2002-02-16 01:44:05 +08:00
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
gboolean gimp_paint_core_start (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
2009-04-18 04:29:25 +08:00
|
|
|
const GimpCoords *coords,
|
2006-09-27 04:55:40 +08:00
|
|
|
GError **error);
|
2005-09-25 00:17:45 +08:00
|
|
|
void gimp_paint_core_finish (GimpPaintCore *core,
|
2008-10-25 19:59:03 +08:00
|
|
|
GimpDrawable *drawable,
|
|
|
|
gboolean push_undo);
|
2005-09-25 00:17:45 +08:00
|
|
|
void gimp_paint_core_cancel (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable);
|
|
|
|
void gimp_paint_core_cleanup (GimpPaintCore *core);
|
2002-02-16 01:44:05 +08:00
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
void gimp_paint_core_interpolate (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
2009-05-26 02:49:34 +08:00
|
|
|
const GimpCoords *coords,
|
2005-09-25 00:17:45 +08:00
|
|
|
guint32 time);
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2009-05-03 18:08:21 +08:00
|
|
|
void gimp_paint_core_set_current_coords (GimpPaintCore *core,
|
|
|
|
const GimpCoords *coords);
|
|
|
|
void gimp_paint_core_get_current_coords (GimpPaintCore *core,
|
|
|
|
GimpCoords *coords);
|
|
|
|
|
|
|
|
void gimp_paint_core_set_last_coords (GimpPaintCore *core,
|
|
|
|
const GimpCoords *coords);
|
|
|
|
void gimp_paint_core_get_last_coords (GimpPaintCore *core,
|
|
|
|
GimpCoords *coords);
|
|
|
|
|
2009-04-23 03:22:08 +08:00
|
|
|
void gimp_paint_core_round_line (GimpPaintCore *core,
|
|
|
|
GimpPaintOptions *options,
|
|
|
|
gboolean constrain_15_degrees);
|
|
|
|
|
2001-02-28 03:18:01 +08:00
|
|
|
|
2002-02-16 01:44:05 +08:00
|
|
|
/* protected functions */
|
2000-06-06 06:08:45 +08:00
|
|
|
|
2012-04-01 00:28:18 +08:00
|
|
|
GeglBuffer * gimp_paint_core_get_paint_buffer (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *options,
|
2017-01-21 07:27:48 +08:00
|
|
|
GimpLayerMode paint_mode,
|
2012-04-01 00:28:18 +08:00
|
|
|
const GimpCoords *coords,
|
|
|
|
gint *paint_buffer_x,
|
2016-01-28 02:13:17 +08:00
|
|
|
gint *paint_buffer_y,
|
|
|
|
gint *paint_width,
|
|
|
|
gint *paint_height);
|
2012-04-01 00:28:18 +08:00
|
|
|
|
2012-03-31 21:40:21 +08:00
|
|
|
GeglBuffer * gimp_paint_core_get_orig_image (GimpPaintCore *core);
|
|
|
|
GeglBuffer * gimp_paint_core_get_orig_proj (GimpPaintCore *core);
|
2005-09-25 00:17:45 +08:00
|
|
|
|
|
|
|
void gimp_paint_core_paste (GimpPaintCore *core,
|
2013-05-21 19:03:28 +08:00
|
|
|
const GimpTempBuf *paint_mask,
|
|
|
|
gint paint_mask_offset_x,
|
|
|
|
gint paint_mask_offset_y,
|
2005-09-25 00:17:45 +08:00
|
|
|
GimpDrawable *drawable,
|
2007-04-01 00:43:41 +08:00
|
|
|
gdouble paint_opacity,
|
|
|
|
gdouble image_opacity,
|
2017-01-09 06:00:19 +08:00
|
|
|
GimpLayerMode paint_mode,
|
2005-09-25 00:17:45 +08:00
|
|
|
GimpPaintApplicationMode mode);
|
2013-05-21 19:03:28 +08:00
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
void gimp_paint_core_replace (GimpPaintCore *core,
|
2013-05-21 19:03:28 +08:00
|
|
|
const GimpTempBuf *paint_mask,
|
|
|
|
gint paint_mask_offset_x,
|
|
|
|
gint paint_mask_offset_y,
|
2005-09-25 00:17:45 +08:00
|
|
|
GimpDrawable *drawable,
|
2007-04-01 00:43:41 +08:00
|
|
|
gdouble paint_opacity,
|
2005-09-25 00:17:45 +08:00
|
|
|
gdouble image_opacity,
|
|
|
|
GimpPaintApplicationMode mode);
|
|
|
|
|
2011-09-15 01:42:52 +08:00
|
|
|
void gimp_paint_core_smooth_coords (GimpPaintCore *core,
|
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
GimpCoords *coords);
|
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#endif /* __GIMP_PAINT_CORE_H__ */
|