Loading...
Searching...
No Matches
mypaint-brush.h
Go to the documentation of this file.
#ifndef MYPAINTBRUSH_H
#define MYPAINTBRUSH_H
/* libmypaint - The MyPaint Brush Library
* Copyright (C) 2008 Martin Renold <martinxyz@gmx.ch>
* Copyright (C) 2012 Jon Nordby <jononor@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "mypaint-config.h"
#include "mypaint-surface.h"
#include "mypaint-brush-settings.h"
G_BEGIN_DECLS
typedef struct MyPaintBrush MyPaintBrush;
MyPaintBrush *
mypaint_brush_new(void);
MyPaintBrush *
mypaint_brush_new_with_buckets(int num_smudge_buckets);
void
mypaint_brush_unref(MyPaintBrush *self);
void
mypaint_brush_ref(MyPaintBrush *self);
void
mypaint_brush_reset(MyPaintBrush *self);
void
mypaint_brush_new_stroke(MyPaintBrush *self);
int
mypaint_brush_stroke_to(
MyPaintBrush* self, MyPaintSurface* surface, float x, float y, float pressure, float xtilt, float ytilt,
double dtime);
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);
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);
void
mypaint_brush_set_base_value(MyPaintBrush *self, MyPaintBrushSetting id, float value);
float
mypaint_brush_get_base_value(MyPaintBrush *self, MyPaintBrushSetting id);
gboolean
mypaint_brush_is_constant(MyPaintBrush *self, MyPaintBrushSetting id);
int
mypaint_brush_get_inputs_used_n(MyPaintBrush *self, MyPaintBrushSetting id);
void
mypaint_brush_set_mapping_n(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int n);
int
mypaint_brush_get_mapping_n(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input);
void
mypaint_brush_set_mapping_point(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int index, float x, float y);
void
mypaint_brush_get_mapping_point(MyPaintBrush *self, MyPaintBrushSetting id, MyPaintBrushInput input, int index, float *x, float *y);
float
mypaint_brush_get_state(MyPaintBrush *self, MyPaintBrushState i);
void
mypaint_brush_set_state(MyPaintBrush *self, MyPaintBrushState i, float value);
double
mypaint_brush_get_total_stroke_painting_time(MyPaintBrush *self);
void
mypaint_brush_set_print_inputs(MyPaintBrush *self, gboolean enabled);
void
mypaint_brush_from_defaults(MyPaintBrush *self);
gboolean
mypaint_brush_from_string(MyPaintBrush *self, const char *string);
G_END_DECLS
#endif // MYPAINTBRUSH_H
MyPaintBrushInput
MyPaintBrushInput
Definition mypaint-brush-settings-gen.h:5
MyPaintBrushSetting
MyPaintBrushSetting
Definition mypaint-brush-settings-gen.h:27
MyPaintBrushState
MyPaintBrushState
Definition mypaint-brush-settings-gen.h:95
mypaint-brush-settings.h
mypaint-config.h
gboolean
gint gboolean
Definition mypaint-glib-compat.h:25
G_END_DECLS
#define G_END_DECLS
Definition mypaint-glib-compat.h:14
G_BEGIN_DECLS
#define G_BEGIN_DECLS
Definition mypaint-glib-compat.h:13
mypaint-surface.h
MyPaintBrush
Maintains the data and state required to perform brush strokes.
MyPaintBrush::mypaint_brush_stroke_to_2_linearsRGB
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.
MyPaintBrush::mypaint_brush_get_inputs_used_n
int mypaint_brush_get_inputs_used_n(MyPaintBrush *self, MyPaintBrushSetting id)
Get the number of input mappings for a brush setting.
MyPaintBrush::mypaint_brush_from_defaults
void mypaint_brush_from_defaults(MyPaintBrush *self)
Initialize a brush with default values for all settings.
MyPaintBrush::mypaint_brush_reset
void mypaint_brush_reset(MyPaintBrush *self)
Request a reset if the brush state.
MyPaintBrush::mypaint_brush_from_string
gboolean mypaint_brush_from_string(MyPaintBrush *self, const char *string)
Initialize a brush from a JSON string.
MyPaintBrush::mypaint_brush_new
MyPaintBrush * mypaint_brush_new(void)
Create a new brush.
MyPaintBrush::mypaint_brush_new_stroke
void mypaint_brush_new_stroke(MyPaintBrush *self)
Start a new stroke.
MyPaintBrush::mypaint_brush_get_state
float mypaint_brush_get_state(MyPaintBrush *self, MyPaintBrushState i)
Get the value of a brush state.
MyPaintBrush::mypaint_brush_new_with_buckets
MyPaintBrush * mypaint_brush_new_with_buckets(int num_smudge_buckets)
Create a new brush with smudge buckets enabled.
MyPaintBrush::mypaint_brush_get_total_stroke_painting_time
double mypaint_brush_get_total_stroke_painting_time(MyPaintBrush *self)
Get the total time recorded since the last call to mypaint_brush_reset.
MyPaintBrush::mypaint_brush_stroke_to
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.
MyPaintBrush::mypaint_brush_unref
void mypaint_brush_unref(MyPaintBrush *self)
Decrease the reference count by one, destroying the brush if it reaches 0.
MyPaintBrush::mypaint_brush_is_constant
gboolean mypaint_brush_is_constant(MyPaintBrush *self, MyPaintBrushSetting id)
Check if there are no dynamics/mappings for a brush setting.
MyPaintBrush::mypaint_brush_stroke_to_2
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.
MyPaintBrush::mypaint_brush_set_print_inputs
void mypaint_brush_set_print_inputs(MyPaintBrush *self, gboolean enabled)
Enable/Disable debug printouts.
MyPaintBrush::mypaint_brush_set_state
void mypaint_brush_set_state(MyPaintBrush *self, MyPaintBrushState i, float value)
Set the value of a brush state.
MyPaintBrush::mypaint_brush_set_base_value
void mypaint_brush_set_base_value(MyPaintBrush *self, MyPaintBrushSetting id, float value)
Set the base value of a brush setting.
MyPaintBrush::mypaint_brush_get_mapping_point
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.
MyPaintBrush::mypaint_brush_set_mapping_n
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.
MyPaintBrush::mypaint_brush_set_mapping_point
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.
MyPaintBrush::mypaint_brush_ref
void mypaint_brush_ref(MyPaintBrush *self)
Increase the reference count by one.
MyPaintBrush::mypaint_brush_get_base_value
float mypaint_brush_get_base_value(MyPaintBrush *self, MyPaintBrushSetting id)
Get the base value of a brush setting.
MyPaintBrush::mypaint_brush_get_mapping_n
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.
MyPaintSurface2
Extends MyPaintSurface with support for spectral ops and multiple bounding boxes.
Definition mypaint-surface.h:321
MyPaintSurface
Abstract surface type for the MyPaint brush engine.
Definition mypaint-surface.h:131