Maraiah/source/rozinante/draw.rs

37 lines
632 B
Rust

//! GUI drawing capabilities.
use crate::durandal::image::Color;
pub trait CacheImage
{
fn w(&self) -> Coord;
fn h(&self) -> Coord;
}
pub trait DrawArea
{
type NativeImage: CacheImage;
fn w(&self) -> Coord;
fn h(&self) -> Coord;
fn clear(&self, cr: impl Color);
fn rect(&self, rect: Rect, cr: impl Color);
fn text(&self, pos: Point, text: &str, cr: impl Color);
fn image(&self, pos: Point, im: &Self::NativeImage);
}
pub type Coord = i32;
pub type Point = (Coord, Coord);
#[derive(Copy, Clone, Debug)]
pub struct Rect
{
pub x: Coord,
pub y: Coord,
pub w: Coord,
pub h: Coord,
}
// EOF