gimpimage.h 25.7 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattisbvf
3
 *
4
 * This program is free software: you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7 8 9 10 11 12 13 14
 * (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
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 */
17

18 19
#ifndef __GIMP_IMAGE_H__
#define __GIMP_IMAGE_H__
20 21


22
#include "gimpviewable.h"
23

24

25
#define GIMP_IMAGE_ACTIVE_PARENT ((gpointer) 1)
26 27


28
#define GIMP_TYPE_IMAGE            (gimp_image_get_type ())
29 30 31
#define GIMP_IMAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_IMAGE, GimpImage))
#define GIMP_IMAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_IMAGE, GimpImageClass))
#define GIMP_IS_IMAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_IMAGE))
32
#define GIMP_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_IMAGE))
33 34
#define GIMP_IMAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_IMAGE, GimpImageClass))

35 36 37 38 39

typedef struct _GimpImageClass GimpImageClass;

struct _GimpImage
{
40
  GimpViewable  parent_instance;
41

42
  Gimp         *gimp;  /*  the GIMP the image belongs to  */
43 44 45
};

struct _GimpImageClass
46
{
47
  GimpViewableClass  parent_class;
48

49
  /*  signals  */
50
  void (* mode_changed)                 (GimpImage            *image);
51
  void (* precision_changed)            (GimpImage            *image);
52 53 54 55 56 57
  void (* alpha_changed)                (GimpImage            *image);
  void (* floating_selection_changed)   (GimpImage            *image);
  void (* active_layer_changed)         (GimpImage            *image);
  void (* active_channel_changed)       (GimpImage            *image);
  void (* active_vectors_changed)       (GimpImage            *image);
  void (* component_visibility_changed) (GimpImage            *image,
58
                                         GimpChannelType       channel);
59
  void (* component_active_changed)     (GimpImage            *image,
60
                                         GimpChannelType       channel);
61 62
  void (* mask_changed)                 (GimpImage            *image);
  void (* resolution_changed)           (GimpImage            *image);
63 64
  void (* size_changed_detailed)        (GimpImage            *image,
                                         gint                  previous_origin_x,
65 66 67
                                         gint                  previous_origin_y,
                                         gint                  previous_width,
                                         gint                  previous_height);
68 69
  void (* unit_changed)                 (GimpImage            *image);
  void (* quick_mask_changed)           (GimpImage            *image);
70
  void (* selection_invalidate)         (GimpImage            *image);
71

72
  void (* clean)                        (GimpImage            *image,
73
                                         GimpDirtyMask         dirty_mask);
74
  void (* dirty)                        (GimpImage            *image,
75
                                         GimpDirtyMask         dirty_mask);
76
  void (* saved)                        (GimpImage            *image,
77
                                         GFile                *file);
78
  void (* exported)                     (GimpImage            *image,
79
                                         GFile                *file);
80

81 82 83 84 85 86
  void (* guide_added)                  (GimpImage            *image,
                                         GimpGuide            *guide);
  void (* guide_removed)                (GimpImage            *image,
                                         GimpGuide            *guide);
  void (* guide_moved)                  (GimpImage            *image,
                                         GimpGuide            *guide);
87
  void (* sample_point_added)           (GimpImage            *image,
88
                                         GimpSamplePoint      *sample_point);
89
  void (* sample_point_removed)         (GimpImage            *image,
90
                                         GimpSamplePoint      *sample_point);
91 92
  void (* sample_point_moved)           (GimpImage            *image,
                                         GimpSamplePoint      *sample_point);
93 94 95 96
  void (* parasite_attached)            (GimpImage            *image,
                                         const gchar          *name);
  void (* parasite_detached)            (GimpImage            *image,
                                         const gchar          *name);
97
  void (* colormap_changed)             (GimpImage            *image,
98
                                         gint                  color_index);
99
  void (* undo_event)                   (GimpImage            *image,
100
                                         GimpUndoEvent         event,
101
                                         GimpUndo             *undo);
102 103
};

104

105
GType           gimp_image_get_type              (void) G_GNUC_CONST;
106

107 108 109
GimpImage     * gimp_image_new                   (Gimp               *gimp,
                                                  gint                width,
                                                  gint                height,
110 111
                                                  GimpImageBaseType   base_type,
                                                  GimpPrecision       precision);
112

113
gint64          gimp_image_estimate_memsize      (GimpImage          *image,
114 115 116 117
                                                  GimpComponentType   component_type,
                                                  gint                width,
                                                  gint                height);

118 119 120
GimpImageBaseType  gimp_image_get_base_type      (GimpImage          *image);
GimpComponentType  gimp_image_get_component_type (GimpImage          *image);
GimpPrecision      gimp_image_get_precision      (GimpImage          *image);
121

122
const Babl    * gimp_image_get_format            (GimpImage          *image,
123
                                                  GimpImageBaseType   base_type,
124
                                                  GimpPrecision       precision,
125
                                                  gboolean            with_alpha);
126
const Babl    * gimp_image_get_layer_format      (GimpImage          *image,
127
                                                  gboolean            with_alpha);
128 129
const Babl    * gimp_image_get_channel_format    (GimpImage          *image);
const Babl    * gimp_image_get_mask_format       (GimpImage          *image);
130

131 132 133 134 135
GimpLayerMode   gimp_image_get_default_new_layer_mode
                                                 (GimpImage          *image);
void            gimp_image_unset_default_new_layer_mode
                                                 (GimpImage          *image);

136
gint            gimp_image_get_ID                (GimpImage          *image);
137 138 139
GimpImage     * gimp_image_get_by_ID             (Gimp               *gimp,
                                                  gint                id);

140 141 142 143 144 145 146
GFile         * gimp_image_get_file              (GimpImage          *image);
GFile         * gimp_image_get_untitled_file     (GimpImage          *image);
GFile         * gimp_image_get_file_or_untitled  (GimpImage          *image);
GFile         * gimp_image_get_imported_file     (GimpImage          *image);
GFile         * gimp_image_get_exported_file     (GimpImage          *image);
GFile         * gimp_image_get_save_a_copy_file  (GimpImage          *image);
GFile         * gimp_image_get_any_file          (GimpImage          *image);
147 148 149 150 151 152 153 154 155

void            gimp_image_set_file              (GimpImage          *image,
                                                  GFile              *file);
void            gimp_image_set_imported_file     (GimpImage          *image,
                                                  GFile              *file);
void            gimp_image_set_exported_file     (GimpImage          *image,
                                                  GFile              *file);
void            gimp_image_set_save_a_copy_file  (GimpImage          *image,
                                                  GFile              *file);
156

157
const gchar   * gimp_image_get_display_name      (GimpImage          *image);
158
const gchar   * gimp_image_get_display_path      (GimpImage          *image);
159

160 161
void            gimp_image_set_load_proc         (GimpImage          *image,
                                                  GimpPlugInProcedure *proc);
162
GimpPlugInProcedure * gimp_image_get_load_proc   (GimpImage          *image);
163
void            gimp_image_set_save_proc         (GimpImage          *image,
164
                                                  GimpPlugInProcedure *proc);
165
GimpPlugInProcedure * gimp_image_get_save_proc   (GimpImage          *image);
166
void            gimp_image_saved                 (GimpImage          *image,
167
                                                  GFile              *file);
168 169
void            gimp_image_set_export_proc       (GimpImage          *image,
                                                  GimpPlugInProcedure *proc);
170
GimpPlugInProcedure * gimp_image_get_export_proc (GimpImage          *image);
171
void            gimp_image_exported              (GimpImage          *image,
172
                                                  GFile              *file);
173

174 175 176 177 178
gint            gimp_image_get_xcf_version       (GimpImage          *image,
                                                  gboolean            zlib_compression,
                                                  gint               *gimp_version,
                                                  const gchar       **version_string);

179 180 181
void            gimp_image_set_xcf_compression   (GimpImage          *image,
                                                  gboolean            compression);
gboolean        gimp_image_get_xcf_compression   (GimpImage          *image);
182

183
void            gimp_image_set_resolution        (GimpImage          *image,
184 185
                                                  gdouble             xres,
                                                  gdouble             yres);
186
void            gimp_image_get_resolution        (GimpImage          *image,
187 188
                                                  gdouble            *xres,
                                                  gdouble            *yres);
189
void            gimp_image_resolution_changed    (GimpImage          *image);
190

191
void            gimp_image_set_unit              (GimpImage          *image,
192
                                                  GimpUnit            unit);
193
GimpUnit        gimp_image_get_unit              (GimpImage          *image);
194
void            gimp_image_unit_changed          (GimpImage          *image);
195

196 197
gint            gimp_image_get_width             (GimpImage          *image);
gint            gimp_image_get_height            (GimpImage          *image);
198

199 200
gboolean        gimp_image_has_alpha             (GimpImage          *image);
gboolean        gimp_image_is_empty              (GimpImage          *image);
201

202 203
void           gimp_image_set_floating_selection (GimpImage          *image,
                                                  GimpLayer          *floating_sel);
204
GimpLayer    * gimp_image_get_floating_selection (GimpImage          *image);
205
void       gimp_image_floating_selection_changed (GimpImage          *image);
206

207
GimpChannel   * gimp_image_get_mask              (GimpImage          *image);
208
void            gimp_image_mask_changed          (GimpImage          *image);
209

210 211 212

/*  image components  */

213
const Babl    * gimp_image_get_component_format  (GimpImage          *image,
214
                                                  GimpChannelType     channel);
215
gint            gimp_image_get_component_index   (GimpImage          *image,
216 217
                                                  GimpChannelType     channel);

218
void            gimp_image_set_component_active  (GimpImage          *image,
219 220
                                                  GimpChannelType     type,
                                                  gboolean            active);
221
gboolean        gimp_image_get_component_active  (GimpImage          *image,
222
                                                  GimpChannelType     type);
223
void            gimp_image_get_active_array      (GimpImage          *image,
224
                                                  gboolean           *components);
225
GimpComponentMask gimp_image_get_active_mask     (GimpImage          *image);
226

227
void            gimp_image_set_component_visible (GimpImage          *image,
228 229
                                                  GimpChannelType     type,
                                                  gboolean            visible);
230
gboolean        gimp_image_get_component_visible (GimpImage          *image,
231
                                                  GimpChannelType     type);
232
void            gimp_image_get_visible_array     (GimpImage          *image,
233
                                                  gboolean           *components);
234
GimpComponentMask gimp_image_get_visible_mask    (GimpImage          *image);
235

236 237 238

/*  emitting image signals  */

239
void            gimp_image_mode_changed          (GimpImage          *image);
240
void            gimp_image_precision_changed     (GimpImage          *image);
241
void            gimp_image_alpha_changed         (GimpImage          *image);
242
void            gimp_image_invalidate            (GimpImage          *image,
243 244 245 246
                                                  gint                x,
                                                  gint                y,
                                                  gint                width,
                                                  gint                height);
247 248 249 250 251 252 253
void            gimp_image_guide_added           (GimpImage          *image,
                                                  GimpGuide          *guide);
void            gimp_image_guide_removed         (GimpImage          *image,
                                                  GimpGuide          *guide);
void            gimp_image_guide_moved           (GimpImage          *image,
                                                  GimpGuide          *guide);

254
void            gimp_image_sample_point_added    (GimpImage          *image,
255
                                                  GimpSamplePoint    *sample_point);
256
void            gimp_image_sample_point_removed  (GimpImage          *image,
257
                                                  GimpSamplePoint    *sample_point);
258 259
void            gimp_image_sample_point_moved    (GimpImage          *image,
                                                  GimpSamplePoint    *sample_point);
260
void            gimp_image_colormap_changed      (GimpImage          *image,
261
                                                  gint                col);
262
void            gimp_image_selection_invalidate  (GimpImage          *image);
263
void            gimp_image_quick_mask_changed    (GimpImage          *image);
264 265
void            gimp_image_size_changed_detailed (GimpImage          *image,
                                                  gint                previous_origin_x,
266 267 268
                                                  gint                previous_origin_y,
                                                  gint                previous_width,
                                                  gint                previous_height);
269
void            gimp_image_undo_event            (GimpImage          *image,
270 271
                                                  GimpUndoEvent       event,
                                                  GimpUndo           *undo);
272 273 274 275


/*  dirty counters  */

276
gint            gimp_image_dirty                 (GimpImage          *image,
277
                                                  GimpDirtyMask       dirty_mask);
278
gint            gimp_image_clean                 (GimpImage          *image,
279
                                                  GimpDirtyMask       dirty_mask);
280
void            gimp_image_clean_all             (GimpImage          *image);
281
void            gimp_image_export_clean_all      (GimpImage          *image);
282 283 284
gint            gimp_image_is_dirty              (GimpImage          *image);
gboolean        gimp_image_is_export_dirty       (GimpImage          *image);
gint64          gimp_image_get_dirty_time        (GimpImage          *image);
285 286


287 288
/*  flush this image's displays  */

289
void            gimp_image_flush                 (GimpImage          *image);
290 291


292 293
/*  display / instance counters  */

294
gint            gimp_image_get_display_count     (GimpImage          *image);
295 296 297
void            gimp_image_inc_display_count     (GimpImage          *image);
void            gimp_image_dec_display_count     (GimpImage          *image);

298
gint            gimp_image_get_instance_count    (GimpImage          *image);
299 300 301
void            gimp_image_inc_instance_count    (GimpImage          *image);


302 303
/*  parasites  */

304
const GimpParasite * gimp_image_parasite_find    (GimpImage          *image,
305
                                                  const gchar        *name);
306
gchar        ** gimp_image_parasite_list         (GimpImage          *image,
307
                                                  gint               *count);
308 309 310
gboolean        gimp_image_parasite_validate     (GimpImage          *image,
                                                  const GimpParasite *parasite,
                                                  GError            **error);
311
void            gimp_image_parasite_attach       (GimpImage          *image,
312
                                                  const GimpParasite *parasite);
313
void            gimp_image_parasite_detach       (GimpImage          *image,
314
                                                  const gchar        *name);
315 316 317 318


/*  tattoos  */

319 320
GimpTattoo      gimp_image_get_new_tattoo        (GimpImage          *image);
gboolean        gimp_image_set_tattoo_state      (GimpImage          *image,
321
                                                  GimpTattoo          val);
322
GimpTattoo      gimp_image_get_tattoo_state      (GimpImage          *image);
323 324


325 326
/*  projection  */

327
GimpProjection * gimp_image_get_projection       (GimpImage          *image);
328 329


330
/*  layers / channels / vectors  */
331

332 333 334
GimpItemTree  * gimp_image_get_layer_tree        (GimpImage          *image);
GimpItemTree  * gimp_image_get_channel_tree      (GimpImage          *image);
GimpItemTree  * gimp_image_get_vectors_tree      (GimpImage          *image);
335

336 337 338
GimpContainer * gimp_image_get_layers            (GimpImage          *image);
GimpContainer * gimp_image_get_channels          (GimpImage          *image);
GimpContainer * gimp_image_get_vectors           (GimpImage          *image);
339

340 341 342
gint            gimp_image_get_n_layers          (GimpImage          *image);
gint            gimp_image_get_n_channels        (GimpImage          *image);
gint            gimp_image_get_n_vectors         (GimpImage          *image);
343

344 345 346
GList         * gimp_image_get_layer_iter        (GimpImage          *image);
GList         * gimp_image_get_channel_iter      (GimpImage          *image);
GList         * gimp_image_get_vectors_iter      (GimpImage          *image);
347

348 349 350
GList         * gimp_image_get_layer_list        (GimpImage          *image);
GList         * gimp_image_get_channel_list      (GimpImage          *image);
GList         * gimp_image_get_vectors_list      (GimpImage          *image);
351

352 353 354 355
GimpDrawable  * gimp_image_get_active_drawable   (GimpImage          *image);
GimpLayer     * gimp_image_get_active_layer      (GimpImage          *image);
GimpChannel   * gimp_image_get_active_channel    (GimpImage          *image);
GimpVectors   * gimp_image_get_active_vectors    (GimpImage          *image);
356

357
GimpLayer     * gimp_image_set_active_layer      (GimpImage          *image,
358
                                                  GimpLayer          *layer);
359
GimpChannel   * gimp_image_set_active_channel    (GimpImage          *image,
360
                                                  GimpChannel        *channel);
361 362
GimpChannel   * gimp_image_unset_active_channel  (GimpImage          *image);
GimpVectors   * gimp_image_set_active_vectors    (GimpImage          *image,
Michael Natterer's avatar
Michael Natterer committed
363
                                                  GimpVectors        *vectors);
364

365
GimpLayer     * gimp_image_get_layer_by_tattoo   (GimpImage          *image,
366
                                                  GimpTattoo          tattoo);
367
GimpChannel   * gimp_image_get_channel_by_tattoo (GimpImage          *image,
368
                                                  GimpTattoo          tattoo);
369
GimpVectors   * gimp_image_get_vectors_by_tattoo (GimpImage          *image,
370
                                                  GimpTattoo          tattoo);
Michael Natterer's avatar
Michael Natterer committed
371

372
GimpLayer     * gimp_image_get_layer_by_name     (GimpImage          *image,
373
                                                  const gchar        *name);
374
GimpChannel   * gimp_image_get_channel_by_name   (GimpImage          *image,
375
                                                  const gchar        *name);
376
GimpVectors   * gimp_image_get_vectors_by_name   (GimpImage          *image,
377
                                                  const gchar        *name);
378

379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
gboolean        gimp_image_reorder_item          (GimpImage          *image,
                                                  GimpItem           *item,
                                                  GimpItem           *new_parent,
                                                  gint                new_index,
                                                  gboolean            push_undo,
                                                  const gchar        *undo_desc);
gboolean        gimp_image_raise_item            (GimpImage          *image,
                                                  GimpItem           *item,
                                                  GError            **error);
gboolean        gimp_image_raise_item_to_top     (GimpImage          *image,
                                                  GimpItem           *item);
gboolean        gimp_image_lower_item            (GimpImage          *image,
                                                  GimpItem           *item,
                                                  GError            **error);
gboolean        gimp_image_lower_item_to_bottom  (GimpImage          *image,
                                                  GimpItem           *item);

396
gboolean        gimp_image_add_layer             (GimpImage          *image,
397
                                                  GimpLayer          *layer,
398
                                                  GimpLayer          *parent,
399 400
                                                  gint                position,
                                                  gboolean            push_undo);
401
void            gimp_image_remove_layer          (GimpImage          *image,
402 403 404
                                                  GimpLayer          *layer,
                                                  gboolean            push_undo,
                                                  GimpLayer          *new_active);
405

406 407
void            gimp_image_add_layers            (GimpImage          *image,
                                                  GList              *layers,
408
                                                  GimpLayer          *parent,
409 410 411 412 413 414 415
                                                  gint                position,
                                                  gint                x,
                                                  gint                y,
                                                  gint                width,
                                                  gint                height,
                                                  const gchar        *undo_desc);

416
gboolean        gimp_image_add_channel           (GimpImage          *image,
417
                                                  GimpChannel        *channel,
418
                                                  GimpChannel        *parent,
419 420
                                                  gint                position,
                                                  gboolean            push_undo);
421
void            gimp_image_remove_channel        (GimpImage          *image,
422 423 424
                                                  GimpChannel        *channel,
                                                  gboolean            push_undo,
                                                  GimpChannel        *new_active);
425

426
gboolean        gimp_image_add_vectors           (GimpImage          *image,
427
                                                  GimpVectors        *vectors,
428
                                                  GimpVectors        *parent,
429 430
                                                  gint                position,
                                                  gboolean            push_undo);
431
void            gimp_image_remove_vectors        (GimpImage          *image,
432 433 434
                                                  GimpVectors        *vectors,
                                                  gboolean            push_undo,
                                                  GimpVectors        *new_active);
Michael Natterer's avatar
Michael Natterer committed
435

436 437 438 439
gboolean    gimp_image_coords_in_active_pickable (GimpImage          *image,
                                                  const GimpCoords   *coords,
                                                  gboolean            sample_merged,
                                                  gboolean            selected_only);
440

441
void            gimp_image_invalidate_previews   (GimpImage          *image);
442

443

444
#endif /* __GIMP_IMAGE_H__ */