Enum flo_canvas::Draw[][src]

pub enum Draw {
    NewPath,
    Move(f32f32),
    Line(f32f32),
    BezierCurve((f32, f32)(f32, f32)(f32, f32)),
    ClosePath,
    Fill,
    Stroke,
    LineWidth(f32),
    LineWidthPixels(f32),
    LineJoin(LineJoin),
    LineCap(LineCap),
    NewDashPattern,
    DashLength(f32),
    DashOffset(f32),
    FillColor(Color),
    StrokeColor(Color),
    WindingRule(WindingRule),
    BlendMode(BlendMode),
    IdentityTransform,
    CanvasHeight(f32),
    CenterRegion((f32, f32)(f32, f32)),
    MultiplyTransform(Transform2D),
    Unclip,
    Clip,
    Store,
    Restore,
    FreeStoredBuffer,
    PushState,
    PopState,
    ClearCanvas(Color),
    Layer(u32),
    LayerBlend(u32BlendMode),
    ClearLayer,
    Sprite(SpriteId),
    ClearSprite,
    SpriteTransform(SpriteTransform),
    DrawSprite(SpriteId),
}

Instructions for drawing to a canvas

Variants

NewPath

Begins a new path

Move(f32f32)

Move to a new point

Line(f32f32)

Line to point

BezierCurve((f32, f32)(f32, f32)(f32, f32))

Bezier curve to point

ClosePath

Closes the current path

Fill

Fill the current path

Stroke

Draw a line around the current path

LineWidth(f32)

Set the line width

LineWidthPixels(f32)

Set the line width in pixels

LineJoin(LineJoin)

Line join

LineCap(LineCap)

The cap to use on lines

NewDashPattern

Resets the dash pattern to empty (which is a solid line)

DashLength(f32)

Adds a dash to the current dash pattern

DashOffset(f32)

Sets the offset for the dash pattern

FillColor(Color)

Set the fill color

StrokeColor(Color)

Set the line color

WindingRule(WindingRule)

Set the winding rule for fill operations

BlendMode(BlendMode)

Set how future renderings are blended with one another

IdentityTransform

Reset the transformation to the identity transformation

CanvasHeight(f32)

Sets a transformation such that: (0,0) is the center point of the canvas (0,height/2) is the top of the canvas Pixels are square

CenterRegion((f32, f32)(f32, f32))

Moves a particular region to the center of the canvas (coordinates are minx, miny, maxx, maxy)

MultiplyTransform(Transform2D)

Multiply a 2D transform into the canvas

Unclip

Unset the clipping path

Clip

Clip to the currently set path

Store

Stores the content of the clipping path from the current layer in a background buffer

Restore

Restores what was stored in the background buffer. This should be done on the same layer that the Store operation was called upon.

The buffer is left intact by this operation so it can be restored again in the future.

(If the clipping path has changed since then, the restored image is clipped against the new path)

FreeStoredBuffer

Releases the buffer created by the last 'Store' operation

Restore will no longer be valid for the current layer

PushState

Push the current state of the canvas (line settings, stored image, current path - all state)

PopState

Restore a state previously pushed

ClearCanvas(Color)

Clears the canvas entirely to a background colour

Layer(u32)

Selects a particular layer for drawing Layer 0 is selected initially. Layers are drawn in order starting from 0. Layer IDs don't have to be sequential.

LayerBlend(u32BlendMode)

Sets how a particular layer is blended with the underlying layer

ClearLayer

Clears the current layer

Sprite(SpriteId)

Selects a particular sprite for drawing

Future drawing actions are sent to this sprite: use something like Layer(0) to start drawing to a layer again.

Sprites can be repeatedly re-rendered with a single command and their appearance may be cached for efficiency. Actions that affect the whole canvas or layers are not permitted in sprites.

ClearSprite

Releases the resources used by the current sprite

SpriteTransform(SpriteTransform)

Adds a sprite transform to the current list of transformations to apply

DrawSprite(SpriteId)

Renders a sprite with a set of transformations

Trait Implementations

impl CanvasEncoding<String> for Draw[src]

impl Clone for Draw[src]

impl Copy for Draw[src]

impl Debug for Draw[src]

impl<'de> Deserialize<'de> for Draw[src]

impl<'a, Curve: BezierCurve> From<&'a Curve> for Draw where
    Curve::Point: Coordinate2D
[src]

impl PartialEq<Draw> for Draw[src]

impl Serialize for Draw[src]

impl StructuralPartialEq for Draw[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.