gimpbrush.h 8.34 KB
Newer Older
1
/* GIMP - The GNU Image Manipulation Program
2 3
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
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 <https://www.gnu.org/licenses/>.
16
 */
17 18 19 20

#ifndef __GIMP_BRUSH_H__
#define __GIMP_BRUSH_H__

21

22
#include "gimpdata.h"
23

24

25
#define GIMP_TYPE_BRUSH            (gimp_brush_get_type ())
26 27 28 29 30
#define GIMP_BRUSH(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
#define GIMP_BRUSH_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass))
#define GIMP_IS_BRUSH(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BRUSH))
#define GIMP_IS_BRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH))
#define GIMP_BRUSH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BRUSH, GimpBrushClass))
31 32


33 34
typedef struct _GimpBrushPrivate GimpBrushPrivate;
typedef struct _GimpBrushClass   GimpBrushClass;
Sven Neumann's avatar
Sven Neumann committed
35

36 37
struct _GimpBrush
{
38
  GimpData          parent_instance;
39

40
  GimpBrushPrivate *priv;
41 42 43 44
};

struct _GimpBrushClass
{
45
  GimpDataClass  parent_class;
46

Michael Natterer's avatar
Michael Natterer committed
47
  /*  virtual functions  */
48 49
  void             (* begin_use)          (GimpBrush        *brush);
  void             (* end_use)            (GimpBrush        *brush);
50 51 52 53 54 55 56 57 58 59
  GimpBrush      * (* select_brush)       (GimpBrush        *brush,
                                           const GimpCoords *last_coords,
                                           const GimpCoords *current_coords);
  gboolean         (* want_null_motion)   (GimpBrush        *brush,
                                           const GimpCoords *last_coords,
                                           const GimpCoords *current_coords);
  void             (* transform_size)     (GimpBrush        *brush,
                                           gdouble           scale,
                                           gdouble           aspect_ratio,
                                           gdouble           angle,
60
                                           gboolean          reflect,
61 62
                                           gint             *width,
                                           gint             *height);
63
  GimpTempBuf    * (* transform_mask)     (GimpBrush        *brush,
64 65 66
                                           gdouble           scale,
                                           gdouble           aspect_ratio,
                                           gdouble           angle,
67
                                           gboolean          reflect,
68
                                           gdouble           hardness);
69
  GimpTempBuf    * (* transform_pixmap)   (GimpBrush        *brush,
70 71 72
                                           gdouble           scale,
                                           gdouble           aspect_ratio,
                                           gdouble           angle,
73
                                           gboolean          reflect,
74 75 76 77 78
                                           gdouble           hardness);
  GimpBezierDesc * (* transform_boundary) (GimpBrush        *brush,
                                           gdouble           scale,
                                           gdouble           aspect_ratio,
                                           gdouble           angle,
79
                                           gboolean          reflect,
80 81 82
                                           gdouble           hardness,
                                           gint             *width,
                                           gint             *height);
Michael Natterer's avatar
Michael Natterer committed
83 84

  /*  signals  */
85
  void             (* spacing_changed)    (GimpBrush        *brush);
86 87 88
};


89
GType                  gimp_brush_get_type           (void) G_GNUC_CONST;
90

91 92 93
GimpData             * gimp_brush_new                (GimpContext      *context,
                                                      const gchar      *name);
GimpData             * gimp_brush_get_standard       (GimpContext      *context);
94

95 96 97
void                   gimp_brush_begin_use          (GimpBrush        *brush);
void                   gimp_brush_end_use            (GimpBrush        *brush);

98 99 100 101 102 103
GimpBrush            * gimp_brush_select_brush       (GimpBrush        *brush,
                                                      const GimpCoords *last_coords,
                                                      const GimpCoords *current_coords);
gboolean               gimp_brush_want_null_motion   (GimpBrush        *brush,
                                                      const GimpCoords *last_coords,
                                                      const GimpCoords *current_coords);
104 105 106 107

/* Gets width and height of a transformed mask of the brush, for
 * provided parameters.
 */
108 109 110 111
void                   gimp_brush_transform_size     (GimpBrush        *brush,
                                                      gdouble           scale,
                                                      gdouble           aspect_ratio,
                                                      gdouble           angle,
112
                                                      gboolean          reflect,
113 114
                                                      gint             *width,
                                                      gint             *height);
115
const GimpTempBuf    * gimp_brush_transform_mask     (GimpBrush        *brush,
Jehan's avatar
Jehan committed
116
                                                      GeglNode         *op,
117 118 119
                                                      gdouble           scale,
                                                      gdouble           aspect_ratio,
                                                      gdouble           angle,
120
                                                      gboolean          reflect,
121
                                                      gdouble           hardness);
122
const GimpTempBuf    * gimp_brush_transform_pixmap   (GimpBrush        *brush,
Jehan's avatar
Jehan committed
123
                                                      GeglNode         *op,
124 125 126
                                                      gdouble           scale,
                                                      gdouble           aspect_ratio,
                                                      gdouble           angle,
127
                                                      gboolean          reflect,
128 129 130 131 132
                                                      gdouble           hardness);
const GimpBezierDesc * gimp_brush_transform_boundary (GimpBrush        *brush,
                                                      gdouble           scale,
                                                      gdouble           aspect_ratio,
                                                      gdouble           angle,
133
                                                      gboolean          reflect,
134 135 136 137
                                                      gdouble           hardness,
                                                      gint             *width,
                                                      gint             *height);

138 139
GimpTempBuf          * gimp_brush_get_mask           (GimpBrush        *brush);
GimpTempBuf          * gimp_brush_get_pixmap         (GimpBrush        *brush);
140

141 142
gint                   gimp_brush_get_width          (GimpBrush        *brush);
gint                   gimp_brush_get_height         (GimpBrush        *brush);
143

144
gint                   gimp_brush_get_spacing        (GimpBrush        *brush);
145 146 147
void                   gimp_brush_set_spacing        (GimpBrush        *brush,
                                                      gint              spacing);

148 149
GimpVector2            gimp_brush_get_x_axis         (GimpBrush        *brush);
GimpVector2            gimp_brush_get_y_axis         (GimpBrush        *brush);
150

151 152
void                   gimp_brush_flush_blur_caches  (GimpBrush        *brush);
gdouble                gimp_brush_get_blur_hardness  (GimpBrush        *brush);
153 154

#endif /* __GIMP_BRUSH_H__ */