Expand description
§Draw APIs
Multiple drawing APIs are available. Each has a slightly different purpose:
- High-level “themed widget components” are available through
DrawCx
. This is the primary drawing interface for widgets. - Basic drawing components (shapes) are available through
DrawIface
in this module. This can be accessed viaDrawCx::draw_device
. - The graphics backend may support custom pipelines, for example
kas-wgpu::draw::CustomPipe
(used by the Mandlebrot example).
Text may be drawn by either DrawCx
or DrawIface
with a slightly
different API (using theme properties or directly specifying colors and effects).
§Draw order
All draw operations happen within a “draw pass”. The first pass corresponds
to the window, while additional passes may be clipped and offset (see
DrawIface::new_pass
). Draw passes are executed sequentially in the order
defined.
Within each pass, draw operations may be batched, thus draw operations may not happen in the order queued. Exact behaviour is defined by the graphics backend. In general, it may be expected that batches are executed in the following order:
- Square-edged primitives (e.g.
Draw::rect
) - Images
- Rounded or other partially-transparent primitives (e.g.
DrawRounded::circle
) - Custom draw routines (
CustomPipe
) - Text
Modules§
- color
- Colour types
Structs§
- Alloc
Error - Allocation failed: too large or zero sized
- Draw
Iface - Draw interface object
- Image
Handle - Handle for an image
- ImageId
- Identifier for an image allocation
- PassId
- Draw pass identifier
- Shared
State - Shared draw state
Enums§
- Image
Format - Image formats available for upload
- Pass
Type - Type of draw pass
Traits§
- Draw
- Basic draw interface for
DrawIface
- Draw
Impl - Implementation target for
Draw
- Draw
Rounded - Extended draw interface for
DrawIface
providing rounded drawing - Draw
Rounded Impl - Implementation target for
DrawRounded
- Draw
Shared - Interface over
SharedState
- Draw
Shared Impl - Implementation target for
DrawShared