Enum flo_canvas::Draw [−][src]
pub enum Draw {
Show 47 variants
StartFrame,
ShowFrame,
ResetFrame,
Path(PathOp),
Fill,
Stroke,
LineWidth(f32),
LineWidthPixels(f32),
LineJoin(LineJoin),
LineCap(LineCap),
NewDashPattern,
DashLength(f32),
DashOffset(f32),
FillColor(Color),
FillTexture(TextureId, (f32, f32), (f32, f32)),
FillGradient(GradientId, (f32, f32), (f32, f32)),
FillTransform(Transform2D),
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(LayerId),
LayerBlend(LayerId, BlendMode),
ClearLayer,
ClearAllLayers,
SwapLayers(LayerId, LayerId),
Sprite(SpriteId),
ClearSprite,
SpriteTransform(SpriteTransform),
DrawSprite(SpriteId),
Texture(TextureId, TextureOp),
Font(FontId, FontOp),
BeginLineLayout(f32, f32, TextAlignment),
DrawLaidOutText,
DrawText(FontId, String, f32, f32),
Gradient(GradientId, GradientOp),
}Expand description
Instructions for drawing to a canvas
Variants
Suspends rendering to the display until the next ‘ShowFrame’
The renderer may perform tessellation or rendering in the background after ‘StartFrame’ but won’t commit anything to the visible frame buffer until ‘ShowFrame’ is hit. If ‘StartFrame’ is nested, then the frame won’t be displayed until ‘ShowFrame’ has been requested at least that many times.
The frame state persists across a ‘ClearCanvas’
Displays any requested queued after ‘StartFrame’
Resets the frame count back to 0 (for when regenerating the state of a canvas)
Performs an operation on the currently defined path
Tuple Fields of Path
0: PathOpFill the current path
Draw a line around the current path
Set the line width
Tuple Fields of LineWidth
0: f32Set the line width in pixels
Tuple Fields of LineWidthPixels
0: f32Line join
Tuple Fields of LineJoin
0: LineJoinThe cap to use on lines
Tuple Fields of LineCap
0: LineCapResets the dash pattern to empty (which is a solid line)
Adds a dash to the current dash pattern
Tuple Fields of DashLength
0: f32Sets the offset for the dash pattern
Tuple Fields of DashOffset
0: f32Set the fill color
Tuple Fields of FillColor
0: ColorSets the fill to be a texture (coordinates are the lower-left and upper-right coordinates where the image should appear)
Sets the fill to be a gradient (coordinates are the start and end of the gradient)
For a gradient or texture fill, apply a transformation matrix
Tuple Fields of FillTransform
0: Transform2DSet the line color
Tuple Fields of StrokeColor
0: ColorSet the winding rule for fill operations
Tuple Fields of WindingRule
0: WindingRuleSet how future renderings are blended with one another
Tuple Fields of BlendMode
0: BlendModeReset the transformation to the identity transformation
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
Tuple Fields of CanvasHeight
0: f32Moves a particular region to the center of the canvas (coordinates are minx, miny, maxx, maxy)
Multiply a 2D transform into the canvas
Tuple Fields of MultiplyTransform
0: Transform2DUnset the clipping path
Clip to the currently set path
Stores the content of the clipping path from the current layer in a background buffer
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)
Releases the buffer created by the last ‘Store’ operation
Restore will no longer be valid for the current layer
Push the current state of the canvas
Restore a state previously pushed
This will restore the line width (and the other stroke settings), stroke colour, current path, fill colour, winding rule, sprite settings and blend settings.
The currently selected layer is not affected by this operation.
Clears the canvas entirely to a background colour, and removes any stored resources (layers, sprites, fonts, textures)
Tuple Fields of ClearCanvas
0: ColorSelects 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.
Tuple Fields of Layer
0: LayerIdSets how a particular layer is blended with the underlying layer
Clears the current layer
Clears all of the layers
Exchanges the ordering of two layers
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.
Tuple Fields of Sprite
0: SpriteIdReleases the resources used by the current sprite
Adds a sprite transform to the current list of transformations to apply
Tuple Fields of SpriteTransform
Renders a sprite with a set of transformations
Tuple Fields of DrawSprite
0: SpriteIdPerforms an operation on a texture
Performs an operation on a font
Begins laying out text on a line: the coordinates specify the baseline position
Tuple Fields of BeginLineLayout
Renders the text in the current layout
Draws a string using a font with a baseline starting at the specified position
Updates a gradient definition
Tuple Fields of Gradient
0: GradientId1: GradientOpTrait Implementations
Encodes this item by appending it to the specified string Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Draw
impl UnwindSafe for Draw
Blanket Implementations
Mutably borrows from an owned value. Read more