libmypaint  1.6.0
mypaint-brush.h
Go to the documentation of this file.
1 #ifndef MYPAINTBRUSH_H
2 #define MYPAINTBRUSH_H
3 
4 /* libmypaint - The MyPaint Brush Library
5  * Copyright (C) 2008 Martin Renold <martinxyz@gmx.ch>
6  * Copyright (C) 2012 Jon Nordby <jononor@gmail.com>
7  *
8  * Permission to use, copy, modify, and/or distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 #include "mypaint-config.h"
22 #include "mypaint-surface.h"
23 #include "mypaint-brush-settings.h"
24 
38 typedef struct MyPaintBrush MyPaintBrush;
39 
47 
61 mypaint_brush_new_with_buckets(int num_smudge_buckets);
62 
70 void
72 
80 void
82 
94 void
96 
106 void
108 
114 int
116  MyPaintBrush* self, MyPaintSurface* surface, float x, float y, float pressure, float xtilt, float ytilt,
117  double dtime);
118 
124 int
126  MyPaintBrush* self, MyPaintSurface2* surface, float x, float y, float pressure, float xtilt, float ytilt,
127  double dtime, float viewzoom, float viewrotation, float barrel_rotation);
128 
142 int
144  MyPaintBrush* self, MyPaintSurface2* surface, float x, float y, float pressure, float xtilt, float ytilt,
145  double dtime, float viewzoom, float viewrotation, float barrel_rotation);
146 
152 void
154 
160 float
162 
171 gboolean
173 
179 int
181 
187 void
189 
195 int
197 
203 void
205 
211 void
213 
219 float
221 
227 void
229 
235 double
237 
243 void
245 
251 void
253 
254 
260 gboolean
261 mypaint_brush_from_string(MyPaintBrush *self, const char *string);
262 
263 
265 
266 #endif // MYPAINTBRUSH_H
MyPaintBrushInput
Definition: mypaint-brush-settings-gen.h:5
MyPaintBrushSetting
Definition: mypaint-brush-settings-gen.h:27
MyPaintBrushState
Definition: mypaint-brush-settings-gen.h:95
gint gboolean
Definition: mypaint-glib-compat.h:25
#define G_END_DECLS
Definition: mypaint-glib-compat.h:14
#define G_BEGIN_DECLS
Definition: mypaint-glib-compat.h:13
Maintains the data and state required to perform brush strokes.
int mypaint_brush_stroke_to_2_linearsRGB(MyPaintBrush *self, MyPaintSurface2 *surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation)
Same as mypaint_brush_stroke_to_2, but using linear sRGB for color dynamics.
int mypaint_brush_get_inputs_used_n(MyPaintBrush *self, MyPaintBrushSetting id)
Get the number of input mappings for a brush setting.
void mypaint_brush_from_defaults(MyPaintBrush *self)
Initialize a brush with default values for all settings.
void mypaint_brush_reset(MyPaintBrush *self)
Request a reset if the brush state.
gboolean mypaint_brush_from_string(MyPaintBrush *self, const char *string)
Initialize a brush from a JSON string.
MyPaintBrush * mypaint_brush_new(void)
Create a new brush.
void mypaint_brush_new_stroke(MyPaintBrush *self)
Start a new stroke.
float mypaint_brush_get_state(MyPaintBrush *self, MyPaintBrushState i)
Get the value of a brush state.
MyPaintBrush * mypaint_brush_new_with_buckets(int num_smudge_buckets)
Create a new brush with smudge buckets enabled.
double mypaint_brush_get_total_stroke_painting_time(MyPaintBrush *self)
Get the total time recorded since the last call to mypaint_brush_reset.
int mypaint_brush_stroke_to(MyPaintBrush *self, MyPaintSurface *surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime)
Use the brush to draw a stroke segment on a MyPaintSurface.
void mypaint_brush_unref(MyPaintBrush *self)
Decrease the reference count by one, destroying the brush if it reaches 0.
gboolean mypaint_brush_is_constant(MyPaintBrush *self, MyPaintBrushSetting id)
Check if there are no dynamics/mappings for a brush setting.
int mypaint_brush_stroke_to_2(MyPaintBrush *self, MyPaintSurface2 *surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation)
Use the brush to draw a stroke segment on a MyPaintSurface2.
void mypaint_brush_set_print_inputs(MyPaintBrush *self, gboolean enabled)
Enable/Disable debug printouts.
void mypaint_brush_set_state(MyPaintBrush *self, MyPaintBrushState i, float value)
Set the value of a brush state.
void mypaint_brush_set_base_value(MyPaintBrush *self, MyPaintBrushSetting id, float value)
Set the base value of a brush setting.
void mypaint_brush_get_mapping_point(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int index, float *x, float *y)
Get the coordinates of a point in an input mapping for a brush setting.
void mypaint_brush_set_mapping_n(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int n)
Set the number of points in an input mapping for a brush setting.
void mypaint_brush_set_mapping_point(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int index, float x, float y)
Set the coordinates of a point in an input mapping for a brush setting.
void mypaint_brush_ref(MyPaintBrush *self)
Increase the reference count by one.
float mypaint_brush_get_base_value(MyPaintBrush *self, MyPaintBrushSetting id)
Get the base value of a brush setting.
int mypaint_brush_get_mapping_n(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input)
Get the number of points in an input mapping for a brush setting.
Extends MyPaintSurface with support for spectral ops and multiple bounding boxes.
Definition: mypaint-surface.h:321
Abstract surface type for the MyPaint brush engine.
Definition: mypaint-surface.h:131