[−][src]Struct nannou::draw::Draw
A simple API for drawing 2D and 3D graphics.
Draw provides a simple way to compose together geometric primitives and text (TODO) with custom colours and textures and draw them to the screen.
You can also ask Draw for the sequence of vertices or triangles (with or without colours/textures) that make up the entire scene that you have created.
Internally Draw uses a geom::Graph for placing geometry and text in 3D space.
Draw has 2 groups of methods:

Creation: These methods compose new geometry and text with colours and textures.

Rendering: These methods provide ways of rendering the graphics either directly to the frame for the current display or to a list of vertices or triangles for lowerlevel, more flexible access.
See the simple_draw.rs example for a demonstration of how to use the App's custom Draw type.
Methods
impl<S> Draw<S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn new() > Self
[src]
Create a new Draw instance.
This is the same as calling Draw::default.
pub fn reset(&self)
[src]
Resets all state within the Draw
instance.
pub fn background(&self) > Background<S>
[src]
Specify a color with which the background should be cleared.
pub fn a<T>(&self, primitive: T) > Drawing<T, S> where
T: IntoDrawn<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
[src]
T: IntoDrawn<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
Add the given type to be drawn.
pub fn ellipse(&self) > Drawing<Ellipse<S>, S>
[src]
Begin drawing an Ellipse.
pub fn line(&self) > Drawing<Line<S>, S>
[src]
Begin drawing a Line.
pub fn quad(&self) > Drawing<Quad<S>, S>
[src]
Begin drawing a Quad.
pub fn rect(&self) > Drawing<Rect<S>, S>
[src]
Begin drawing a Rect.
pub fn tri(&self) > Drawing<Tri<S>, S>
[src]
Begin drawing a Triangle.
pub fn polygon(&self) > Drawing<Pointless, S>
[src]
Begin drawing a Polygon.
pub fn mesh(&self) > Drawing<Vertexless, S>
[src]
Begin drawing a Mesh.
pub fn polyline(&self) > Drawing<Vertexless, S>
[src]
Begin drawing a Polyline.
pub fn node_vertices(&self, n: Index) > Option<NodeVertices<S>>
[src]
Produce the transformed mesh vertices for the node at the given index.
Returns None if there is no node for the given index.
pub fn node_triangles(&self, n: Index) > Option<NodeTriangles<S>>
[src]
Produce the transformed triangles for the node at the given index.
Note: If the node's Drawing was still in progress, it will first be finished and inserted into the mesh and geometry graph before producing the triangles iterator.
ⓘImportant traits for RawVertices<'a, S>pub fn raw_vertices(&self) > RawVertices<S>
[src]
Produce an iterator yielding all vertices from the inner mesh transformed via the inner geometry graph.
This method ignores the mesh indices buffer and instead produces the vertices "raw".
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
ⓘImportant traits for Vertices<'a, S>pub fn vertices(&self) > Vertices<S>
[src]
Produce an iterator yielding all indexed vertices from the inner mesh transformed via the inner geometry graph.
Vertices are yielded in depthfirstorder of the geometry graph nodes from which they are produced.
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
pub fn triangles(&self) > Triangles<S>
[src]
Produce an iterator yielding all triangles from the inner mesh transformed via the inner geometry graph.
Triangles are yielded in depthfirstorder of the geometry graph nodes from which they are produced.
Note: If there are any Drawings in progress, these will first be drained and completed before any vertices are yielded.
pub fn inner_mesh(&self) > Ref<Mesh<S>>
[src]
Borrow the Draw's inner Mesh.
pub fn untransformed_dimension_of<F>(
&self,
n: &Index,
point_axis: &F
) > Option<S> where
F: Fn(&Point<S>) > S,
[src]
&self,
n: &Index,
point_axis: &F
) > Option<S> where
F: Fn(&Point<S>) > S,
The length of the untransformed node at the given index along the axis returned by the
given point_axis
function.
pub fn untransformed_x_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the untransformed node at the given index along the x axis.
pub fn untransformed_y_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the untransformed node at the given index along the y axis.
pub fn untransformed_z_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the untransformed node at the given index along the y axis.
pub fn untransformed_dimensions_of(&self, n: &Index) > Option<Vector3<S>>
[src]
Determine the raw, untransformed dimensions of the node at the given index.
Returns None
if their is no node within the geom::Graph for the given index or if
the node has not yet been Drawn.
pub fn dimension_of<F>(&self, n: &Index, point_axis: &F) > Option<S> where
F: Fn(&Point<S>) > S,
[src]
F: Fn(&Point<S>) > S,
The length of the transformed node at the given index along the axis returned by the given
point_axis
function.
pub fn x_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the transformed node at the given index along the x axis.
pub fn y_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the transformed node at the given index along the y axis.
pub fn z_dimension_of(&self, n: &Index) > Option<S>
[src]
The length of the transformed node at the given index along the z axis.
pub fn finish_remaining_drawings(&self) > Result<(), WouldCycle<S>>
[src]
Drain any remaining drawing
s, convert them to their Drawn state and insert them into
the inner mesh and geometry graph.
Trait Implementations
impl<S: Clone> Clone for Draw<S> where
S: BaseFloat,
[src]
S: BaseFloat,
fn clone(&self) > Draw<S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copyassignment from source
. Read more
impl<S> Default for Draw<S> where
S: BaseFloat,
[src]
S: BaseFloat,
impl<S: Debug> Debug for Draw<S> where
S: BaseFloat,
[src]
S: BaseFloat,
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) > T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) > Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) > Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) > &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Content for T
[src]
fn ref_from_ptr(ptr: *mut c_void, size: usize) > Option<*mut T>
[src]
fn is_size_suitable(size: usize) > bool
[src]
fn indiv_size() > usize
[src]
impl<T> SafeBorrow<T> for T
[src]
impl<T> Erased for T
impl<S> FromSample<S> for S
[src]
fn from_sample_(s: S) > S
[src]
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
[src]
U: FromSample<T>,
fn to_sample_(self) > U
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
[src]
T: FromSample<S> + ToSample<S>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) > <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) > <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.