Struct nannou::draw::Draw [−][src]
pub struct Draw { /* fields omitted */ }
Expand description
A simple API for drawing 2D and 3D graphics.
Draw provides a simple way to compose together geometry and text with custom colours and textures and draw them to the screen. A suite of methods have been provided for drawing polygons, paths, meshes, text and textures in an accessible-yet-efficient manner.
Draw can also be used to create new Draw instances that refer to the same inner draw
state but are slightly different from one another. E.g. draw.rotate(radians)
produces a new
Draw instance where all drawings will be rotated by the given amount. draw.x(x)
produces
a new Draw instance where all drawings are translated along the x axis by the given
amount.
See the draw examples for a variety of demonstrations of how the Draw type can be used!
Implementations
Produce a new Draw instance transformed by the given transform matrix.
The resulting Draw instance will be have a transform equal to the new transform applied to the existing transform.
Translate the position of the origin by the given translation vector.
Translate the position of the origin by the given translation vector.
This method is short for translate
.
Translate the position of the origin by the given translation vector.
Translate the position of the origin by the given amount across each axis.
Translate the position of the origin by the given amount across each axis.
Produce a new Draw instance where the contents are scaled uniformly by the given value.
Produce a new Draw instance where the contents are scaled by the given amount across each axis.
Produce a new Draw instance where the contents are scaled by the given amount along the x axis
Produce a new Draw instance where the contents are scaled by the given amount along the y axis
Produce a new Draw instance where the contents are scaled by the given amount along the z axis
The given vector is interpreted as a Euler angle in radians and a transform is applied accordingly.
Specify the orientation with the given Quaternion.
Specify the orientation along each axis with the given Vector of radians.
This currently has the same affect as calling euler
.
Specify the orientation along each axis with the given Vector of degrees.
Specify the orientation along each axis with the given Vector of 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 “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
.
Assuming we’re looking at a 2D plane, positive values cause a clockwise rotation where the given value is specified in radians.
This is equivalent to calling the z_radians
or roll
methods.
Produce a new Draw instance that will draw with the given alpha blend descriptor.
Produce a new Draw instance that will draw with the given color blend descriptor.
Short-hand for color_blend
, the common use-case.
Produce a new Draw instance that will be cropped to the given rectangle.
If the current Draw instance already contains a scissor, the result will be the overlap between the original scissor and the new one.
Produce a new Draw instance.
All drawing that occurs on the new instance will be rendered as a “wireframe” between all vertices.
This will cause the draw::Renderer to switch render pipelines in order to use the LineList primitive topology. The switch will only occur if this topology was not already enabled.
Produce a new Draw instance.
All drawing that occurs on the new instance will be rendered as points on the vertices.
This will cause the draw::Renderer to switch render pipelines in order to use the PointList primitive topology. The switch will only occur if this topology was not already enabled.
Produce a new Draw instance.
All drawing that occurs on the new instance will be rendered as triangles on the vertices.
This will cause the draw::Renderer to switch render pipelines in order to use the TriangleList primitive topology. The switch will only occur if this topology was not already enabled.
This is the default primitive topology mode.
Produce a new Draw instance where all textures and textured vertices drawn will be sampled via a sampler of the given descriptor.
Specify a color with which the background should be cleared.
Add the given type to be drawn.
Begin drawing a Polygon.
Begin drawing a Mesh.
Begin drawing a Polyline.
Note that this is simply short-hand for draw.path().stroke()
Begin drawing a Texture.
Finish any drawings-in-progress and produce an iterator draining the inner draw commands and yielding them by value.
Drain any remaining drawing
s and convert them to draw commands.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Draw
impl !UnwindSafe for Draw
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