pub type DrawingPolygon<'a> = Drawing<'a, Polygon>;
Expand description

Initialised drawing state for a polygon.

Aliased Type§

struct DrawingPolygon<'a> { /* private fields */ }

Implementations

source§

impl<'a, T> Drawing<'a, T>

source

pub fn finish(self)

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.

source

pub fn map_ty<F, T2>(self, map: F) -> Drawing<'a, T2>
where F: FnOnce(T) -> T2, T2: Into<Primitive>, Primitive: 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.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn color<C>(self, color: C) -> Self

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.

source

pub fn rgb(self, r: ColorScalar, g: ColorScalar, b: ColorScalar) -> Self

Specify the color via red, green and blue channels.

source

pub fn rgb8(self, r: u8, g: u8, b: u8) -> Self

Specify the color via red, green and blue channels as bytes

source

pub fn rgba( self, r: ColorScalar, g: ColorScalar, b: ColorScalar, a: ColorScalar ) -> Self

Specify the color via red, green, blue and alpha channels.

source

pub fn rgba8(self, r: u8, g: u8, b: u8, a: u8) -> Self

Specify the color via red, green, blue and alpha channels as bytes.

source

pub fn hsl(self, h: ColorScalar, s: ColorScalar, l: ColorScalar) -> Self

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.

source

pub fn hsla( 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.

source

pub fn hsv(self, h: ColorScalar, s: ColorScalar, v: ColorScalar) -> Self

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.

source

pub fn hsva( 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.

source

pub fn gray(self, g: ColorScalar) -> Self

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

source§

impl<'a, T> Drawing<'a, T>

source

pub fn width(self, w: f32) -> Self

Set the absolute width for the node.

source

pub fn height(self, h: f32) -> Self

Set the absolute height for the node.

source

pub fn depth(self, d: f32) -> Self

Set the absolute depth for the node.

source

pub fn w(self, w: f32) -> Self

Short-hand for the width method.

source

pub fn h(self, h: f32) -> Self

Short-hand for the height method.

source

pub fn d(self, d: f32) -> Self

Short-hand for the depth method.

source

pub fn wh(self, v: Vec2) -> Self

Set the x and y dimensions for the node.

source

pub fn whd(self, v: Vec3) -> Self

Set the x, y and z dimensions for the node.

source

pub fn w_h(self, x: f32, y: f32) -> Self

Set the width and height for the node.

source

pub fn w_h_d(self, x: f32, y: f32, z: f32) -> Self

Set the width and height for the node.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn x(self, x: f32) -> Self

Build with the given Absolute Position along the x axis.

source

pub fn y(self, y: f32) -> Self

Build with the given Absolute Position along the y axis.

source

pub fn z(self, z: f32) -> Self

Build with the given Absolute Position along the z axis.

source

pub fn xy(self, p: Point2) -> Self

Set the Position with some two-dimensional point.

source

pub fn xyz(self, p: Point3) -> Self

Set the Position with some three-dimensional point.

source

pub fn x_y(self, x: f32, y: f32) -> Self

Set the Position with x y coordinates.

source

pub fn x_y_z(self, x: f32, y: f32, z: f32) -> Self

Set the Position with x y z coordinates.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn look_at(self, target: Point3) -> Self

Describe orientation via the vector that points to the given target.

source

pub fn x_radians(self, x: f32) -> Self

Specify the orientation around the x axis as an absolute value in radians.

source

pub fn y_radians(self, y: f32) -> Self

Specify the orientation around the y axis as an absolute value in radians.

source

pub fn z_radians(self, z: f32) -> Self

Specify the orientation around the z axis as an absolute value in radians.

source

pub fn x_degrees(self, x: f32) -> Self

Specify the orientation around the x axis as an absolute value in degrees.

source

pub fn y_degrees(self, y: f32) -> Self

Specify the orientation around the y axis as an absolute value in degrees.

source

pub fn z_degrees(self, z: f32) -> Self

Specify the orientation around the z axis as an absolute value in degrees.

source

pub fn x_turns(self, x: f32) -> Self

Specify the orientation around the x axis as a number of turns around the axis.

source

pub fn y_turns(self, y: f32) -> Self

Specify the orientation around the y axis as a number of turns around the axis.

source

pub fn z_turns(self, z: f32) -> Self

Specify the orientation around the z axis as a number of turns around the axis.

source

pub fn radians(self, v: Vec3) -> Self

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

source

pub fn degrees(self, v: Vec3) -> Self

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

source

pub fn turns(self, v: Vec3) -> Self

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

source

pub fn euler(self, e: Vec3) -> Self

Specify the orientation with the given Euler.

The euler must be specified in radians.

source

pub fn quaternion(self, q: Quat) -> Self

Specify the orientation with the given Quaternion.

source

pub fn pitch(self, pitch: f32) -> Self

Specify the “pitch” of the orientation in radians.

This has the same effect as calling x_radians.

source

pub fn yaw(self, yaw: f32) -> Self

Specify the “yaw” of the orientation in radians.

This has the same effect as calling y_radians.

source

pub fn roll(self, roll: f32) -> Self

Specify the “roll” of the orientation in radians.

This has the same effect as calling z_radians.

source

pub fn rotate(self, radians: f32) -> Self

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.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn fill_opts(self, opts: FillOptions) -> Self

Specify the whole set of fill tessellation options.

source

pub fn fill_tolerance(self, tolerance: f32) -> Self

Maximum allowed distance to the path when building an approximation.

source

pub fn fill_rule(self, rule: FillRule) -> Self

Specify the rule used to determine what is inside and what is outside of the shape.

Currently, only the EvenOdd rule is implemented.

source

pub fn fill_sweep_orientation(self, orientation: Orientation) -> Self

Whether to perform a vertical or horizontal traversal of the geometry.

Default value: Vertical.

source

pub fn handle_intersections(self, b: bool) -> Self

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.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn start_cap(self, cap: LineCap) -> Self

The start line cap as specified by the SVG spec.

source

pub fn end_cap(self, cap: LineCap) -> Self

The end line cap as specified by the SVG spec.

source

pub fn caps(self, cap: LineCap) -> Self

The start and end line cap as specified by the SVG spec.

source

pub fn start_cap_butt(self) -> Self

The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.

source

pub fn start_cap_square(self) -> Self

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.

source

pub fn start_cap_round(self) -> Self

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.

source

pub fn end_cap_butt(self) -> Self

The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.

source

pub fn end_cap_square(self) -> Self

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.

source

pub fn end_cap_round(self) -> Self

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.

source

pub fn caps_butt(self) -> Self

The stroke for each sub-path does not extend beyond its two endpoints. A zero length sub-path will therefore not have any stroke.

source

pub fn caps_square(self) -> Self

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.

source

pub fn caps_round(self) -> Self

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.

source

pub fn join(self, join: LineJoin) -> Self

The way in which lines are joined at the vertices, matching the SVG spec.

Default value is MiterClip.

source

pub fn join_miter(self) -> Self

A sharp corner is to be used to join path segments.

source

pub fn join_miter_clip(self) -> Self

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.

source

pub fn join_round(self) -> Self

A round corner is to be used to join path segments.

source

pub fn join_bevel(self) -> Self

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.

source

pub fn stroke_weight(self, stroke_weight: f32) -> Self

The total stroke_weight (aka width) of the line.

source

pub fn miter_limit(self, limit: f32) -> Self

Describes the limit before miter lines will clip, as described in the SVG spec.

Must be greater than or equal to 1.0.

source

pub fn stroke_tolerance(self, tolerance: f32) -> Self

Maximum allowed distance to the path when building an approximation.

source

pub fn stroke_opts(self, opts: StrokeOptions) -> Self

Specify the full set of stroke options for the path tessellation.

source§

impl<'a, T> Drawing<'a, T>

source

pub fn no_fill(self) -> Self

Specify no fill color and in turn no fill tessellation for the polygon.

source

pub fn stroke_color<C>(self, color: C) -> Self

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.

source

pub fn polygon_options(self, opts: PolygonOptions) -> Self

Specify the whole set of polygon options.

Trait Implementations

source§

impl<'a, T> Drop for Drawing<'a, T>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a, T: Debug> Debug for Drawing<'a, T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more