Gimp.Brush¶
- Subclasses:
None
Methods¶
- Inherited:
Gimp.Resource (20), GObject.Object (37), Gimp.ConfigInterface (14)
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gimp.Brush(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Installable object used by painting and stroking tools.
- classmethod get_by_name(name)¶
- Parameters:
name (
str
) – The name of the brush.- Returns:
The brush.
- Return type:
Gimp.Brush
orNone
Returns the brush with the given name.
Return an existing brush having the given name. Returns
None
when no brush exists of that name.New in version 3.0.
- classmethod new(name)¶
- Parameters:
name (
str
) – The requested name of the new brush.- Returns:
The brush.
- Return type:
Create a new generated brush having default parameters.
Creates a new, parametric brush.
New in version 2.2.
- get_angle()¶
- Returns:
True
on success.- angle:
The rotation angle of the brush in degree.
- Return type:
Gets the rotation angle of a generated brush.
Gets the angle of rotation for a generated brush. Returns an error when called for a non-parametric brush.
New in version 2.4.
- get_aspect_ratio()¶
- Returns:
True
on success.- aspect_ratio:
The aspect ratio of the brush.
- Return type:
Gets the aspect ratio of a generated brush.
Gets the aspect ratio of a generated brush. Returns an error when called for a non-parametric brush. The aspect ratio is a double between 0.0 and 1000.0.
New in version 2.4.
- get_buffer(max_width, max_height, format)¶
- Parameters:
max_width (
int
) – a maximum width for the returned buffer.max_height (
int
) – a maximum height for the returned buffer.format (
Babl.Object
) – an optionalBabl.Object
format.
- Returns:
a [class`Gegl`.Buffer] of
None
if the brush is parametric or mask only.- Return type:
Gets pixel data of the brush within the bounding box specified by max_width and max_height. The data will be scaled down so that it fits within this size without changing its ratio. If the brush is smaller than this size to begin with, it will not be scaled up.
If max_width or max_height are
None
, the buffer is returned in the brush’s native size.When the brush is parametric or a raster mask, only the mask (as returned by [method`Gimp`.Brush.get_mask]) will be set. The returned buffer will be
None
.Make sure you called [func`Gegl`.init] before calling any function using
GEGL
.
- get_hardness()¶
-
Gets the hardness of a generated brush.
Gets the hardness of a generated brush. The hardness of a brush is the amount its intensity fades at the outside edge, as a double between 0.0 and 1.0. Returns an error when called for a non-parametric brush.
New in version 2.4.
- get_info()¶
- Returns:
True
on success.- width:
The brush width.
- height:
The brush height.
- mask_bpp:
The brush mask bpp.
- color_bpp:
The brush color bpp.
- Return type:
(
bool
, width:int
, height:int
, mask_bpp:int
, color_bpp:int
)
Gets information about the brush.
Gets information about the brush: brush extents (width and height), color depth and mask depth (bpp). The color bpp is zero when the brush is parametric versus raster.
New in version 2.2.
- get_mask(max_width, max_height, format)¶
- Parameters:
max_width (
int
) – a maximum width for the returned buffer.max_height (
int
) – a maximum height for the returned buffer.format (
Babl.Object
) – an optionalBabl.Object
format.
- Returns:
a [class`Gegl`.Buffer] representing the self mask.
- Return type:
Gets mask data of the brush within the bounding box specified by max_width and max_height. The data will be scaled down so that it fits within this size without changing its ratio. If the brush is smaller than this size to begin with, it will not be scaled up.
If max_width or max_height are
None
, the buffer is returned in the brush’s native size.Make sure you called [func`Gegl`.init] before calling any function using
GEGL
.
- get_radius()¶
- Returns:
True
on success.- radius:
The radius of the brush in pixels.
- Return type:
Gets the radius of a generated brush.
Gets the radius of a generated brush. Returns an error when called for a non-parametric brush.
New in version 2.4.
- get_shape()¶
- Returns:
True
on success.- shape:
The brush shape.
- Return type:
(
bool
, shape:Gimp.BrushGeneratedShape
)
Gets the shape of a generated brush.
Gets the shape of a generated brush. Returns an error when called for a non-parametric brush. The choices for shape are Circle (
Gimp.BrushGeneratedShape.CIRCLE
), Square (Gimp.BrushGeneratedShape.SQUARE
), and Diamond (Gimp.BrushGeneratedShape.DIAMOND
). Other shapes might be added in the future.New in version 2.4.
- get_spacing()¶
- Returns:
The brush spacing.
- Return type:
Gets the brush spacing, the stamping frequency.
Returns the spacing setting for the brush. Spacing is an integer between 0 and 1000 which represents a percentage of the maximum of the width and height of the mask. Both parametric and raster brushes have a spacing.
New in version 2.2.
- get_spikes()¶
- Returns:
True
on success.- spikes:
The number of spikes on the brush.
- Return type:
Gets the number of spikes for a generated brush.
Gets the number of spikes for a generated brush. Returns an error when called for a non-parametric brush.
New in version 2.4.
- is_generated()¶
-
Whether the brush is generated (parametric versus raster).
Returns
True
when brush is parametric.New in version 2.4.
- set_angle(angle_in)¶
- Parameters:
angle_in (
float
) – The desired brush rotation angle in degrees.- Returns:
True
on success.- angle_out:
The brush rotation angle actually assigned.
- Return type:
Sets the rotation angle of a generated brush.
Sets the rotation angle for a generated brush. Sets the angle modulo 180, in the range [-180.0, 180.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.
New in version 2.4.
- set_aspect_ratio(aspect_ratio_in)¶
- Parameters:
aspect_ratio_in (
float
) – The desired brush aspect ratio.- Returns:
True
on success.- aspect_ratio_out:
The brush aspect ratio actually assigned.
- Return type:
Sets the aspect ratio of a generated brush.
Sets the aspect ratio for a generated brush. Clamps aspect ratio to [0.0, 1000.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.
New in version 2.4.
- set_hardness(hardness_in)¶
- Parameters:
hardness_in (
float
) – The desired brush hardness.- Returns:
True
on success.- hardness_out:
The brush hardness actually assigned.
- Return type:
Sets the hardness of a generated brush.
Sets the hardness for a generated brush. Clamps hardness to [0.0, 1.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.
New in version 2.4.
- set_radius(radius_in)¶
- Parameters:
radius_in (
float
) – The desired brush radius in pixel.- Returns:
True
on success.- radius_out:
The brush radius actually assigned.
- Return type:
Sets the radius of a generated brush.
Sets the radius for a generated brush. Clamps radius to [0.0, 32767.0]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.
New in version 2.4.
- set_shape(shape_in)¶
- Parameters:
shape_in (
Gimp.BrushGeneratedShape
) – The brush shape.- Returns:
True
on success.- shape_out:
The brush shape actually assigned.
- Return type:
(
bool
, shape_out:Gimp.BrushGeneratedShape
)
Sets the shape of a generated brush.
Sets the shape of a generated brush. Returns an error when brush is non-parametric or not editable. The choices for shape are Circle (
Gimp.BrushGeneratedShape.CIRCLE
), Square (Gimp.BrushGeneratedShape.SQUARE
), and Diamond (Gimp.BrushGeneratedShape.DIAMOND
).New in version 2.4.
- set_spacing(spacing)¶
-
Sets the brush spacing.
Set the spacing for the brush. The spacing must be an integer between 0 and 1000. Both parametric and raster brushes have a spacing. Returns an error when the brush is not editable. Create a new or copied brush or to get an editable brush.
New in version 2.4.
- set_spikes(spikes_in)¶
- Parameters:
spikes_in (
int
) – The desired number of spikes.- Returns:
True
on success.- spikes_out:
The number of spikes actually assigned.
- Return type:
Sets the number of spikes for a generated brush.
Sets the number of spikes for a generated brush. Clamps spikes to [2,20]. Returns the clamped value. Returns an error when brush is non-parametric or not editable.
New in version 2.4.