MyPaint.Brush

Fields

None

Methods

class

input_from_cname (cname)

class

new ()

class

new_with_buckets (num_smudge_buckets)

class

setting_from_cname (cname)

from_defaults ()

from_string (string)

get_base_value (id)

get_inputs_used_n (id)

get_mapping_n (id, input)

get_mapping_point (id, input, index)

get_state (i)

get_total_stroke_painting_time ()

is_constant (id)

new_stroke ()

reset ()

set_base_value (id, value)

set_mapping_n (id, input, n)

set_mapping_point (id, input, index, x, y)

set_print_inputs (enabled)

set_state (i, value)

stroke_to (surface, x, y, pressure, xtilt, ytilt, dtime)

Details

class MyPaint.Brush

The MyPaint brush engine class.

classmethod input_from_cname(cname)
Parameters:

cname (str) –

Return type:

MyPaint.BrushInput

classmethod new()
Return type:

MyPaint.Brush

Create a new MyPaint brush engine instance. Initial reference count is 1. Release references using mypaint_brush_unref()

classmethod new_with_buckets(num_smudge_buckets)
Parameters:

num_smudge_buckets (int) –

Return type:

MyPaint.Brush

classmethod setting_from_cname(cname)
Parameters:

cname (str) –

Return type:

MyPaint.BrushSetting

from_defaults()
from_string(string)
Parameters:

string (str) –

Return type:

bool

get_base_value(id)
Parameters:

id (MyPaint.BrushSetting) –

Return type:

float

Get the base value of a brush setting.

get_inputs_used_n(id)
Parameters:

id (MyPaint.BrushSetting) –

Return type:

int

Returns how many inputs are used for the dynamics of a MyPaint.BrushSetting

get_mapping_n(id, input)
Parameters:
Return type:

int

Get the number of points used for the dynamics mapping between a MyPaint.BrushInput and MyPaint.BrushSetting.

get_mapping_point(id, input, index)
Parameters:
Returns:

x:

Location to return the X value

y:

Location to return the Y value

Return type:

(x: float, y: float)

Get a X,Y point of a dynamics mapping.

get_state(i)
Parameters:

i (MyPaint.BrushState) –

Return type:

float

Get an internal brush engine state. Normally used for debugging, but can be used to implement record & replay functionality.

get_total_stroke_painting_time()
Return type:

float

Return the total amount of painting time for the current stroke.

is_constant(id)
Parameters:

id (MyPaint.BrushSetting) –

Return type:

bool

Returns True if the brush has no dynamics for the given MyPaint.BrushSetting

new_stroke()

Start a new stroke.

reset()

Reset the current brush engine state. Used when the next MyPaint.Brush.stroke_to() call is not related to the current state. Note that the reset request is queued and changes in state will only happen on next stroke_to()

set_base_value(id, value)
Parameters:

Set the base value of a brush setting.

set_mapping_n(id, input, n)
Parameters:

Set the number of points used for the dynamics mapping between a MyPaint.BrushInput and MyPaint.BrushSetting.

set_mapping_point(id, input, index, x, y)
Parameters:

Set a X,Y point of a dynamics mapping. The index must be within the number of points set using MyPaint.Brush.set_mapping_n()

set_print_inputs(enabled)
Parameters:

enabled (bool) –

Enable/Disable printing of brush engine inputs on stderr. Intended for debugging only.

set_state(i, value)
Parameters:

Set an internal brush engine state. Normally used for debugging, but can be used to implement record & replay functionality.

stroke_to(surface, x, y, pressure, xtilt, ytilt, dtime)
Parameters:
Returns:

non-0 if the stroke is finished or empty, else 0.

Return type:

int

Should be called once for each motion event.