1 /* GIMP - The GNU Image Manipulation Program 2 * Copyright (C) 1995 Spencer Kimball and Peter Mattis 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 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * 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 #ifndef __GIMP_BRUSH_H__ 19 #define __GIMP_BRUSH_H__ 20 21 22 #include "gimpdata.h" 23 24 25 #define GIMP_TYPE_BRUSH (gimp_brush_get_type ()) 26 #define GIMP_BRUSH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush)) 27 #define GIMP_BRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass)) 28 #define GIMP_IS_BRUSH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_BRUSH)) 29 #define GIMP_IS_BRUSH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH)) 30 #define GIMP_BRUSH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_BRUSH, GimpBrushClass)) 31 32 33 typedef struct _GimpBrushPrivate GimpBrushPrivate; 34 typedef struct _GimpBrushClass GimpBrushClass; 35 36 struct _GimpBrush 37 { 38 GimpData parent_instance; 39 40 GimpBrushPrivate *priv; 41 }; 42 43 struct _GimpBrushClass 44 { 45 GimpDataClass parent_class; 46 47 /* virtual functions */ 48 void (* begin_use) (GimpBrush *brush); 49 void (* end_use) (GimpBrush *brush); 50 GimpBrush * (* select_brush) (GimpBrush *brush, 51 const GimpCoords *last_coords, 52 const GimpCoords *current_coords); 53 gboolean (* want_null_motion) (GimpBrush *brush, 54 const GimpCoords *last_coords, 55 const GimpCoords *current_coords); 56 void (* transform_size) (GimpBrush *brush, 57 gdouble scale, 58 gdouble aspect_ratio, 59 gdouble angle, 60 gboolean reflect, 61 gint *width, 62 gint *height); 63 GimpTempBuf * (* transform_mask) (GimpBrush *brush, 64 gdouble scale, 65 gdouble aspect_ratio, 66 gdouble angle, 67 gboolean reflect, 68 gdouble hardness); 69 GimpTempBuf * (* transform_pixmap) (GimpBrush *brush, 70 gdouble scale, 71 gdouble aspect_ratio, 72 gdouble angle, 73 gboolean reflect, 74 gdouble hardness); 75 GimpBezierDesc * (* transform_boundary) (GimpBrush *brush, 76 gdouble scale, 77 gdouble aspect_ratio, 78 gdouble angle, 79 gboolean reflect, 80 gdouble hardness, 81 gint *width, 82 gint *height); 83 84 /* signals */ 85 void (* spacing_changed) (GimpBrush *brush); 86 }; 87 88 89 GType gimp_brush_get_type (void) G_GNUC_CONST; 90 91 GimpData * gimp_brush_new (GimpContext *context, 92 const gchar *name); 93 GimpData * gimp_brush_get_standard (GimpContext *context); 94 95 void gimp_brush_begin_use (GimpBrush *brush); 96 void gimp_brush_end_use (GimpBrush *brush); 97 98 GimpBrush * gimp_brush_select_brush (GimpBrush *brush, 99 const GimpCoords *last_coords, 100 const GimpCoords *current_coords); 101 gboolean gimp_brush_want_null_motion (GimpBrush *brush, 102 const GimpCoords *last_coords, 103 const GimpCoords *current_coords); 104 105 /* Gets width and height of a transformed mask of the brush, for 106 * provided parameters. 107 */ 108 void gimp_brush_transform_size (GimpBrush *brush, 109 gdouble scale, 110 gdouble aspect_ratio, 111 gdouble angle, 112 gboolean reflect, 113 gint *width, 114 gint *height); 115 const GimpTempBuf * gimp_brush_transform_mask (GimpBrush *brush, 116 gdouble scale, 117 gdouble aspect_ratio, 118 gdouble angle, 119 gboolean reflect, 120 gdouble hardness); 121 const GimpTempBuf * gimp_brush_transform_pixmap (GimpBrush *brush, 122 gdouble scale, 123 gdouble aspect_ratio, 124 gdouble angle, 125 gboolean reflect, 126 gdouble hardness); 127 const GimpBezierDesc * gimp_brush_transform_boundary (GimpBrush *brush, 128 gdouble scale, 129 gdouble aspect_ratio, 130 gdouble angle, 131 gboolean reflect, 132 gdouble hardness, 133 gint *width, 134 gint *height); 135 136 GimpTempBuf * gimp_brush_get_mask (GimpBrush *brush); 137 GimpTempBuf * gimp_brush_get_pixmap (GimpBrush *brush); 138 139 gint gimp_brush_get_width (GimpBrush *brush); 140 gint gimp_brush_get_height (GimpBrush *brush); 141 142 gint gimp_brush_get_spacing (GimpBrush *brush); 143 void gimp_brush_set_spacing (GimpBrush *brush, 144 gint spacing); 145 146 GimpVector2 gimp_brush_get_x_axis (GimpBrush *brush); 147 GimpVector2 gimp_brush_get_y_axis (GimpBrush *brush); 148 149 void gimp_brush_flush_blur_caches (GimpBrush *brush); 150 gdouble gimp_brush_get_blur_hardness (GimpBrush *brush); 151 152 #endif /* __GIMP_BRUSH_H__ */ 153