pub struct Stroke { /* private fields */ }
v4_14
only.Expand description
A Stroke
struct collects the parameters that influence
the operation of stroking a path.
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
Source§impl Stroke
impl Stroke
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskStroke) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GskStroke) -> &Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut(ptr: &mut *mut GskStroke) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut(ptr: &mut *mut GskStroke) -> &mut Self
Borrows the underlying C value mutably.
Source§impl Stroke
impl Stroke
Sourcepub fn dash(&self) -> Vec<f32>
pub fn dash(&self) -> Vec<f32>
Gets the dash array in use or NULL
if dashing is disabled.
§Returns
The dash array or NULL
if the dash array is empty.
Sourcepub fn dash_offset(&self) -> f32
pub fn dash_offset(&self) -> f32
Sourcepub fn line_width(&self) -> f32
pub fn line_width(&self) -> f32
Sourcepub fn miter_limit(&self) -> f32
pub fn miter_limit(&self) -> f32
Sourcepub fn set_dash(&self, dash: &[f32])
pub fn set_dash(&self, dash: &[f32])
Sets the dash pattern to use by this stroke.
A dash pattern is specified by an array of alternating non-negative values. Each value provides the length of alternate “on” and “off” portions of the stroke.
Each “on” segment will have caps applied as if the segment were a
separate contour. In particular, it is valid to use an “on” length
of 0 with GSK_LINE_CAP_ROUND
or GSK_LINE_CAP_SQUARE
to draw dots
or squares along a path.
If @n_dash is 0, if all elements in @dash are 0, or if there are negative values in @dash, then dashing is disabled.
If @n_dash is 1, an alternating “on” and “off” pattern with the single dash length provided is assumed.
If @n_dash is uneven, the dash array will be used with the first element in @dash defining an “on” or “off” in alternating passes through the array.
You can specify a starting offset into the dash with
set_dash_offset()
.
§dash
the array of dashes
Sourcepub fn set_dash_offset(&self, offset: f32)
pub fn set_dash_offset(&self, offset: f32)
Sets the offset into the dash pattern where dashing should begin.
This is an offset into the length of the path, not an index into the array values of the dash array.
See set_dash()
for more details on dashing.
§offset
offset into the dash pattern
Sourcepub fn set_line_cap(&self, line_cap: LineCap)
pub fn set_line_cap(&self, line_cap: LineCap)
Sourcepub fn set_line_join(&self, line_join: LineJoin)
pub fn set_line_join(&self, line_join: LineJoin)
Sourcepub fn set_line_width(&self, line_width: f32)
pub fn set_line_width(&self, line_width: f32)
Sets the line width to be used when stroking.
The line width must be > 0.
§line_width
width of the line in pixels
Sourcepub fn set_miter_limit(&self, limit: f32)
pub fn set_miter_limit(&self, limit: f32)
Sets the limit for the distance from the corner where sharp turns of joins get cut off.
The miter limit is in units of line width and must be non-negative.
For joins of type GSK_LINE_JOIN_MITER
that exceed the miter
limit, the join gets rendered as if it was of type
GSK_LINE_JOIN_BEVEL
.
§limit
the miter limit
Source§impl Stroke
impl Stroke
Sourcepub fn builder(line_width: f32) -> StrokeBuilder
pub fn builder(line_width: f32) -> StrokeBuilder
Creates a new builder-pattern struct instance to construct a Stroke
.
This method returns an instance of
StrokeBuilder
which can be used to
create a Stroke
.
Trait Implementations§
Source§impl HasParamSpec for Stroke
impl HasParamSpec for Stroke
Source§impl Ord for Stroke
impl Ord for Stroke
Source§impl PartialOrd for Stroke
impl PartialOrd for Stroke
Source§impl StaticType for Stroke
impl StaticType for Stroke
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.