Struct nannou::draw::Drawing
[−]
[src]
pub struct Drawing<'a, T, S = DefaultScalar> where
T: IntoDrawn<S>,
S: 'a + BaseFloat, { /* fields omitted */ }
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.
Methods
impl<'a, T, S> Drawing<'a, T, S> where
T: IntoDrawn<S>,
S: BaseFloat,
[src]
T: IntoDrawn<S>,
S: BaseFloat,
pub fn finish(self) -> Result<(), WouldCycle<S>>
[src]
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.
pub fn id(self) -> Index
[src]
Complete the drawing and return its unique identifier.
Panics if adding the edge would cause a cycle in the graph.
pub fn map_ty<F, T2>(self, map: F) -> Self where
F: FnOnce(T) -> T2,
T2: Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
[src]
F: FnOnce(T) -> T2,
T2: Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
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.
impl<'a, T, S> Drawing<'a, T, S> where
T: IntoDrawn<S> + SetColor<ColorScalar> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
[src]
T: IntoDrawn<S> + SetColor<ColorScalar> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
pub fn color<C>(self, color: C) -> Self where
C: IntoRgba<ColorScalar>,
[src]
C: IntoRgba<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
.
pub fn rgb(self, r: ColorScalar, g: ColorScalar, b: ColorScalar) -> Self
[src]
Specify the color via red, green and blue channels.
pub fn rgba(
self,
r: ColorScalar,
g: ColorScalar,
b: ColorScalar,
a: ColorScalar
) -> Self
[src]
self,
r: ColorScalar,
g: ColorScalar,
b: ColorScalar,
a: ColorScalar
) -> Self
Specify the color via red, green, blue and alpha channels.
pub fn hsl(self, h: ColorScalar, s: ColorScalar, l: ColorScalar) -> Self
[src]
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.
pub fn hsla(
self,
h: ColorScalar,
s: ColorScalar,
l: ColorScalar,
a: ColorScalar
) -> Self
[src]
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.
pub fn hsv(self, h: ColorScalar, s: ColorScalar, v: ColorScalar) -> Self
[src]
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.
pub fn hsva(
self,
h: ColorScalar,
s: ColorScalar,
v: ColorScalar,
a: ColorScalar
) -> Self
[src]
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.
impl<'a, T, S> Drawing<'a, T, S> where
T: IntoDrawn<S> + SetDimensions<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
[src]
T: IntoDrawn<S> + SetDimensions<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
pub fn x_dimension(self, x: Dimension<S>) -> Self
[src]
Set the length along the x axis.
pub fn y_dimension(self, y: Dimension<S>) -> Self
[src]
Set the length along the y axis.
pub fn z_dimension(self, z: Dimension<S>) -> Self
[src]
Set the length along the z axis.
pub fn width(self, w: S) -> Self
[src]
Set the absolute width for the node.
pub fn height(self, h: S) -> Self
[src]
Set the absolute height for the node.
pub fn depth(self, d: S) -> Self
[src]
Set the absolute depth for the node.
pub fn w(self, w: S) -> Self
[src]
Short-hand for the width method.
pub fn h(self, h: S) -> Self
[src]
Short-hand for the height method.
pub fn d(self, d: S) -> Self
[src]
Short-hand for the depth method.
pub fn wh(self, v: Vector2<S>) -> Self
[src]
Set the x and y dimensions for the node.
pub fn whd(self, v: Vector3<S>) -> Self
[src]
Set the x, y and z dimensions for the node.
pub fn w_h(self, x: S, y: S) -> Self
[src]
Set the width and height for the node.
pub fn w_h_d(self, x: S, y: S, z: S) -> Self
[src]
Set the width and height for the node.
pub fn x_dimension_relative(self, other: Index, x: Relative<S>) -> Self
[src]
Some relative dimension along the x axis.
pub fn y_dimension_relative(self, other: Index, y: Relative<S>) -> Self
[src]
Some relative dimension along the y axis.
pub fn z_dimension_relative(self, other: Index, z: Relative<S>) -> Self
[src]
Some relative dimension along the z axis.
pub fn w_of(self, other: Index) -> Self
[src]
Set the x-axis dimension as the width of the node at the given index.
pub fn h_of(self, other: Index) -> Self
[src]
Set the y-axis dimension as the height of the node at the given index.
pub fn d_of(self, other: Index) -> Self
[src]
Set the z-axis dimension as the depth of the node at the given index.
pub fn wh_of(self, other: Index) -> Self
[src]
Set the dimensions as the dimensions of the node at the given index.
pub fn whd_of(self, other: Index) -> Self
[src]
Set the dimensions as the dimensions of the node at the given index.
pub fn padded_w_of(self, other: Index, pad: S) -> Self
[src]
Set the width as the width of the node at the given index padded at both ends by the given Scalar.
pub fn padded_h_of(self, other: Index, pad: S) -> Self
[src]
Set the height as the height of the node at the given index padded at both ends by the given Scalar.
pub fn padded_d_of(self, other: Index, pad: S) -> Self
[src]
Set the depth as the depth of the node at the given index padded at both ends by the given Scalar.
pub fn padded_wh_of(self, other: Index, pad: S) -> Self where
S: Clone,
[src]
S: Clone,
Set the dimensions as the dimensions of the node at the given index with each dimension padded by the given scalar.
pub fn padded_whd_of(self, other: Index, pad: S) -> Self where
S: Clone,
[src]
S: Clone,
Set the dimensions as the dimensions of the node at the given index with each dimension padded by the given scalar.
pub fn scaled_w_of(self, other: Index, scale: S) -> Self
[src]
Set the width as the width of the node at the given index multiplied by the given scale Scalar value.
pub fn scaled_h_of(self, other: Index, scale: S) -> Self
[src]
Set the height as the height of the node at the given index multiplied by the given scale Scalar value.
pub fn scaled_d_of(self, other: Index, scale: S) -> Self
[src]
Set the depth as the depth of the node at the given index multiplied by the given scale Scalar value.
pub fn scaled_wh_of(self, other: Index, scale: S) -> Self where
S: Clone,
[src]
S: Clone,
Set the dimensions as the dimensions of the node at the given index multiplied by the given scale Scalar value.
pub fn scaled_whd_of(self, other: Index, scale: S) -> Self where
S: Clone,
[src]
S: Clone,
Set the dimensions as the dimensions of the node at the given index multiplied by the given scale Scalar value.
impl<'a, T, S> Drawing<'a, T, S> where
T: IntoDrawn<S> + SetPosition<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
[src]
T: IntoDrawn<S> + SetPosition<S> + Into<Primitive<S>>,
Primitive<S>: Into<Option<T>>,
S: BaseFloat,
pub fn x_position(self, position: Position<S>) -> Self
[src]
Build with the given Position along the x axis.
pub fn y_position(self, position: Position<S>) -> Self
[src]
Build with the given Position along the y axis.
pub fn z_position(self, position: Position<S>) -> Self
[src]
Build with the given Position along the z axis.
pub fn x(self, x: S) -> Self
[src]
Build with the given Absolute Position along the x axis.
pub fn y(self, y: S) -> Self
[src]
Build with the given Absolute Position along the y axis.
pub fn z(self, z: S) -> Self
[src]
Build with the given Absolute Position along the z axis.
pub fn xy(self, p: Point2<S>) -> Self
[src]
Set the Position with some two-dimensional point.
pub fn xyz(self, p: Point3<S>) -> Self
[src]
Set the Position with some three-dimensional point.
pub fn x_y(self, x: S, y: S) -> Self
[src]
Set the Position with x y coordinates.
pub fn x_y_z(self, x: S, y: S, z: S) -> Self
[src]
Set the Position with x y z coordinates.
pub fn x_position_relative(self, x: Relative<S>) -> Self
[src]
Set the x Position Relative to the previous node.
pub fn y_position_relative(self, y: Relative<S>) -> Self
[src]
Set the y Position Relative to the previous node.
pub fn z_position_relative(self, z: Relative<S>) -> Self
[src]
Set the z Position Relative to the previous node.
pub fn x_y_position_relative(self, x: Relative<S>, y: Relative<S>) -> Self
[src]
Set the x and y Positions Relative to the previous node.
pub fn x_y_z_position_relative(
self,
x: Relative<S>,
y: Relative<S>,
z: Relative<S>
) -> Self
[src]
self,
x: Relative<S>,
y: Relative<S>,
z: Relative<S>
) -> Self
Set the x, y and z Positions Relative to the previous node.
pub fn x_position_relative_to(self, other: Index, x: Relative<S>) -> Self
[src]
Set the x Position Relative to the given node.
pub fn y_position_relative_to(self, other: Index, y: Relative<S>) -> Self
[src]
Set the y Position Relative to the given node.
pub fn z_position_relative_to(self, other: Index, z: Relative<S>) -> Self
[src]
Set the y Position Relative to the given node.
pub fn x_y_position_relative_to(
self,
other: Index,
x: Relative<S>,
y: Relative<S>
) -> Self
[src]
self,
other: Index,
x: Relative<S>,
y: Relative<S>
) -> Self
Set the x and y Positions Relative to the given node.
pub fn x_y_z_position_relative_to(
self,
other: Index,
x: Relative<S>,
y: Relative<S>,
z: Relative<S>
) -> Self
[src]
self,
other: Index,
x: Relative<S>,
y: Relative<S>,
z: Relative<S>
) -> Self
Set the x, y and z Positions Relative to the given node.
pub fn x_relative(self, x: S) -> Self
[src]
Set the Position as a Scalar along the x axis Relative to the middle of previous node.
pub fn y_relative(self, y: S) -> Self
[src]
Set the Position as a Scalar along the y axis Relative to the middle of previous node.
pub fn z_relative(self, z: S) -> Self
[src]
Set the Position as a Scalar along the z axis Relative to the middle of previous node.
pub fn xy_relative(self, p: Point2<S>) -> Self
[src]
Set the Position as a Point Relative to the middle of the previous node.
pub fn xyz_relative(self, p: Point3<S>) -> Self
[src]
Set the Position as a Point Relative to the middle of the previous node.
pub fn x_y_relative(self, x: S, y: S) -> Self
[src]
Set the Position as Scalars along the x and y axes Relative to the middle of the previous node.
pub fn x_y_z_relative(self, x: S, y: S, z: S) -> Self
[src]
Set the Position as Scalars along the x, y and z axes Relative to the middle of the previous node.
pub fn x_relative_to(self, other: Index, x: S) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn y_relative_to(self, other: Index, y: S) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn z_relative_to(self, other: Index, z: S) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn xy_relative_to(self, other: Index, p: Point2<S>) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn xyz_relative_to(self, other: Index, p: Point3<S>) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn x_y_relative_to(self, other: Index, x: S, y: S) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn x_y_z_relative_to(self, other: Index, x: S, y: S, z: S) -> Self
[src]
Set the position relative to the node with the given node::Index.
pub fn x_direction(self, direction: Direction, x: S) -> Self
[src]
Build with the Position along the x axis as some distance from another node.
pub fn y_direction(self, direction: Direction, y: S) -> Self
[src]
Build with the Position along the y axis as some distance from another node.
pub fn z_direction(self, direction: Direction, z: S) -> Self
[src]
Build with the Position along the z axis as some distance from another node.
pub fn left(self, x: S) -> Self
[src]
Build with the Position as some distance to the left of another node.
pub fn right(self, x: S) -> Self
[src]
Build with the Position as some distance to the right of another node.
pub fn down(self, y: S) -> Self
[src]
Build with the Position as some distance below another node.
pub fn up(self, y: S) -> Self
[src]
Build with the Position as some distance above another node.
pub fn backwards(self, z: S) -> Self
[src]
Build with the Position as some distance in front of another node.
pub fn forwards(self, z: S) -> Self
[src]
Build with the Position as some distance behind another node.
pub fn x_direction_from(self, other: Index, direction: Direction, x: S) -> Self
[src]
Build with the Position along the x axis as some distance from the given node.
pub fn y_direction_from(self, other: Index, direction: Direction, y: S) -> Self
[src]
Build with the Position along the y axis as some distance from the given node.
pub fn z_direction_from(self, other: Index, direction: Direction, z: S) -> Self
[src]
Build with the Position along the z axis as some distance from the given node.
pub fn left_from(self, other: Index, x: S) -> Self
[src]
Build with the Position as some distance to the left of the given node.
pub fn right_from(self, other: Index, x: S) -> Self
[src]
Build with the Position as some distance to the right of the given node.
pub fn down_from(self, other: Index, y: S) -> Self
[src]
Build with the Position as some distance below the given node.
pub fn up_from(self, other: Index, y: S) -> Self
[src]
Build with the Position as some distance above the given node.
pub fn backwards_from(self, other: Index, z: S) -> Self
[src]
Build with the Position as some distance in front of the given node.
pub fn forwards_from(self, other: Index, z: S) -> Self
[src]
Build with the Position as some distance above the given node.
pub fn x_align(self, align: Align<S>) -> Self
[src]
Align the Position of the node along the x axis.
pub fn y_align(self, align: Align<S>) -> Self
[src]
Align the Position of the node along the y axis.
pub fn z_align(self, align: Align<S>) -> Self
[src]
Align the Position of the node along the z axis.
pub fn align_left(self) -> Self
[src]
Align the position to the left.
pub fn align_left_with_margin(self, margin: S) -> Self
[src]
Align the position to the left.
pub fn align_middle_x(self) -> Self
[src]
Align the position to the middle.
pub fn align_right(self) -> Self
[src]
Align the position to the right.
pub fn align_right_with_margin(self, margin: S) -> Self
[src]
Align the position to the right.
pub fn align_bottom(self) -> Self
[src]
Align the position to the bottom.
pub fn align_bottom_with_margin(self, margin: S) -> Self
[src]
Align the position to the bottom.
pub fn align_middle_y(self) -> Self
[src]
Align the position to the middle.
pub fn align_top(self) -> Self
[src]
Align the position to the top.
pub fn align_top_with_margin(self, margin: S) -> Self
[src]
Align the position to the top.
pub fn align_front(self) -> Self
[src]
Align the position to the front.
pub fn align_front_with_margin(self, margin: S) -> Self
[src]
Align the position to the front.
pub fn align_middle_z(self) -> Self
[src]
Align the position to the middle.
pub fn align_back(self) -> Self
[src]
Align the position to the back.
pub fn align_back_with_margin(self, margin: S) -> Self
[src]
Align the position to the back.
pub fn x_align_to(self, other: Index, align: Align<S>) -> Self
[src]
Align the Position of the node with the given node along the x axis.
pub fn y_align_to(self, other: Index, align: Align<S>) -> Self
[src]
Align the Position of the node with the given node along the y axis.
pub fn z_align_to(self, other: Index, align: Align<S>) -> Self
[src]
Align the Position of the node with the given node along the z axis.
pub fn align_left_of(self, other: Index) -> Self
[src]
Align the position to the left.
pub fn align_left_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the left.
pub fn align_middle_x_of(self, other: Index) -> Self
[src]
Align the position to the middle.
pub fn align_right_of(self, other: Index) -> Self
[src]
Align the position to the right.
pub fn align_right_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the right.
pub fn align_bottom_of(self, other: Index) -> Self
[src]
Align the position to the bottom.
pub fn align_bottom_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the bottom.
pub fn align_middle_y_of(self, other: Index) -> Self
[src]
Align the position to the middle.
pub fn align_top_of(self, other: Index) -> Self
[src]
Align the position to the top.
pub fn align_top_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the top.
pub fn align_front_of(self, other: Index) -> Self
[src]
Align the position to the front.
pub fn align_front_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the front.
pub fn align_middle_z_of(self, other: Index) -> Self
[src]
Align the position to the middle.
pub fn align_back_of(self, other: Index) -> Self
[src]
Align the position to the back.
pub fn align_back_of_with_margin(self, other: Index, margin: S) -> Self
[src]
Align the position to the back.
pub fn middle(self) -> Self
[src]
Align the node to the middle of the last node.
pub fn bottom_left(self) -> Self
[src]
Align the node to the bottom left of the last node.
pub fn mid_left(self) -> Self
[src]
Align the node to the middle left of the last node.
pub fn top_left(self) -> Self
[src]
Align the node to the top left of the last node.
pub fn mid_top(self) -> Self
[src]
Align the node to the middle top of the last node.
pub fn top_right(self) -> Self
[src]
Align the node to the top right of the last node.
pub fn mid_right(self) -> Self
[src]
Align the node to the middle right of the last node.
pub fn bottom_right(self) -> Self
[src]
Align the node to the bottom right of the last node.
pub fn mid_bottom(self) -> Self
[src]
Align the node to the middle bottom of the last node.
pub fn middle_of(self, other: Index) -> Self
[src]
Align the node in the middle of the given Node.
pub fn bottom_left_of(self, other: Index) -> Self
[src]
Align the node to the bottom left of the given Node.
pub fn mid_left_of(self, other: Index) -> Self
[src]
Align the node to the middle left of the given Node.
pub fn top_left_of(self, other: Index) -> Self
[src]
Align the node to the top left of the given Node.
pub fn mid_top_of(self, other: Index) -> Self
[src]
Align the node to the middle top of the given Node.
pub fn top_right_of(self, other: Index) -> Self
[src]
Align the node to the top right of the given Node.
pub fn mid_right_of(self, other: Index) -> Self
[src]
Align the node to the middle right of the given Node.
pub fn bottom_right_of(self, other: Index) -> Self
[src]
Align the node to the bottom right of the given Node.
pub fn mid_bottom_of(self, other: Index) -> Self
[src]
Align the node to the middle bottom of the given Node.
impl<'a, S> Drawing<'a, Ellipse<S>, S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn radius(self, radius: S) -> Self
[src]
Specify the width and height of the Ellipse via a given radius.
pub fn resolution(self, resolution: usize) -> Self
[src]
The number of sides used to draw the ellipse.
impl<'a, S> Drawing<'a, Line<S>, S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn thickness(self, thickness: S) -> Self
[src]
Specify the thickness of the Line.
pub fn half_thickness(self, half_thickness: S) -> Self
[src]
Specify half the thickness of the Line.
As the half-thickness is used more commonly within Line geometric calculations, this
can be slightly more efficient than the full thickness
method.
pub fn start(self, start: Point2<S>) -> Self
[src]
Specify the start
point for the line.
pub fn end(self, end: Point2<S>) -> Self
[src]
Specify the end
point for the line.
pub fn points(self, start: Point2<S>, end: Point2<S>) -> Self
[src]
Use the given four points as the vertices (corners) of the quad.
impl<'a, S> Drawing<'a, Quad<S>, S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn points<P>(self, a: P, b: P, c: P, d: P) -> Self where
P: IntoPoint<S>,
[src]
P: IntoPoint<S>,
Use the given points as the vertices (corners) of the quad.
impl<'a, S> Drawing<'a, Tri<S>, S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn points<P>(self, a: P, b: P, c: P) -> Self where
P: IntoPoint<S>,
[src]
P: IntoPoint<S>,
Use the given points as the vertices (corners) of the triangle.
Trait Implementations
impl<'a, T: Debug, S: Debug> Debug for Drawing<'a, T, S> where
T: IntoDrawn<S>,
S: 'a + BaseFloat,
[src]
T: IntoDrawn<S>,
S: 'a + BaseFloat,
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<'a, T, S> Drop for Drawing<'a, T, S> where
T: IntoDrawn<S>,
S: BaseFloat,
[src]
T: IntoDrawn<S>,
S: BaseFloat,