summaryrefslogtreecommitdiffstats
path: root/app/gegl/gimpapplicator.h
blob: e2919c2946c0c2055e9c21c3e16e9dbca19559d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* GIMP - The GNU Image Manipulation Program
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * gimpapplicator.h
 * Copyright (C) 2012-2013 Michael Natterer <mitch@gimp.org>
 *
 * 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 3 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, see <https://www.gnu.org/licenses/>.
 */

#ifndef __GIMP_APPLICATOR_H__
#define __GIMP_APPLICATOR_H__


#define GIMP_TYPE_APPLICATOR            (gimp_applicator_get_type ())
#define GIMP_APPLICATOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_APPLICATOR, GimpApplicator))
#define GIMP_APPLICATOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_APPLICATOR, GimpApplicatorClass))
#define GIMP_IS_APPLICATOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_APPLICATOR))
#define GIMP_IS_APPLICATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_APPLICATOR))
#define GIMP_APPLICATOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_APPLICATOR, GimpApplicatorClass))


typedef struct _GimpApplicatorClass GimpApplicatorClass;

struct _GimpApplicator
{
  GObject                 parent_instance;

  GeglNode               *node;
  GeglNode               *input_node;
  GeglNode               *aux_node;
  GeglNode               *output_node;

  gboolean                active;

  GeglBuffer             *apply_buffer;
  GeglNode               *apply_src_node;

  gint                    apply_offset_x;
  gint                    apply_offset_y;
  GeglNode               *apply_offset_node;

  gdouble                 opacity;
  GimpLayerMode           paint_mode;
  GimpLayerColorSpace     blend_space;
  GimpLayerColorSpace     composite_space;
  GimpLayerCompositeMode  composite_mode;
  GeglNode               *mode_node;

  GimpComponentMask       affect;
  GeglNode               *affect_node;

  const Babl             *output_format;
  GeglNode               *convert_format_node;

  gboolean                cache_enabled;
  GeglNode               *cache_node;

  gboolean                crop_enabled;
  GeglRectangle           crop_rect;
  GeglNode               *crop_node;

  GeglBuffer             *src_buffer;
  GeglNode               *src_node;

  GeglBuffer             *dest_buffer;
  GeglNode               *dest_node;

  GeglBuffer             *mask_buffer;
  GeglNode               *mask_node;

  gint                    mask_offset_x;
  gint                    mask_offset_y;
  GeglNode               *mask_offset_node;
};

struct _GimpApplicatorClass
{
  GObjectClass  parent_class;
};


GType        gimp_applicator_get_type          (void) G_GNUC_CONST;

GimpApplicator * gimp_applicator_new           (GeglNode             *parent);

void         gimp_applicator_set_active        (GimpApplicator       *applicator,
                                                gboolean              active);

void         gimp_applicator_set_src_buffer    (GimpApplicator       *applicator,
                                                GeglBuffer           *dest_buffer);
void         gimp_applicator_set_dest_buffer   (GimpApplicator       *applicator,
                                                GeglBuffer           *dest_buffer);

void         gimp_applicator_set_mask_buffer   (GimpApplicator       *applicator,
                                                GeglBuffer           *mask_buffer);
void         gimp_applicator_set_mask_offset   (GimpApplicator       *applicator,
                                                gint                  mask_offset_x,
                                                gint                  mask_offset_y);

void         gimp_applicator_set_apply_buffer  (GimpApplicator       *applicator,
                                                GeglBuffer           *apply_buffer);
void         gimp_applicator_set_apply_offset  (GimpApplicator       *applicator,
                                                gint                  apply_offset_x,
                                                gint                  apply_offset_y);

void         gimp_applicator_set_opacity       (GimpApplicator       *applicator,
                                                gdouble               opacity);
void         gimp_applicator_set_mode          (GimpApplicator       *applicator,
                                                GimpLayerMode         paint_mode,
                                                GimpLayerColorSpace   blend_space,
                                                GimpLayerColorSpace   composite_space,
                                                GimpLayerCompositeMode composite_mode);
void         gimp_applicator_set_affect        (GimpApplicator       *applicator,
                                                GimpComponentMask     affect);

void         gimp_applicator_set_output_format (GimpApplicator       *applicator,
                                                const Babl           *format);
const Babl * gimp_applicator_get_output_format (GimpApplicator       *applicator);

void         gimp_applicator_set_cache         (GimpApplicator       *applicator,
                                                gboolean              enable);
gboolean     gimp_applicator_get_cache         (GimpApplicator       *applicator);
GeglBuffer * gimp_applicator_get_cache_buffer  (GimpApplicator       *applicator,
                                                GeglRectangle       **rectangles,
                                                gint                 *n_rectangles);

void         gimp_applicator_set_crop          (GimpApplicator       *applicator,
                                                const GeglRectangle  *rect);
const GeglRectangle * gimp_applicator_get_crop (GimpApplicator       *applicator);

void         gimp_applicator_blit              (GimpApplicator       *applicator,
                                                const GeglRectangle  *rect);


#endif  /*  __GIMP_APPLICATOR_H__  */