[][src]Module kas::draw

Drawing APIs

Multiple drawing APIs are available. Each has a slightly different purpose.

High-level themeable interface

The DrawHandle trait and companion SizeHandle trait provide the highest-level API over themeable widget components. These traits are implemented by a theme defined in kas-theme or another crate.

Medium-level drawing interfaces

The Draw trait and its extensions are provided as the building-blocks used to implement themes, but may also be used directly (as in the clock example). These traits allow drawing of simple shapes, mostly in the form of an axis-aligned box or frame with several shading options.

The Draw trait itself contains very little; extension traits DrawRounded, DrawShaded and DrawText provide additional draw routines. Toolkits are required to implement only the base Draw trait, and may provide their own extension traits. For this reason, themes are parameterised over an object D: Draw + ... (with specified trait bounds).

The medium-level API will be extended in the future to support texturing (not yet supported) and potentially a more comprehensive path-based API (e.g. Lyon).

Low-level interface

There is no universal graphics API, hence none is provided by this crate. Instead, toolkits may provide their own extensions allowing direct access to the host graphics API, for example kas-wgpu::draw::CustomPipe.

Structs

Colour

Standard colour description

InputState

Input and highlighting state of a widget

Pass

Pass identifier

Enums

ClipRegion

Classification of a clip region

TextClass

Class of text drawn

Traits

Draw

Base abstraction over drawing

DrawHandle

Handle passed to objects during draw and sizing operations

DrawHandleExt

Extension trait over DrawHandle

DrawRounded

Drawing commands for rounded shapes

DrawShaded

Drawing commands for shaded shapes

DrawShared

Bounds on type shared across Draw implementations

DrawText

Abstraction over text rendering

SizeHandle

Handle passed to objects during draw and sizing operations