pub struct Stroke { /* private fields */ }
v4_14
only.Expand description
A Stroke
struct collects the parameters that influence
the operation of stroking a path.
Implementations§
source§impl Stroke
impl Stroke
sourcepub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const *const GskStroke) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>(ptr: *const *const GskStroke) -> &'a Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut *mut GskStroke
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut GskStroke ) -> &'a 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
Returns the dash_offset of a Stroke
.
sourcepub fn line_width(&self) -> f32
pub fn line_width(&self) -> f32
sourcepub fn miter_limit(&self) -> f32
pub fn miter_limit(&self) -> f32
Returns the miter limit of a Stroke
.
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 PartialEq for Stroke
impl PartialEq for Stroke
source§impl PartialOrd for Stroke
impl PartialOrd for Stroke
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for Stroke
impl StaticType for Stroke
source§fn static_type() -> Type
fn static_type() -> Type
Self
.