[−][src]Type Definition ggez::graphics::Canvas
type Canvas = CanvasGeneric<GlBackendSpec>;
A canvas that can be rendered to instead of the screen (sometimes referred
to as "render target" or "render to texture"). Set the canvas with the
graphics::set_canvas()
function, and then anything you
draw will be drawn to the canvas instead of the screen.
Resume drawing to the screen by calling graphics::set_canvas(None)
.
A Canvas
allows graphics to be rendered to images off-screen
in order to do things like saving to an image file or creating cool effects
by using shaders that render to an image.
If you just want to draw multiple things efficiently, look at
SpriteBatch
.
Methods
impl Canvas
[src]
pub fn new(
ctx: &mut Context,
width: u16,
height: u16,
samples: NumSamples
) -> GameResult<Canvas>
[src]
ctx: &mut Context,
width: u16,
height: u16,
samples: NumSamples
) -> GameResult<Canvas>
Create a new Canvas
with the given size and number of samples.
pub fn with_window_size(ctx: &mut Context) -> GameResult<Canvas>
[src]
Create a new Canvas
with the current window dimensions.
pub fn image(&self) -> &Image
[src]
Gets the backend Image
that is being rendered to.
pub fn into_inner(self) -> Image
[src]
Destroys the Canvas
and returns the Image
it contains.