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

Render the Draw’s inner list of commands to the texture associated with the Frame.

The App stores a unique render.

Create a new Draw instance.

This is the same as calling Draw::default.

Resets all state within the Draw instance.

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.

Translate the position of the origin along the x axis.

Translate the position of the origin along the y axis.

Translate the position of the origin along the z 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 around the x axis in radians.

Specify the orientation around the y axis in radians.

Specify the orientation around the z axis in radians.

Specify the orientation along each axis with the given Vector of degrees.

Specify the orientation around the x axis in degrees.

Specify the orientation around the y axis in degrees.

Specify the orientation around the z axis in 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 Path.

Begin drawing an Ellipse.

Begin drawing a Line.

Begin drawing an Arrow.

Begin drawing a Quad.

Begin drawing a Rect.

Begin drawing a Triangle.

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 Text.

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 drawings and convert them to draw commands.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Convert the source color to the destination color using the specified method Read more

Convert the source color to the destination color using the bradford method by default Read more

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.