gimpdrawable.h 13.4 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (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
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
18 19 20

#ifndef __GIMP_DRAWABLE_H__
#define __GIMP_DRAWABLE_H__
21

22

23
#include "gimpitem.h"
24

25

26
#define GIMP_TYPE_DRAWABLE            (gimp_drawable_get_type ())
27 28
#define GIMP_DRAWABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DRAWABLE, GimpDrawable))
#define GIMP_DRAWABLE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
29
#define GIMP_IS_DRAWABLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DRAWABLE))
30
#define GIMP_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DRAWABLE))
31
#define GIMP_DRAWABLE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DRAWABLE, GimpDrawableClass))
32 33 34 35 36 37


typedef struct _GimpDrawableClass GimpDrawableClass;

struct _GimpDrawable
{
38
  GimpItem       parent_instance;
39

40
  TileManager   *tiles;              /* tiles for drawable data        */
41
  TileManager   *shadow;             /* shadow buffer tiles            */
42

43 44
  GeglNode      *source_node;

45 46
  GeglNode      *mode_node;

47 48 49
  gint           bytes;              /* bytes per pixel                */
  GimpImageType  type;               /* type of drawable               */
  gboolean       has_alpha;          /* drawable has alpha             */
50 51

  /*  Preview variables  */
52 53
  GSList        *preview_cache;      /* preview caches of the channel  */
  gboolean       preview_valid;      /* is the preview valid?          */
54 55 56 57
};

struct _GimpDrawableClass
{
58
  GimpItemClass  parent_class;
59

60
  /*  signals  */
61 62 63 64 65 66
  void          (* update)                (GimpDrawable         *drawable,
                                           gint                  x,
                                           gint                  y,
                                           gint                  width,
                                           gint                  height);
  void          (* alpha_changed)         (GimpDrawable         *drawable);
67 68

  /*  virtual functions  */
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  gint64        (* estimate_memsize)      (const GimpDrawable   *drawable,
                                           gint                  width,
                                           gint                  height);
  void          (* invalidate_boundary)   (GimpDrawable         *drawable);
  void          (* get_active_components) (const GimpDrawable   *drawable,
                                           gboolean             *active);
  void          (* apply_region)          (GimpDrawable         *drawable,
                                           PixelRegion          *src2PR,
                                           gboolean              push_undo,
                                           const gchar          *undo_desc,
                                           gdouble               opacity,
                                           GimpLayerModeEffects  mode,
                                           TileManager          *src1_tiles,
                                           gint                  x,
                                           gint                  y);
  void          (* replace_region)        (GimpDrawable         *drawable,
                                           PixelRegion          *src2PR,
                                           gboolean              push_undo,
                                           const gchar          *undo_desc,
                                           gdouble               opacity,
                                           PixelRegion          *maskPR,
                                           gint                  x,
                                           gint                  y);
  TileManager * (* get_tiles)             (GimpDrawable         *drawable);
  void          (* set_tiles)             (GimpDrawable         *drawable,
                                           gboolean              push_undo,
                                           const gchar          *undo_desc,
                                           TileManager          *tiles,
                                           GimpImageType         type,
                                           gint                  offset_x,
                                           gint                  offset_y);
  void          (* push_undo)             (GimpDrawable         *drawable,
                                           const gchar          *undo_desc,
                                           TileManager          *tiles,
                                           gboolean              sparse,
                                           gint                  x,
                                           gint                  y,
                                           gint                  width,
                                           gint                  height);
  void          (* swap_pixels)           (GimpDrawable         *drawable,
                                           TileManager          *tiles,
                                           gboolean              sparse,
                                           gint                  x,
                                           gint                  y,
                                           gint                  width,
                                           gint                  height);
115
};
116 117


118
GType           gimp_drawable_get_type           (void) G_GNUC_CONST;
119

120 121 122 123
gint64          gimp_drawable_estimate_memsize   (const GimpDrawable *drawable,
                                                  gint                width,
                                                  gint                height);

124
void            gimp_drawable_configure          (GimpDrawable       *drawable,
125
                                                  GimpImage          *image,
126 127
                                                  gint                offset_x,
                                                  gint                offset_y,
128 129 130 131
                                                  gint                width,
                                                  gint                height,
                                                  GimpImageType       type,
                                                  const gchar        *name);
132

Michael Natterer's avatar
Michael Natterer committed
133
void            gimp_drawable_update             (GimpDrawable       *drawable,
134 135 136 137
                                                  gint                x,
                                                  gint                y,
                                                  gint                width,
                                                  gint                height);
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
void            gimp_drawable_alpha_changed      (GimpDrawable       *drawable);

void           gimp_drawable_invalidate_boundary (GimpDrawable       *drawable);
void         gimp_drawable_get_active_components (const GimpDrawable *drawable,
                                                  gboolean           *active);

void            gimp_drawable_apply_region       (GimpDrawable       *drawable,
                                                  PixelRegion        *src2PR,
                                                  gboolean            push_undo,
                                                  const gchar        *undo_desc,
                                                  gdouble             opacity,
                                                  GimpLayerModeEffects  mode,
                                                  TileManager        *src1_tiles,
                                                  gint                x,
                                                  gint                y);
void            gimp_drawable_replace_region     (GimpDrawable       *drawable,
                                                  PixelRegion        *src2PR,
                                                  gboolean            push_undo,
                                                  const gchar        *undo_desc,
                                                  gdouble             opacity,
                                                  PixelRegion        *maskPR,
                                                  gint                x,
                                                  gint                y);
Michael Natterer's avatar
Michael Natterer committed
161

162
TileManager   * gimp_drawable_get_tiles          (GimpDrawable       *drawable);
163
void            gimp_drawable_set_tiles          (GimpDrawable       *drawable,
164 165
                                                  gboolean            push_undo,
                                                  const gchar        *undo_desc,
166 167
                                                  TileManager        *tiles,
                                                  GimpImageType       type);
168
void            gimp_drawable_set_tiles_full     (GimpDrawable       *drawable,
169 170 171
                                                  gboolean            push_undo,
                                                  const gchar        *undo_desc,
                                                  TileManager        *tiles,
172 173 174
                                                  GimpImageType       type,
                                                  gint                offset_x,
                                                  gint                offset_y);
175

176
GeglNode      * gimp_drawable_get_source_node    (GimpDrawable       *drawable);
177
GeglNode      * gimp_drawable_get_mode_node      (GimpDrawable       *drawable);
178

179 180 181 182 183 184 185
void            gimp_drawable_swap_pixels        (GimpDrawable       *drawable,
                                                  TileManager        *tiles,
                                                  gboolean            sparse,
                                                  gint                x,
                                                  gint                y,
                                                  gint                width,
                                                  gint                height);
186

187 188
void            gimp_drawable_push_undo          (GimpDrawable       *drawable,
                                                  const gchar        *undo_desc,
189 190 191 192 193 194
                                                  gint                x1,
                                                  gint                y1,
                                                  gint                x2,
                                                  gint                y2,
                                                  TileManager        *tiles,
                                                  gboolean            sparse);
Michael Natterer's avatar
Michael Natterer committed
195

196
void            gimp_drawable_fill               (GimpDrawable       *drawable,
197
                                                  const GimpRGB      *color,
198
                                                  const GimpPattern  *pattern);
Michael Natterer's avatar
Michael Natterer committed
199
void            gimp_drawable_fill_by_type       (GimpDrawable       *drawable,
200 201
                                                  GimpContext        *context,
                                                  GimpFillType        fill_type);
202 203

gboolean        gimp_drawable_mask_bounds        (GimpDrawable       *drawable,
204 205 206 207 208 209 210 211 212
                                                  gint               *x1,
                                                  gint               *y1,
                                                  gint               *x2,
                                                  gint               *y2);
gboolean        gimp_drawable_mask_intersect     (GimpDrawable       *drawable,
                                                  gint               *x,
                                                  gint               *y,
                                                  gint               *width,
                                                  gint               *height);
213 214 215 216

gboolean        gimp_drawable_has_alpha          (const GimpDrawable *drawable);
GimpImageType   gimp_drawable_type               (const GimpDrawable *drawable);
GimpImageType   gimp_drawable_type_with_alpha    (const GimpDrawable *drawable);
217
GimpImageType   gimp_drawable_type_without_alpha (const GimpDrawable *drawable);
218 219 220
gboolean        gimp_drawable_is_rgb             (const GimpDrawable *drawable);
gboolean        gimp_drawable_is_gray            (const GimpDrawable *drawable);
gboolean        gimp_drawable_is_indexed         (const GimpDrawable *drawable);
221
gint            gimp_drawable_bytes              (const GimpDrawable *drawable);
222
gint            gimp_drawable_bytes_with_alpha   (const GimpDrawable *drawable);
223
gint            gimp_drawable_bytes_without_alpha(const GimpDrawable *drawable);
Michael Natterer's avatar
Michael Natterer committed
224

225 226
gboolean        gimp_drawable_has_floating_sel   (const GimpDrawable *drawable);

227
const guchar  * gimp_drawable_get_colormap       (const GimpDrawable *drawable);
228

229

230
#endif /* __GIMP_DRAWABLE_H__ */