Struct nannou::draw::Drawing [−][src]
pub struct Drawing<'a, T> { /* fields omitted */ }
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
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.
Apply the given function to the type stored within Draw.
The function is only applied if the node has not yet been Drawn.
Panics if the primitive does not contain type T.
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
.
Specify the color via red, green and blue channels.
Specify the color via red, green and blue channels as bytes
Specify the color via red, green, blue and alpha channels.
Specify the color via red, green, blue and alpha channels as bytes.
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.
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.
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.
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.
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
Describe orientation via the vector that points to the given target.
Specify the orientation around the x axis as an absolute value in radians.
Specify the orientation around the y axis as an absolute value in radians.
Specify the orientation around the z axis as an absolute value in radians.
Specify the orientation around the x axis as an absolute value in degrees.
Specify the orientation around the y axis as an absolute value in degrees.
Specify the orientation around the z axis as an absolute value in degrees.
Specify the orientation around the x axis as a number of turns around the axis.
Specify the orientation around the y axis as a number of turns around the axis.
Specify the orientation around the z axis as a number of turns around the axis.
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)
.
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)
.
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)
.
Specify the orientation with the given Euler.
The euler must be specified in radians.
Specify the orientation with the given Quaternion.
Specify the “pitch” of the orientation in radians.
This has the same effect as calling x_radians
.
Specify the “yaw” of the orientation in radians.
This has the same effect as calling y_radians
.
Specify the “roll” of the orientation in radians.
This has the same effect as calling z_radians
.
Specify the whole set of fill tessellation options.
Maximum allowed distance to the path when building an approximation.
Specify the rule used to determine what is inside and what is outside of the shape.
Currently, only the EvenOdd
rule is implemented.
Whether to perform a vertical or horizontal traversal of the geometry.
Default value: Vertical
.
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
.
The start and end line cap as specified by the SVG spec.
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
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.
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.
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
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.
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.
The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.
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.
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.
The way in which lines are joined at the vertices, matching the SVG spec.
Default value is MiterClip
.
A sharp corner is to be used to join path segments.
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.
A round corner is to be used to join path segments.
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.
The total stroke_weight (aka width) of the line.
Describes the limit before miter lines will clip, as described in the SVG spec.
Must be greater than or equal to 1.0
.
Maximum allowed distance to the path when building an approximation.
Specify the full set of stroke options for the path tessellation.
Specify the start and end points of the arrow.
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.
The width of the arrow head.
By default, this is equal to weight * 2.0
.
Stroke the outline with the given color.
Specify the width and height of the Ellipse via a given radius.
The number of sides used to draw the ellipse.
pub fn points<I>(self, points: I) -> DrawingMesh<'a> where
I: IntoIterator,
I::Item: Into<Point>,
pub fn points<I>(self, points: I) -> DrawingMesh<'a> where
I: IntoIterator,
I::Item: Into<Point>,
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
.
pub fn points_colored<I, P, C>(self, points: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
pub fn points_colored<I, P, C>(self, points: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
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
.
pub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingMesh<'a> where
I: IntoIterator<Item = (P, T)>,
P: Into<Point>,
T: Into<TexCoords>,
pub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingMesh<'a> where
I: IntoIterator<Item = (P, T)>,
P: Into<Point>,
T: Into<TexCoords>,
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>
.
pub fn tris<I, V>(self, tris: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<V>>,
V: Into<Point>,
pub fn tris<I, V>(self, tris: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<V>>,
V: Into<Point>,
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
.
pub fn tris_colored<I, P, C>(self, tris: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<(P, C)>>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
pub fn tris_colored<I, P, C>(self, tris: I) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<(P, C)>>,
P: Into<Point>,
C: IntoLinSrgba<ColorScalar>,
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
.
pub fn tris_textured<I, P, T>(
self,
view: &dyn ToTextureView,
tris: I
) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<(P, T)>>,
P: Into<Point>,
T: Into<TexCoords>,
pub fn tris_textured<I, P, T>(
self,
view: &dyn ToTextureView,
tris: I
) -> DrawingMesh<'a> where
I: IntoIterator<Item = Tri<(P, T)>>,
P: Into<Point>,
T: Into<TexCoords>,
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>
.
pub fn indexed<V, I>(self, points: V, indices: I) -> DrawingMesh<'a> where
V: IntoIterator,
V::Item: Into<Point>,
I: IntoIterator<Item = usize>,
pub fn indexed<V, I>(self, points: V, indices: I) -> DrawingMesh<'a> where
V: IntoIterator,
V::Item: Into<Point>,
I: IntoIterator<Item = usize>,
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.
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>,
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
.
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>,
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>
.
Specify that we want to use fill tessellation for the path.
The returned building context allows for specifying the fill tessellation options.
Specify that we want to use stroke tessellation for the path.
The returned building context allows for specifying the stroke tessellation options.
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>>>,
Submit the path events to be tessellated.
pub fn points<I>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
pub fn points<I>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
Submit the path events as a polyline of points.
pub fn points_closed<I>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
pub fn points_closed<I>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
Submit the path events as a polyline of points.
An event will be generated that closes the start and end points.
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
Submit path events as a polyline of colored points.
pub fn points_colored_closed<I, P, C>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
pub fn points_colored_closed<I, P, C>(self, points: I) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
Submit path events as a polyline of colored points.
The path with automatically close from the end point to the start point.
pub fn points_textured<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, TC)>,
P: Into<Point2>,
TC: Into<TexCoords>,
pub fn points_textured<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, TC)>,
P: Into<Point2>,
TC: Into<TexCoords>,
Submit path events as a polyline of textured points.
pub fn points_textured_closed<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, TC)>,
P: Into<Point2>,
TC: Into<TexCoords>,
pub fn points_textured_closed<I, P, TC>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPath<'a> where
I: IntoIterator<Item = (P, TC)>,
P: Into<Point2>,
TC: Into<TexCoords>,
Submit path events as a polyline of textured points.
The path with automatically close from the end point to the start point.
Specify no fill color and in turn no fill tessellation for the polygon.
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.
Specify the whole set of polygon options.
Stroke the outline with the given color.
pub 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.
pub fn points<I>(self, points: I) -> DrawingPolygon<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
pub fn points<I>(self, points: I) -> DrawingPolygon<'a> where
I: IntoIterator,
I::Item: Into<Point2>,
Describe the polygon with a sequence of points.
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPolygon<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
pub fn points_colored<I, P, C>(self, points: I) -> DrawingPolygon<'a> where
I: IntoIterator<Item = (P, C)>,
P: Into<Point2>,
C: IntoLinSrgba<ColorScalar>,
Consumes an iterator of points and converts them to an iterator yielding path events.
pub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPolygon<'a> where
I: IntoIterator<Item = (P, T)>,
P: Into<Point2>,
T: Into<TexCoords>,
pub fn points_textured<I, P, T>(
self,
view: &dyn ToTextureView,
points: I
) -> DrawingPolygon<'a> where
I: IntoIterator<Item = (P, T)>,
P: Into<Point2>,
T: Into<TexCoords>,
Describe the polygon with an iterator yielding textured poings.
Stroke the outline with the given color.
Specify that the Text should not wrap lines around the width.
Line wrap the Text at the beginning of the first word that exceeds the width.
Line wrap the Text at the beginning of the first character that exceeds the width.
A method for specifying the Font
used for displaying the Text
.
Build the Text with the given Style.
Describe the end along the x axis to which the text should be aligned.
Align the text to the left of its bounding Rect’s x axis range.
Align the text to the middle of its bounding Rect’s x axis range.
Align the text to the right of its bounding Rect’s x axis range.
Specify how much vertical space should separate each line of text.
Specify how the whole text should be aligned along the y axis of its bounding rectangle
Align the top edge of the text with the top edge of its bounding rectangle.
Align the middle of the text with the middle of the bounding rect along the y axis.
This is the default behaviour.
Align the bottom edge of the text with the bottom edge of its bounding rectangle.
pub fn glyph_colors<I, C>(self, glyph_colors: I) -> Self where
I: IntoIterator<Item = C>,
C: IntoLinSrgba<ColorScalar>,
pub fn glyph_colors<I, C>(self, glyph_colors: I) -> Self where
I: IntoIterator<Item = C>,
C: IntoLinSrgba<ColorScalar>,
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.
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.
Stroke the outline with the given color.
Trait Implementations
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Drawing<'a, T>
impl<'a, T> !UnwindSafe for Drawing<'a, T>
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
Mutably borrows from an owned value. Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
Convert into T, returning ok if the color is inside of its defined range,
otherwise an OutOfBounds
error is returned which contains the unclamped color. Read more
pub fn vzip(self) -> V