pub struct Drawing<'a, T> { /* private fields */ }
Expand description
A Drawing in progress.
Drawing provides a way of chaining together method calls describing properties of the thing that we are drawing. Drawing ends when the instance is Dropped, at which point the properties of the drawing are inserted into the Draw type.
When a Drawing begins, a node is immediately created for the drawing within the Draw’s inner geom::Graph. This ensures the correct instantiation order is maintained within the graph. As a result, each Drawing is associated with a single, unique node. Thus a Drawing can be thought of as a way of specifying properties for a node.
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> Drawing<'a, Arrow>
impl<'a> Drawing<'a, Arrow>
sourcepub fn points(self, start: Point2, end: Point2) -> Self
pub fn points(self, start: Point2, end: Point2) -> Self
Specify the start and end points of the arrow.
sourcepub fn head_length(self, length: f32) -> Self
pub fn head_length(self, length: f32) -> Self
The length of the arrow head.
By default, this is equal to weight * 4.0
.
This value will be clamped to the length of the line itself.
sourcepub fn head_width(self, width: f32) -> Self
pub fn head_width(self, width: f32) -> Self
The width of the arrow head.
By default, this is equal to weight * 2.0
.
source§impl<'a> Drawing<'a, Ellipse>
impl<'a> Drawing<'a, Ellipse>
sourcepub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
pub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
Stroke the outline with the given color.
sourcepub fn radius(self, radius: f32) -> Self
pub fn radius(self, radius: f32) -> Self
Specify the width and height of the Ellipse via a given radius.
sourcepub fn resolution(self, resolution: f32) -> Self
pub fn resolution(self, resolution: f32) -> Self
The number of sides used to draw the ellipse.
source§impl<'a> Drawing<'a, Vertexless>
impl<'a> Drawing<'a, Vertexless>
sourcepub fn points<I>(self, points: I) -> DrawingMesh<'a>
pub fn points<I>(self, points: I) -> DrawingMesh<'a>
Describe the mesh with a sequence of points.
The given iterator may yield any type that can be converted directly into Point3
s.
This method assumes that the entire mesh should be coloured with a single colour. If a
colour is not specified via one of the builder methods, a default colour will be retrieved
from the inner Theme
.
sourcepub fn points_colored<I, P, C>(self, points: I) -> DrawingMesh<'a>
pub fn points_colored<I, P, C>(self, points: I) -> DrawingMesh<'a>
Describe the mesh with a sequence of colored points.
Each of the points must be represented as a tuple containing the point and the color in
that order, e.g. (point, color)
. point
may be of any type that implements
Into<Point3>
and color
may be of any type that implements IntoLinSrgba
.
sourcepub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingMesh<'a>
pub fn points_textured<I, P, T>( self, view: &dyn ToTextureView, points: I ) -> DrawingMesh<'a>
Describe the mesh with a sequence of textured points.
Each of the vertices must be represented as a tuple containing the point and tex
coordinates in that order, e.g. (point, tex_coords)
. point
may be of any type that
implements Into<Point3>
and tex_coords
may be of any type that implements
Into<Point2>
.
sourcepub fn tris<I, V>(self, tris: I) -> DrawingMesh<'a>
pub fn tris<I, V>(self, tris: I) -> DrawingMesh<'a>
Describe the mesh with a sequence of triangles.
Each triangle may be composed of any vertex type that may be converted directly into
Point3
s.
This method assumes that the entire mesh should be coloured with a single colour. If a
colour is not specified via one of the builder methods, a default colour will be retrieved
from the inner Theme
.
sourcepub fn tris_colored<I, P, C>(self, tris: I) -> DrawingMesh<'a>
pub fn tris_colored<I, P, C>(self, tris: I) -> DrawingMesh<'a>
Describe the mesh with a sequence of colored triangles.
Each of the vertices must be represented as a tuple containing the point and the color in
that order, e.g. (point, color)
. point
may be of any type that implements Into<Point3>
and color
may be of any type that implements IntoLinSrgba
.
sourcepub fn tris_textured<I, P, T>(
self,
view: &dyn ToTextureView,
tris: I
) -> DrawingMesh<'a>
pub fn tris_textured<I, P, T>( self, view: &dyn ToTextureView, tris: I ) -> DrawingMesh<'a>
Describe the mesh with a sequence of textured triangles.
Each of the vertices must be represented as a tuple containing the point and tex
coordinates in that order, e.g. (point, tex_coords)
. point
may be of any type that
implements Into<Point3>
and tex_coords
may be of any type that implements
Into<Point2>
.
sourcepub fn indexed<V, I>(self, points: V, indices: I) -> DrawingMesh<'a>
pub fn indexed<V, I>(self, points: V, indices: I) -> DrawingMesh<'a>
Describe the mesh with the given indexed points.
Each trio of indices
describes a single triangle made up of points
.
Each point may be any type that may be converted directly into the Point3
type.
sourcepub fn indexed_colored<V, I, P, C>(
self,
points: V,
indices: I
) -> DrawingMesh<'a>where
V: IntoIterator<Item = (P, C)>,
I: IntoIterator<Item = usize>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
pub fn indexed_colored<V, I, P, C>(
self,
points: V,
indices: I
) -> DrawingMesh<'a>where
V: IntoIterator<Item = (P, C)>,
I: IntoIterator<Item = usize>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
Describe the mesh with the given indexed, colored points.
Each trio of indices
describes a single triangle made up of colored points
.
Each of the points
must be represented as a tuple containing the point and the color in
that order, e.g. (point, color)
. point
may be of any type that implements
Into<Point3>
and color
may be of any type that implements IntoLinSrgba
.
sourcepub fn indexed_textured<V, I, P, T>(
self,
view: &dyn ToTextureView,
points: V,
indices: I
) -> DrawingMesh<'a>where
V: IntoIterator<Item = (P, T)>,
I: IntoIterator<Item = usize>,
P: Into<Point>,
T: Into<TexCoords>,
pub fn indexed_textured<V, I, P, T>(
self,
view: &dyn ToTextureView,
points: V,
indices: I
) -> DrawingMesh<'a>where
V: IntoIterator<Item = (P, T)>,
I: IntoIterator<Item = usize>,
P: Into<Point>,
T: Into<TexCoords>,
Describe the mesh with the given indexed, textured points.
Each trio of indices
describes a single triangle made up of colored points
.
Each of the points
must be represented as a tuple containing the point and the texture
coordinates in that order, e.g. (point, tex_coords)
. point
may be of any type that
implements Into<Point3>
and tex_coords
may be of any type that implements
Into<Point2>
.
source§impl<'a> Drawing<'a, PathInit>
impl<'a> Drawing<'a, PathInit>
sourcepub fn fill(self) -> DrawingPathFill<'a>
pub fn fill(self) -> DrawingPathFill<'a>
Specify that we want to use fill tessellation for the path.
The returned building context allows for specifying the fill tessellation options.
sourcepub fn stroke(self) -> DrawingPathStroke<'a>
pub fn stroke(self) -> DrawingPathStroke<'a>
Specify that we want to use stroke tessellation for the path.
The returned building context allows for specifying the stroke tessellation options.
source§impl<'a> Drawing<'a, PathOptions<FillOptions>>
impl<'a> Drawing<'a, PathOptions<FillOptions>>
source§impl<'a> Drawing<'a, PathOptions<StrokeOptions>>
impl<'a> Drawing<'a, PathOptions<StrokeOptions>>
source§impl<'a, T> Drawing<'a, PathOptions<T>>where
T: TessellationOptions,
PathOptions<T>: Into<Primitive>,
Primitive: Into<Option<PathOptions<T>>>,
impl<'a, T> Drawing<'a, PathOptions<T>>where
T: TessellationOptions,
PathOptions<T>: Into<Primitive>,
Primitive: Into<Option<PathOptions<T>>>,
sourcepub fn events<I>(self, events: I) -> DrawingPath<'a>where
I: IntoIterator<Item = PathEvent>,
pub fn events<I>(self, events: I) -> DrawingPath<'a>where
I: IntoIterator<Item = PathEvent>,
Submit the path events to be tessellated.
sourcepub fn points<I>(self, points: I) -> DrawingPath<'a>
pub fn points<I>(self, points: I) -> DrawingPath<'a>
Submit the path events as a polyline of points.
sourcepub fn points_closed<I>(self, points: I) -> DrawingPath<'a>
pub fn points_closed<I>(self, points: I) -> DrawingPath<'a>
Submit the path events as a polyline of points.
An event will be generated that closes the start and end points.
sourcepub fn points_colored<I, P, C>(self, points: I) -> DrawingPath<'a>
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPath<'a>
Submit path events as a polyline of colored points.
sourcepub fn points_colored_closed<I, P, C>(self, points: I) -> DrawingPath<'a>
pub fn points_colored_closed<I, P, C>(self, points: I) -> DrawingPath<'a>
Submit path events as a polyline of colored points.
The path with automatically close from the end point to the start point.
sourcepub fn points_textured<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a>
pub fn points_textured<I, P, TC>( self, view: &dyn ToTextureView, points: I ) -> DrawingPath<'a>
Submit path events as a polyline of textured points.
sourcepub fn points_textured_closed<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a>
pub fn points_textured_closed<I, P, TC>( self, view: &dyn ToTextureView, points: I ) -> DrawingPath<'a>
Submit path events as a polyline of textured points.
The path with automatically close from the end point to the start point.
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.
source§impl<'a> Drawing<'a, PolygonInit>
impl<'a> Drawing<'a, PolygonInit>
sourcepub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
pub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
Stroke the outline with the given color.
sourcepub fn events<I>(self, events: I) -> DrawingPolygon<'a>where
I: IntoIterator<Item = PathEvent>,
pub fn events<I>(self, events: I) -> DrawingPolygon<'a>where
I: IntoIterator<Item = PathEvent>,
Describe the polygon with a sequence of path events.
sourcepub fn points<I>(self, points: I) -> DrawingPolygon<'a>
pub fn points<I>(self, points: I) -> DrawingPolygon<'a>
Describe the polygon with a sequence of points.
sourcepub fn points_colored<I, P, C>(self, points: I) -> DrawingPolygon<'a>
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPolygon<'a>
Consumes an iterator of points and converts them to an iterator yielding path events.
sourcepub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPolygon<'a>
pub fn points_textured<I, P, T>( self, view: &dyn ToTextureView, points: I ) -> DrawingPolygon<'a>
Describe the polygon with an iterator yielding textured poings.
source§impl<'a> Drawing<'a, Rect>
impl<'a> Drawing<'a, Rect>
sourcepub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
pub fn stroke<C>(self, color: C) -> Selfwhere
C: IntoLinSrgba<ColorScalar>,
Stroke the outline with the given color.
source§impl<'a> Drawing<'a, Text>
impl<'a> Drawing<'a, Text>
sourcepub fn no_line_wrap(self) -> Self
pub fn no_line_wrap(self) -> Self
Specify that the Text should not wrap lines around the width.
sourcepub fn wrap_by_word(self) -> Self
pub fn wrap_by_word(self) -> Self
Line wrap the Text at the beginning of the first word that exceeds the width.
sourcepub fn wrap_by_character(self) -> Self
pub fn wrap_by_character(self) -> Self
Line wrap the Text at the beginning of the first character that exceeds the width.
sourcepub fn font(self, font: Font) -> Self
pub fn font(self, font: Font) -> Self
A method for specifying the Font
used for displaying the Text
.
sourcepub fn with_style(self, style: Style) -> Self
pub fn with_style(self, style: Style) -> Self
Build the Text with the given Style.
sourcepub fn justify(self, justify: Justify) -> Self
pub fn justify(self, justify: Justify) -> Self
Describe the end along the x axis to which the text should be aligned.
sourcepub fn left_justify(self) -> Self
pub fn left_justify(self) -> Self
Align the text to the left of its bounding Rect’s x axis range.
sourcepub fn center_justify(self) -> Self
pub fn center_justify(self) -> Self
Align the text to the middle of its bounding Rect’s x axis range.
sourcepub fn right_justify(self) -> Self
pub fn right_justify(self) -> Self
Align the text to the right of its bounding Rect’s x axis range.
sourcepub fn line_spacing(self, spacing: Scalar) -> Self
pub fn line_spacing(self, spacing: Scalar) -> Self
Specify how much vertical space should separate each line of text.
sourcepub fn y_align_text(self, align: Align) -> Self
pub fn y_align_text(self, align: Align) -> Self
Specify how the whole text should be aligned along the y axis of its bounding rectangle
sourcepub fn align_text_top(self) -> Self
pub fn align_text_top(self) -> Self
Align the top edge of the text with the top edge of its bounding rectangle.
sourcepub fn align_text_middle_y(self) -> Self
pub fn align_text_middle_y(self) -> Self
Align the middle of the text with the middle of the bounding rect along the y axis.
This is the default behaviour.
sourcepub fn align_text_bottom(self) -> Self
pub fn align_text_bottom(self) -> Self
Align the bottom edge of the text with the bottom edge of its bounding rectangle.
sourcepub fn glyph_colors<I, C>(self, glyph_colors: I) -> Self
pub fn glyph_colors<I, C>(self, glyph_colors: I) -> Self
Set a color for each glyph, which is typically one character. Colors unspecified glyphs using the drawing color. NOTE: Sometimes, a glyph can represent multiple characters, or be a part in other glyphs.
source§impl<'a> Drawing<'a, Texture>
impl<'a> Drawing<'a, Texture>
sourcepub fn area(self, rect: Rect) -> Self
pub fn area(self, rect: Rect) -> Self
Specify the area of the texture to draw.
The bounds of the rectangle should represent the desired area as texture coordinates of the underlying texture.
Texture coordinates range from (0.0, 0.0) in the bottom left of the texture, to (1.0, 1.0) in the top right of the texture.
By default, the area represents the full extent of the texture.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for Drawing<'a, T>
impl<'a, T> !Send for Drawing<'a, T>
impl<'a, T> !Sync for Drawing<'a, T>
impl<'a, T> Unpin for Drawing<'a, T>where
T: Unpin,
impl<'a, T> !UnwindSafe for Drawing<'a, T>
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more