Buffer Graphics Lib
This is a simple graphics library for drawing to a buffer, mainly designed to be used with Pixels Graphics or Pixels
It has basic shape drawing, bitmap text and image rendering.
The Graphics struct needs a mutable slice to work on and so mostly likely you'll need to create the struct and pass in the buffer from the rendering library every frame but this should be fine for performance as the struct is nearly empty.
Usage
Cargo
In your Cargo.toml file add
= "0.15.0"
Code
Setup a graphics instance
let mut buffer: = ; //800 x 600 RGBA
let mut graphics = new?;
Drawing is then quite simple:
let text = new;
graphics.draw;
graphics.draw_image;
let shape = new;
let drawable = from_obj;
graphics.draw;
Features
Default features: "ici", "serde"
ici
- Load ici, ica image files as
IndexedImages
let image: IndexedImage...
graphics.draw_indexed_image;
image_loading
- Load png, bmp, etc image files as
Images
Code
let image = load_image?;
graphics.draw_image;
serde
- Adds derive
SerializeandDeserializefor most structs and enums - Enable
graphics-shapes/serde
mint
Enable graphics-shapes/mint