Description
This library provides a buffer type, RenderBuffer
, which can be used as a render target for Piston's graphics library. This buffer can be loaded from and/or saved to a file on disk. This allows for things like screenshots in games.
There is also an optional feature for RenderBuffer
that allows it to be converted into a G2dTexture
so that it can be rendered with piston_window
. To enable this, add features = ["piston_window_texture"]
to the graphics_buffer
dependency in your cargo.toml
.
Usage
Add this to your cargo.toml
:
= "0.6.0"
= "0.30.0"
or, if you want to be able to draw the texture to a window using piston_window
:
= { = "0.6.0", = ["piston_window_texture"] }
= "0.30.0"
= "0.89.0"
Here is a simple example that draws three circles and saves the image to a file:
use ellipse;
use *;
Contributing
Feel free to open an issue or PR if you want to contribute. There are definitely places for improvement, especially in the rendering code.