Buffer Graphics Lib
This is a simple graphics library for drawing to a buffer, mainly designed to be used with Rust Graphics Library 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.
Usage
Cargo
In your Cargo.toml
file add
= "0.9.5"
= "0.1.10"
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
Both are enabled by default
image_loading
Load files as Image
s
Code
let image = load_image?;
graphics.draw_image;
serde_derive
Adds derive Serialize
and Deserialize
for Rect