gimplayer.h 6.85 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* The GIMP -- an image manipulation program
 * 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
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
17
 */
Sven Neumann's avatar
Sven Neumann committed
18

19 20
#ifndef __GIMP_LAYER_H__
#define __GIMP_LAYER_H__
Elliot Lee's avatar
Elliot Lee committed
21 22


23
#include "gimpdrawable.h"
Elliot Lee's avatar
Elliot Lee committed
24 25


26
#define GIMP_TYPE_LAYER            (gimp_layer_get_type ())
27 28 29 30
#define GIMP_LAYER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_LAYER, GimpLayer))
#define GIMP_LAYER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_LAYER, GimpLayerClass))
#define GIMP_IS_LAYER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_LAYER))
#define GIMP_IS_LAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_LAYER))
31
#define GIMP_LAYER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_LAYER, GimpLayerClass))
Elliot Lee's avatar
Elliot Lee committed
32

33

34
typedef struct _GimpLayerClass GimpLayerClass;
Michael Natterer's avatar
Michael Natterer committed
35

36 37
struct _GimpLayer
{
38
  GimpDrawable          parent_instance;
39

40
  gdouble               opacity;          /*  layer opacity              */
41
  GimpLayerModeEffects  mode;             /*  layer combination mode     */
42
  gboolean              lock_alpha;       /*  lock the alpha channel     */
43

44
  GimpLayerMask        *mask;             /*  possible layer mask        */
45 46 47 48

  /*  Floating selections  */
  struct
  {
49 50
    TileManager  *backing_store;      /*  for obscured regions           */
    GimpDrawable *drawable;           /*  floating sel is attached to    */
51 52 53
    gboolean      initial;            /*  is fs composited yet?          */

    gboolean      boundary_known;     /*  is the current boundary valid  */
54
    BoundSeg     *segs;               /*  boundary of floating sel       */
55
    gint          num_segs;           /*  number of segs in boundary     */
56 57 58 59 60
  } fs;
};

struct _GimpLayerClass
{
61
  GimpDrawableClass  parent_class;
62

63 64 65 66
  void (* opacity_changed)    (GimpLayer *layer);
  void (* mode_changed)       (GimpLayer *layer);
  void (* lock_alpha_changed) (GimpLayer *layer);
  void (* mask_changed)       (GimpLayer *layer);
67 68
};

Elliot Lee's avatar
Elliot Lee committed
69

70
/*  function declarations  */
71

72 73 74 75 76 77 78
GType           gimp_layer_get_type            (void) G_GNUC_CONST;

GimpLayer     * gimp_layer_new                 (GimpImage            *gimage,
                                                gint                  width,
                                                gint                  height,
                                                GimpImageType         type,
                                                const gchar          *name,
79
                                                gdouble               opacity,
80 81
                                                GimpLayerModeEffects  mode);

82 83
GimpLayer     * gimp_layer_new_from_tiles      (TileManager          *tiles,
                                                GimpImage            *dest_gimage,
84
                                                GimpImageType         type,
85
                                                const gchar          *name,
86
                                                gdouble               opacity,
87
                                                GimpLayerModeEffects  mode);
88 89 90 91 92 93 94 95 96 97 98 99
GimpLayer     * gimp_layer_new_from_pixbuf     (GdkPixbuf            *pixbuf,
                                                GimpImage            *dest_gimage,
                                                GimpImageType         type,
                                                const gchar          *name,
                                                gdouble               opacity,
                                                GimpLayerModeEffects  mode);
GimpLayer     * gimp_layer_new_from_region     (PixelRegion          *region,
                                                GimpImage            *dest_gimage,
                                                GimpImageType         type,
                                                const gchar          *name,
                                                gdouble               opacity,
                                                GimpLayerModeEffects  mode);
100 101

GimpLayerMask * gimp_layer_create_mask         (const GimpLayer      *layer,
102
                                                GimpAddMaskType       mask_type);
103 104 105 106
GimpLayerMask * gimp_layer_add_mask            (GimpLayer            *layer,
                                                GimpLayerMask        *mask,
                                                gboolean              push_undo);
void            gimp_layer_apply_mask          (GimpLayer            *layer,
107
                                                GimpMaskApplyMode     mode,
108 109
                                                gboolean              push_undo);
void            gimp_layer_add_alpha           (GimpLayer            *layer);
Michael Natterer's avatar
Michael Natterer committed
110 111
void            gimp_layer_flatten             (GimpLayer            *layer,
                                                GimpContext          *context);
112

113 114
void            gimp_layer_resize_to_image     (GimpLayer            *layer,
                                                GimpContext          *context);
115
BoundSeg      * gimp_layer_boundary            (GimpLayer            *layer,
116 117 118 119 120 121 122
                                                gint                 *num_segs);

GimpLayerMask * gimp_layer_get_mask            (const GimpLayer      *layer);

gboolean        gimp_layer_is_floating_sel     (const GimpLayer      *layer);

void            gimp_layer_set_opacity         (GimpLayer            *layer,
123 124
                                                gdouble               opacity,
                                                gboolean              push_undo);
125 126
gdouble         gimp_layer_get_opacity         (const GimpLayer      *layer);

127
void            gimp_layer_set_mode            (GimpLayer            *layer,
128 129
                                                GimpLayerModeEffects  mode,
                                                gboolean              push_undo);
130 131
GimpLayerModeEffects gimp_layer_get_mode       (const GimpLayer      *layer);

132 133
void            gimp_layer_set_lock_alpha      (GimpLayer            *layer,
                                                gboolean              lock_alpha,
134
                                                gboolean              push_undo);
135
gboolean        gimp_layer_get_lock_alpha      (const GimpLayer      *layer);
136

137 138

#endif /* __GIMP_LAYER_H__ */