libmypaint
1.6.0
|
Abstract surface type for the MyPaint brush engine. More...
#include <mypaint-surface.h>
Public Types | |
typedef int(* | MyPaintSurfaceDrawDabFunction) (MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g, float color_b, float opaque, float hardness, float alpha_eraser, float aspect_ratio, float angle, float lock_alpha, float colorize) |
Function used to draw a dab with the given properties on the surface. More... | |
typedef void(* | MyPaintSurfaceDestroyFunction) (MyPaintSurface *self) |
Destructor for surface implementations. More... | |
typedef void(* | MyPaintSurfaceSavePngFunction) (MyPaintSurface *self, const char *path, int x, int y, int width, int height) |
Function for rendering a png file from a surface. More... | |
typedef void(* | MyPaintSurfaceBeginAtomicFunction) (MyPaintSurface *self) |
Prepare the surface for an atomic set of stroke operations. More... | |
typedef void(* | MyPaintSurfaceEndAtomicFunction) (MyPaintSurface *self, MyPaintRectangle *roi) |
Finalize an atomic set of stroke operations, setting an invalidation rectangle. More... | |
Public Member Functions | |
int | mypaint_surface_draw_dab (MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g, float color_b, float opaque, float hardness, float alpha_eraser, float aspect_ratio, float angle, float lock_alpha, float colorize) |
Invoke MyPaintSurface::draw_dab. More... | |
void | mypaint_surface_get_color (MyPaintSurface *self, float x, float y, float radius, float *color_r, float *color_g, float *color_b, float *color_a) |
Invoke MyPaintSurface::get_color. More... | |
float | mypaint_surface_get_alpha (MyPaintSurface *self, float x, float y, float radius) |
Invoke MyPaintSurface::get_color and return the alpha component. More... | |
void | mypaint_surface_save_png (MyPaintSurface *self, const char *path, int x, int y, int width, int height) |
Invoke MyPaintSurface::save_png. More... | |
void | mypaint_surface_begin_atomic (MyPaintSurface *self) |
Invoke MyPaintSurface::begin_atomic. More... | |
void | mypaint_surface_end_atomic (MyPaintSurface *self, MyPaintRectangle *roi) |
Invoke MyPaintSurface::begin_atomic. More... | |
void | mypaint_surface_init (MyPaintSurface *self) |
Set refcount to 1. More... | |
void | mypaint_surface_ref (MyPaintSurface *self) |
Increase refcount by 1. More... | |
void | mypaint_surface_unref (MyPaintSurface *self) |
Decrease refcount by 1 and call destroy if it reaches 0. More... | |
Data Fields | |
MyPaintSurfaceDrawDabFunction | draw_dab |
Function for drawing a dab on the surface. More... | |
MyPaintSurfaceGetColorFunction | get_color |
Function for retrieving color data from the surface. More... | |
MyPaintSurfaceBeginAtomicFunction | begin_atomic |
Prepare the surface for a set of atomic stroke/dab operations. More... | |
MyPaintSurfaceEndAtomicFunction | end_atomic |
Finalize the operations run after a call to begin_atomic. More... | |
MyPaintSurfaceDestroyFunction | destroy |
Destroy the surface (free up all allocated resources). More... | |
MyPaintSurfaceSavePngFunction | save_png |
Save a region of the surface to a png file. More... | |
int | refcount |
Reference count - number of references to the struct. More... | |
Abstract surface type for the MyPaint brush engine.
The surface interface lets the brush engine specify dabs to render, and get color data for use in interpolations.
typedef void(* MyPaintSurfaceBeginAtomicFunction) (MyPaintSurface *self) |
Prepare the surface for an atomic set of stroke operations.
Each call to functions of this type should be matched by a call to a MyPaintSurfaceEndAtomicFunction with the same surface.
typedef void(* MyPaintSurfaceDestroyFunction) (MyPaintSurface *self) |
Destructor for surface implementations.
self | The surface to free/destroy |
typedef int(* MyPaintSurfaceDrawDabFunction) (MyPaintSurface *self, float x, float y, float radius, float color_r, float color_g, float color_b, float opaque, float hardness, float alpha_eraser, float aspect_ratio, float angle, float lock_alpha, float colorize) |
Function used to draw a dab with the given properties on the surface.
The function drawing the dab is one of the core parts of any surface implementation. These functions will usually not be invoked directly by library users, but indirectly as part of the mypaint_brush_stroke_to call, where the interpolated parameters for each dab are calculated.
self | The surface on which the dab will be drawn |
x,y | The center of the dab |
radius | The radius of the dab |
color_r,color_g,color_b,opaque | color/opacity of the dab |
hardness | Determines how opacity is retained for pixels further from the dab center. |
alpha_eraser | Hell if I know |
aspect_ratio | The width/height ratio of the dab. |
angle | The angle of the dab (applied after aspect_ratio). |
lock_alpha | The extent to which the alpha values of affected pixels on the surface are retained, regardless of other dab parameters. |
colorize | The extent to which the dab will only affect the hue of existing pixels on the surface. |
typedef void(* MyPaintSurfaceEndAtomicFunction) (MyPaintSurface *self, MyPaintRectangle *roi) |
Finalize an atomic set of stroke operations, setting an invalidation rectangle.
Each call to functions of this type should be matched by a call to a MyPaintSurfaceBeginAtomicFunction with the same surface.
typedef void(* MyPaintSurfaceSavePngFunction) (MyPaintSurface *self, const char *path, int x, int y, int width, int height) |
Function for rendering a png file from a surface.
self | The surface to render from |
path | The destination of the png file |
x,y | The top left corner of the area to export |
width,height | The dimensions of the area & of the resulting png |
void mypaint_surface_begin_atomic | ( | MyPaintSurface * | self | ) |
Invoke MyPaintSurface::begin_atomic.
int mypaint_surface_draw_dab | ( | MyPaintSurface * | self, |
float | x, | ||
float | y, | ||
float | radius, | ||
float | color_r, | ||
float | color_g, | ||
float | color_b, | ||
float | opaque, | ||
float | hardness, | ||
float | alpha_eraser, | ||
float | aspect_ratio, | ||
float | angle, | ||
float | lock_alpha, | ||
float | colorize | ||
) |
Invoke MyPaintSurface::draw_dab.
void mypaint_surface_end_atomic | ( | MyPaintSurface * | self, |
MyPaintRectangle * | roi | ||
) |
Invoke MyPaintSurface::begin_atomic.
float mypaint_surface_get_alpha | ( | MyPaintSurface * | self, |
float | x, | ||
float | y, | ||
float | radius | ||
) |
Invoke MyPaintSurface::get_color and return the alpha component.
void mypaint_surface_get_color | ( | MyPaintSurface * | self, |
float | x, | ||
float | y, | ||
float | radius, | ||
float * | color_r, | ||
float * | color_g, | ||
float * | color_b, | ||
float * | color_a | ||
) |
Invoke MyPaintSurface::get_color.
void mypaint_surface_init | ( | MyPaintSurface * | self | ) |
Set refcount to 1.
void mypaint_surface_ref | ( | MyPaintSurface * | self | ) |
Increase refcount by 1.
void mypaint_surface_save_png | ( | MyPaintSurface * | self, |
const char * | path, | ||
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Invoke MyPaintSurface::save_png.
void mypaint_surface_unref | ( | MyPaintSurface * | self | ) |
MyPaintSurfaceBeginAtomicFunction MyPaintSurface::begin_atomic |
Prepare the surface for a set of atomic stroke/dab operations.
See MyPaintSurfaceBeginAtomicFunction for details.
MyPaintSurfaceDestroyFunction MyPaintSurface::destroy |
Destroy the surface (free up all allocated resources).
MyPaintSurfaceDrawDabFunction MyPaintSurface::draw_dab |
Function for drawing a dab on the surface.
See MyPaintSurfaceDrawDabFunction for details.
MyPaintSurfaceEndAtomicFunction MyPaintSurface::end_atomic |
Finalize the operations run after a call to begin_atomic.
See MyPaintSurfaceEndAtomicFunction for details.
MyPaintSurfaceGetColorFunction MyPaintSurface::get_color |
Function for retrieving color data from the surface.
See MyPaintSurfaceGetColorFunction for details.
int MyPaintSurface::refcount |
Reference count - number of references to the struct.
This is only useful when used in a context with automatic memory management and can be ignored if construction/destruction is handled manually.
MyPaintSurfaceSavePngFunction MyPaintSurface::save_png |
Save a region of the surface to a png file.
See MyPaintSurfaceSavePngFunction for details