pub type DrawingPolygon<'a> = Drawing<'a, Polygon>;
Expand description
Initialised drawing state for a polygon.
Aliased Type§
struct DrawingPolygon<'a> { /* private fields */ }
Implementations
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn finish(self)
pub fn finish(self)
Complete the drawing and insert it into the parent Draw instance.
This will be called when the Drawing is Dropped if it has not yet been called.
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
pub fn color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
Specify a color.
This method supports any color type that can be converted into RGBA.
Colors that have no alpha channel will be given an opaque alpha channel value 1.0
.
sourcepub fn rgb(self, r: ColorScalar, g: ColorScalar, b: ColorScalar) -> Self
pub fn rgb(self, r: ColorScalar, g: ColorScalar, b: ColorScalar) -> Self
Specify the color via red, green and blue channels.
sourcepub fn rgb8(self, r: u8, g: u8, b: u8) -> Self
pub fn rgb8(self, r: u8, g: u8, b: u8) -> Self
Specify the color via red, green and blue channels as bytes
sourcepub fn rgba(
self,
r: ColorScalar,
g: ColorScalar,
b: ColorScalar,
a: ColorScalar
) -> Self
pub fn rgba( self, r: ColorScalar, g: ColorScalar, b: ColorScalar, a: ColorScalar ) -> Self
Specify the color via red, green, blue and alpha channels.
sourcepub fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Self
pub fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Self
Specify the color via red, green, blue and alpha channels as bytes.
sourcepub fn hsl(self, h: ColorScalar, s: ColorScalar, l: ColorScalar) -> Self
pub fn hsl(self, h: ColorScalar, s: ColorScalar, l: ColorScalar) -> Self
Specify the color via hue, saturation and luminance.
If you’re looking for HSVA or HSBA, use the hsva
method instead.
The given hue expects a value between 0.0
and 1.0
where 0.0
is 0 degress and 1.0
is
360 degrees (or 2 PI radians).
See the wikipedia entry for more details on this color space.
sourcepub fn hsla(
self,
h: ColorScalar,
s: ColorScalar,
l: ColorScalar,
a: ColorScalar
) -> Self
pub fn hsla( self, h: ColorScalar, s: ColorScalar, l: ColorScalar, a: ColorScalar ) -> Self
Specify the color via hue, saturation, luminance and an alpha channel.
If you’re looking for HSVA or HSBA, use the hsva
method instead.
The given hue expects a value between 0.0
and 1.0
where 0.0
is 0 degress and 1.0
is
360 degrees (or 2 PI radians).
See the wikipedia entry for more details on this color space.
sourcepub fn hsv(self, h: ColorScalar, s: ColorScalar, v: ColorScalar) -> Self
pub fn hsv(self, h: ColorScalar, s: ColorScalar, v: ColorScalar) -> Self
Specify the color via hue, saturation and value (brightness).
This is sometimes also known as “hsb”.
The given hue expects a value between 0.0
and 1.0
where 0.0
is 0 degress and 1.0
is
360 degrees (or 2 PI radians).
See the wikipedia entry for more details on this color space.
sourcepub fn hsva(
self,
h: ColorScalar,
s: ColorScalar,
v: ColorScalar,
a: ColorScalar
) -> Self
pub fn hsva( self, h: ColorScalar, s: ColorScalar, v: ColorScalar, a: ColorScalar ) -> Self
Specify the color via hue, saturation, value (brightness) and an alpha channel.
This is sometimes also known as “hsba”.
The given hue expects a value between 0.0
and 1.0
where 0.0
is 0 degress and 1.0
is
360 degrees (or 2 PI radians).
See the wikipedia entry for more details on this color space.
sourcepub fn gray(self, g: ColorScalar) -> Self
pub fn gray(self, g: ColorScalar) -> Self
Specify the color as gray scale
The given g expects a value between 0.0
and 1.0
where 0.0
is black and 1.0
is white
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn look_at(self, target: Point3) -> Self
pub fn look_at(self, target: Point3) -> Self
Describe orientation via the vector that points to the given target.
sourcepub fn x_radians(self, x: f32) -> Self
pub fn x_radians(self, x: f32) -> Self
Specify the orientation around the x axis as an absolute value in radians.
sourcepub fn y_radians(self, y: f32) -> Self
pub fn y_radians(self, y: f32) -> Self
Specify the orientation around the y axis as an absolute value in radians.
sourcepub fn z_radians(self, z: f32) -> Self
pub fn z_radians(self, z: f32) -> Self
Specify the orientation around the z axis as an absolute value in radians.
sourcepub fn x_degrees(self, x: f32) -> Self
pub fn x_degrees(self, x: f32) -> Self
Specify the orientation around the x axis as an absolute value in degrees.
sourcepub fn y_degrees(self, y: f32) -> Self
pub fn y_degrees(self, y: f32) -> Self
Specify the orientation around the y axis as an absolute value in degrees.
sourcepub fn z_degrees(self, z: f32) -> Self
pub fn z_degrees(self, z: f32) -> Self
Specify the orientation around the z axis as an absolute value in degrees.
sourcepub fn x_turns(self, x: f32) -> Self
pub fn x_turns(self, x: f32) -> Self
Specify the orientation around the x axis as a number of turns around the axis.
sourcepub fn y_turns(self, y: f32) -> Self
pub fn y_turns(self, y: f32) -> Self
Specify the orientation around the y axis as a number of turns around the axis.
sourcepub fn z_turns(self, z: f32) -> Self
pub fn z_turns(self, z: f32) -> Self
Specify the orientation around the z axis as a number of turns around the axis.
sourcepub fn radians(self, v: Vec3) -> Self
pub fn radians(self, v: Vec3) -> Self
Specify the orientation along each axis with the given Vector of radians.
This has the same affect as calling self.x_radians(v.x).y_radians(v.y).z_radians(v.z)
.
sourcepub fn degrees(self, v: Vec3) -> Self
pub fn degrees(self, v: Vec3) -> Self
Specify the orientation along each axis with the given Vector of degrees.
This has the same affect as calling self.x_degrees(v.x).y_degrees(v.y).z_degrees(v.z)
.
sourcepub fn turns(self, v: Vec3) -> Self
pub fn turns(self, v: Vec3) -> Self
Specify the orientation along each axis with the given Vector of “turns”.
This has the same affect as calling self.x_turns(v.x).y_turns(v.y).z_turns(v.z)
.
sourcepub fn euler(self, e: Vec3) -> Self
pub fn euler(self, e: Vec3) -> Self
Specify the orientation with the given Euler.
The euler must be specified in radians.
sourcepub fn quaternion(self, q: Quat) -> Self
pub fn quaternion(self, q: Quat) -> Self
Specify the orientation with the given Quaternion.
sourcepub fn pitch(self, pitch: f32) -> Self
pub fn pitch(self, pitch: f32) -> Self
Specify the “pitch” of the orientation in radians.
This has the same effect as calling x_radians
.
sourcepub fn yaw(self, yaw: f32) -> Self
pub fn yaw(self, yaw: f32) -> Self
Specify the “yaw” of the orientation in radians.
This has the same effect as calling y_radians
.
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn fill_opts(self, opts: FillOptions) -> Self
pub fn fill_opts(self, opts: FillOptions) -> Self
Specify the whole set of fill tessellation options.
sourcepub fn fill_tolerance(self, tolerance: f32) -> Self
pub fn fill_tolerance(self, tolerance: f32) -> Self
Maximum allowed distance to the path when building an approximation.
sourcepub fn fill_rule(self, rule: FillRule) -> Self
pub fn fill_rule(self, rule: FillRule) -> Self
Specify the rule used to determine what is inside and what is outside of the shape.
Currently, only the EvenOdd
rule is implemented.
sourcepub fn fill_sweep_orientation(self, orientation: Orientation) -> Self
pub fn fill_sweep_orientation(self, orientation: Orientation) -> Self
Whether to perform a vertical or horizontal traversal of the geometry.
Default value: Vertical
.
sourcepub fn handle_intersections(self, b: bool) -> Self
pub fn handle_intersections(self, b: bool) -> Self
A fast path to avoid some expensive operations if the path is known to not have any self-intersections.
Do not set this to false
if the path may have intersecting edges else the tessellator may
panic or produce incorrect results. In doubt, do not change the default value.
Default value: true
.
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn caps(self, cap: LineCap) -> Self
pub fn caps(self, cap: LineCap) -> Self
The start and end line cap as specified by the SVG spec.
sourcepub fn start_cap_butt(self) -> Self
pub fn start_cap_butt(self) -> Self
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
sourcepub fn start_cap_square(self) -> Self
pub fn start_cap_square(self) -> Self
At the end of each sub-path, the shape representing the stroke will be extended by a rectangle with the same width as the stroke width and whose length is half of the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a square with side length equal to the stroke width, centered at the sub-path’s point.
sourcepub fn start_cap_round(self) -> Self
pub fn start_cap_round(self) -> Self
At each end of each sub-path, the shape representing the stroke will be extended by a half circle with a radius equal to the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a full circle centered at the sub-path’s point.
sourcepub fn end_cap_butt(self) -> Self
pub fn end_cap_butt(self) -> Self
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
sourcepub fn end_cap_square(self) -> Self
pub fn end_cap_square(self) -> Self
At the end of each sub-path, the shape representing the stroke will be extended by a rectangle with the same width as the stroke width and whose length is half of the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a square with side length equal to the stroke width, centered at the sub-path’s point.
sourcepub fn end_cap_round(self) -> Self
pub fn end_cap_round(self) -> Self
At each end of each sub-path, the shape representing the stroke will be extended by a half circle with a radius equal to the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a full circle centered at the sub-path’s point.
sourcepub fn caps_butt(self) -> Self
pub fn caps_butt(self) -> Self
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
sourcepub fn caps_square(self) -> Self
pub fn caps_square(self) -> Self
At the end of each sub-path, the shape representing the stroke will be extended by a rectangle with the same width as the stroke width and whose length is half of the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a square with side length equal to the stroke width, centered at the sub-path’s point.
sourcepub fn caps_round(self) -> Self
pub fn caps_round(self) -> Self
At each end of each sub-path, the shape representing the stroke will be extended by a half circle with a radius equal to the stroke width. If a sub-path has zero length, then the resulting effect is that the stroke for that sub-path consists solely of a full circle centered at the sub-path’s point.
sourcepub fn join(self, join: LineJoin) -> Self
pub fn join(self, join: LineJoin) -> Self
The way in which lines are joined at the vertices, matching the SVG spec.
Default value is MiterClip
.
sourcepub fn join_miter(self) -> Self
pub fn join_miter(self) -> Self
A sharp corner is to be used to join path segments.
sourcepub fn join_miter_clip(self) -> Self
pub fn join_miter_clip(self) -> Self
Same as a join_miter
, but if the miter limit is exceeded, the miter is clipped at a miter
length equal to the miter limit value multiplied by the stroke width.
sourcepub fn join_round(self) -> Self
pub fn join_round(self) -> Self
A round corner is to be used to join path segments.
sourcepub fn join_bevel(self) -> Self
pub fn join_bevel(self) -> Self
A bevelled corner is to be used to join path segments. The bevel shape is a triangle that fills the area between the two stroked segments.
sourcepub fn stroke_weight(self, stroke_weight: f32) -> Self
pub fn stroke_weight(self, stroke_weight: f32) -> Self
The total stroke_weight (aka width) of the line.
sourcepub fn miter_limit(self, limit: f32) -> Self
pub fn miter_limit(self, limit: f32) -> Self
Describes the limit before miter lines will clip, as described in the SVG spec.
Must be greater than or equal to 1.0
.
sourcepub fn stroke_tolerance(self, tolerance: f32) -> Self
pub fn stroke_tolerance(self, tolerance: f32) -> Self
Maximum allowed distance to the path when building an approximation.
sourcepub fn stroke_opts(self, opts: StrokeOptions) -> Self
pub fn stroke_opts(self, opts: StrokeOptions) -> Self
Specify the full set of stroke options for the path tessellation.
source§impl<'a, T> Drawing<'a, T>
impl<'a, T> Drawing<'a, T>
sourcepub fn no_fill(self) -> Self
pub fn no_fill(self) -> Self
Specify no fill color and in turn no fill tessellation for the polygon.
sourcepub fn stroke_color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
pub fn stroke_color<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
Specify a color to use for stroke tessellation.
Stroke tessellation will only be performed if this method or one of the SetStroke
methods
are called.
sourcepub fn polygon_options(self, opts: PolygonOptions) -> Self
pub fn polygon_options(self, opts: PolygonOptions) -> Self
Specify the whole set of polygon options.