libmypaint
1.6.0
|
Maintains the data and state required to perform brush strokes. More...
#include <mypaint-brush.h>
Public Member Functions | |
MyPaintBrush * | mypaint_brush_new (void) |
Create a new brush. More... | |
MyPaintBrush * | mypaint_brush_new_with_buckets (int num_smudge_buckets) |
Create a new brush with smudge buckets enabled. More... | |
void | mypaint_brush_unref (MyPaintBrush *self) |
Decrease the reference count by one, destroying the brush if it reaches 0. More... | |
void | mypaint_brush_ref (MyPaintBrush *self) |
Increase the reference count by one. More... | |
void | mypaint_brush_reset (MyPaintBrush *self) |
Request a reset if the brush state. More... | |
void | mypaint_brush_new_stroke (MyPaintBrush *self) |
Start a new stroke. More... | |
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. More... | |
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. More... | |
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. More... | |
void | mypaint_brush_set_base_value (MyPaintBrush *self, MyPaintBrushSetting id, float value) |
Set the base value of a brush setting. More... | |
float | mypaint_brush_get_base_value (MyPaintBrush *self, MyPaintBrushSetting id) |
Get the base value of a brush setting. More... | |
gboolean | mypaint_brush_is_constant (MyPaintBrush *self, MyPaintBrushSetting id) |
Check if there are no dynamics/mappings for a brush setting. More... | |
int | mypaint_brush_get_inputs_used_n (MyPaintBrush *self, MyPaintBrushSetting id) |
Get the number of input mappings for a brush setting. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
float | mypaint_brush_get_state (MyPaintBrush *self, MyPaintBrushState i) |
Get the value of a brush state. More... | |
void | mypaint_brush_set_state (MyPaintBrush *self, MyPaintBrushState i, float value) |
Set the value of a brush state. More... | |
double | mypaint_brush_get_total_stroke_painting_time (MyPaintBrush *self) |
Get the total time recorded since the last call to mypaint_brush_reset. More... | |
void | mypaint_brush_set_print_inputs (MyPaintBrush *self, gboolean enabled) |
Enable/Disable debug printouts. More... | |
void | mypaint_brush_from_defaults (MyPaintBrush *self) |
Initialize a brush with default values for all settings. More... | |
gboolean | mypaint_brush_from_string (MyPaintBrush *self, const char *string) |
Initialize a brush from a JSON string. More... | |
Maintains the data and state required to perform brush strokes.
This is the hub and core of the brush engine, holding the settings, mappings and state that is used to calculate the location, and other properties, of the dabs that make up painted strokes.
The brush is an opaque struct using manual reference counting and handles its own destruction based on that. See mypaint_brush_ref and mypaint_brush_unref.
void mypaint_brush_from_defaults | ( | MyPaintBrush * | self | ) |
Initialize a brush with default values for all settings.
gboolean mypaint_brush_from_string | ( | MyPaintBrush * | self, |
const char * | string | ||
) |
Initialize a brush from a JSON string.
float mypaint_brush_get_base_value | ( | MyPaintBrush * | self, |
MyPaintBrushSetting | id | ||
) |
Get the base value of a brush setting.
int mypaint_brush_get_inputs_used_n | ( | MyPaintBrush * | self, |
MyPaintBrushSetting | id | ||
) |
Get the number of input mappings for 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.
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.
float mypaint_brush_get_state | ( | MyPaintBrush * | self, |
MyPaintBrushState | i | ||
) |
Get the value of a brush state.
double mypaint_brush_get_total_stroke_painting_time | ( | MyPaintBrush * | self | ) |
Get the total time recorded since the last call to mypaint_brush_reset.
gboolean mypaint_brush_is_constant | ( | MyPaintBrush * | self, |
MyPaintBrushSetting | id | ||
) |
Check if there are no dynamics/mappings for a brush setting.
This will return FALSE if any input mappings exist for the setting with the given id, even if all such mappings themselves are constant.
MyPaintBrush * mypaint_brush_new | ( | void | ) |
Create a new brush.
void mypaint_brush_new_stroke | ( | MyPaintBrush * | self | ) |
Start a new stroke.
Reset the stroke time parameters. Not directly related to mypaint_stroke_to (and varieties), calling the former does not require calling mypaint_brush_new_stroke.
MyPaintBrush * mypaint_brush_new_with_buckets | ( | int | num_smudge_buckets | ) |
Create a new brush with smudge buckets enabled.
This kind of brush is required to make use of the MYPAINT_BRUSH_SETTING_SMUDGE_BUCKET setting.
Smudge buckets are an array of smudge data states, used to allow dabs in offset locations to use smudge data consistent with their location, when those location-sequential dabs are not actually drawn consecutively.
void mypaint_brush_ref | ( | MyPaintBrush * | self | ) |
Increase the reference count by one.
Not safe to call with NULL!
void mypaint_brush_reset | ( | MyPaintBrush * | self | ) |
Request a reset if the brush state.
The request is not acted on immediately, but only in subsequent calls to mypaint_brush_stroke_to and/or mypaint_brush_stroke_to2.
Only state values (including smudge buckets, if used) are affected upon reset, not settings/mappings.
void mypaint_brush_set_base_value | ( | MyPaintBrush * | self, |
MyPaintBrushSetting | id, | ||
float | value | ||
) |
Set the base value of 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_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.
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.
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.
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.
The settings that are handled differently from the other call are:
void mypaint_brush_unref | ( | MyPaintBrush * | self | ) |
Decrease the reference count by one, destroying the brush if it reaches 0.
Not safe to call with NULL!