Struct ggez::graphics::CanvasGeneric [−][src]
pub struct CanvasGeneric<Spec> where
Spec: BackendSpec, { /* fields omitted */ }
Expand description
A generic canvas independent of graphics backend. This type should
never need to be used directly; use graphics::Canvas
instead.
Implementations
pub fn new(
ctx: &mut Context,
width: u16,
height: u16,
samples: NumSamples,
color_format: Format
) -> GameResult<Canvas>
pub fn new(
ctx: &mut Context,
width: u16,
height: u16,
samples: NumSamples,
color_format: Format
) -> GameResult<Canvas>
Create a new Canvas
with the given size and number of samples.
WARNING: `Canvases with samples != NumSamples::One are currently broken, see https://github.com/ggez/ggez/issues/695
Create a new Canvas
with the current window dimensions.
Gets the backend Image
that is being rendered to. Note that this will be flipped but otherwise the same, use the to_image
function for the unflipped version.
Creates an Image
with the content of its raw counterpart but transformed to behave like a normal Image
.
Gets the backend Target
that is being rendered to.
Dumps the flipped Canvas
’s data to a Vec
of u8
RBGA8 values.
pub fn encode<P: AsRef<Path>>(
&self,
ctx: &mut Context,
format: ImageFormat,
path: P
) -> GameResult
pub fn encode<P: AsRef<Path>>(
&self,
ctx: &mut Context,
format: ImageFormat,
path: P
) -> GameResult
Encode the Canvas
’s content to the given file format and
write it out to the given path.
See the filesystem
module docs for where exactly
the file will end up.
Returns the dimensions of the canvas.
Get the filter mode for the canvas.
Set the filter mode for the canvas.