[][src]Trait kas::draw::Draw

pub trait Draw: Any {
    pub fn as_any_mut(&mut self) -> &mut dyn Any;
pub fn add_clip_region(&mut self, rect: Rect, depth: f32) -> Pass;
pub fn rect(&mut self, pass: Pass, rect: Quad, col: Colour);
pub fn frame(&mut self, pass: Pass, outer: Quad, inner: Quad, col: Colour); }

Base abstraction over drawing

Unlike DrawHandle, coordinates are specified via a Vec2 and rectangular regions via Quad. The same coordinate system is used, hence type conversions can be performed with from and into. Integral coordinates align with pixels, non-integral coordinates may also be used.

All draw operations may be batched; when drawn primitives overlap, the results are only loosely defined. Draw operations involving transparency should be ordered after those without transparency.

Draw operations take place over multiple render passes, identified by a handle of type Pass. In general the user only needs to pass this value into methods as required. Draw::add_clip_region creates a new Pass.

Each Pass has an associated depth value which may be used to determine the result of overlapping draw commands.

Required methods

pub fn as_any_mut(&mut self) -> &mut dyn Any[src]

Cast self to std::any::Any reference.

A downcast on this value may be used to obtain a reference to a toolkit-specific API.

pub fn add_clip_region(&mut self, rect: Rect, depth: f32) -> Pass[src]

Add a clip region

Clip regions are cleared each frame and so must be recreated on demand. Each region has an associated depth value. The theme is responsible for assigning depth values.

pub fn rect(&mut self, pass: Pass, rect: Quad, col: Colour)[src]

Draw a rectangle of uniform colour

pub fn frame(&mut self, pass: Pass, outer: Quad, inner: Quad, col: Colour)[src]

Draw a frame of uniform colour

The frame is defined by the area inside outer and not inside inner.

Loading content...

Implementors

Loading content...