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
|
|
|
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpvector.h"
|
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
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
gint ID; /* unique instance ID */
|
2006-09-03 21:16:58 +08:00
|
|
|
|
|
|
|
gchar *undo_desc; /* undo description */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
GimpCoords start_coords; /* starting coords (for undo only) */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
GimpCoords cur_coords; /* current coords */
|
|
|
|
GimpCoords last_coords; /* last coords */
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
GimpVector2 last_paint; /* last point that was painted */
|
2003-07-14 22:50:41 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
gdouble distance; /* distance traveled by brush */
|
|
|
|
gdouble pixel_dist; /* distance in pixels */
|
2002-02-16 01:44:05 +08:00
|
|
|
|
2005-08-29 03:17:44 +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
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
gboolean use_saved_proj; /* keep the unmodified proj around */
|
2002-02-13 22:50:37 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
TileManager *undo_tiles; /* tiles which have been modified */
|
|
|
|
TileManager *saved_proj_tiles; /* proj tiles which have been modified */
|
|
|
|
TileManager *canvas_tiles; /* the buffer to paint the mask to */
|
2004-05-28 04:48:49 +08:00
|
|
|
|
2005-08-29 03:17:44 +08:00
|
|
|
TempBuf *orig_buf; /* the unmodified drawable pixels */
|
|
|
|
TempBuf *orig_proj_buf; /* the unmodified projection pixels */
|
|
|
|
TempBuf *canvas_buf; /* the buffer to paint pixels to */
|
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 */
|
2007-02-04 02:48:00 +08:00
|
|
|
gboolean (* start) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
GimpPaintOptions *paint_options,
|
2009-04-18 04:29:25 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-04 02:48:00 +08:00
|
|
|
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,
|
2009-05-03 18:08:21 +08:00
|
|
|
const GimpCoords *coords,
|
2007-02-04 02:48:00 +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);
|
|
|
|
|
|
|
|
TempBuf * (* get_paint_area) (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
2009-05-18 04:45:06 +08:00
|
|
|
GimpPaintOptions *paint_options,
|
|
|
|
const GimpCoords *coords);
|
2007-02-04 02:48:00 +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
|
|
|
|
2005-09-25 00:17:45 +08:00
|
|
|
TempBuf * gimp_paint_core_get_paint_area (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
2009-05-18 04:45:06 +08:00
|
|
|
GimpPaintOptions *options,
|
|
|
|
const GimpCoords *coords);
|
2005-09-25 00:17:45 +08:00
|
|
|
TempBuf * gimp_paint_core_get_orig_image (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
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-18 02:46:28 +08:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
2005-09-25 00:17:45 +08:00
|
|
|
TempBuf * gimp_paint_core_get_orig_proj (GimpPaintCore *core,
|
|
|
|
GimpPickable *pickable,
|
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-18 02:46:28 +08:00
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
2005-09-25 00:17:45 +08:00
|
|
|
|
|
|
|
void gimp_paint_core_paste (GimpPaintCore *core,
|
|
|
|
PixelRegion *paint_maskPR,
|
|
|
|
GimpDrawable *drawable,
|
2007-04-01 00:43:41 +08:00
|
|
|
gdouble paint_opacity,
|
|
|
|
gdouble image_opacity,
|
2005-09-25 00:17:45 +08:00
|
|
|
GimpLayerModeEffects paint_mode,
|
|
|
|
GimpPaintApplicationMode mode);
|
|
|
|
void gimp_paint_core_replace (GimpPaintCore *core,
|
|
|
|
PixelRegion *paint_maskPR,
|
|
|
|
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);
|
|
|
|
|
|
|
|
void gimp_paint_core_validate_undo_tiles (GimpPaintCore *core,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
void gimp_paint_core_validate_saved_proj_tiles (GimpPaintCore *core,
|
|
|
|
GimpPickable *pickable,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
|
|
|
void gimp_paint_core_validate_canvas_tiles (GimpPaintCore *core,
|
|
|
|
gint x,
|
|
|
|
gint y,
|
|
|
|
gint w,
|
|
|
|
gint h);
|
2004-05-26 19:37:23 +08:00
|
|
|
|
2000-12-31 12:07:42 +08:00
|
|
|
|
2002-02-15 03:31:16 +08:00
|
|
|
#endif /* __GIMP_PAINT_CORE_H__ */
|