Struct ggez::graphics::ImageGeneric [−][src]
pub struct ImageGeneric<B> where
B: BackendSpec, { /* fields omitted */ }
Expand description
Generic in-GPU-memory image data available to be drawn on the screen.
You probably just want to look at the Image
type.
Implementations
A helper function to get the raw gfx texture handle
A helper function to get the raw gfx texture view
Get the filter mode for the image.
Set the filter mode for the image.
Returns the dimensions of the image.
Load a new image from the file at the given path. The documentation for the
filesystem
module explains how the path must be specified.
Creates a new Image
from the given buffer, which should contain an image encoded
in a supported image file format.
pub fn from_bytes_with_format(
context: &mut Context,
bytes: &[u8],
format: ImageFormat
) -> GameResult<Self>
pub fn from_bytes_with_format(
context: &mut Context,
bytes: &[u8],
format: ImageFormat
) -> GameResult<Self>
Creates a new Image
from the given buffer, which should contain an image encoded
in the given image file format.
pub fn from_rgba8(
context: &mut Context,
width: u16,
height: u16,
rgba: &[u8]
) -> GameResult<Self>
pub fn from_rgba8(
context: &mut Context,
width: u16,
height: u16,
rgba: &[u8]
) -> GameResult<Self>
Creates a new Image
from the given buffer of u8
RGBA values.
The pixel layout is row-major. That is,
the first 4 u8
values make the top-left pixel in the Image
, the
next 4 make the next pixel in the same row, and so on to the end of
the row. The next width * 4
values make up the second row, and so
on.
Dumps the Image
’s data to a Vec
of u8
RGBA 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 Image
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.
Trait Implementations
impl<B: Clone> Clone for ImageGeneric<B> where
B: BackendSpec,
B::Resources: Clone,
B::Resources: Clone,
impl<B: Clone> Clone for ImageGeneric<B> where
B: BackendSpec,
B::Resources: Clone,
B::Resources: Clone,
impl<B: PartialEq> PartialEq<ImageGeneric<B>> for ImageGeneric<B> where
B: BackendSpec,
B::Resources: PartialEq,
B::Resources: PartialEq,
impl<B: PartialEq> PartialEq<ImageGeneric<B>> for ImageGeneric<B> where
B: BackendSpec,
B::Resources: PartialEq,
B::Resources: PartialEq,
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<B> !RefUnwindSafe for ImageGeneric<B>
impl<B> Send for ImageGeneric<B>
impl<B> Sync for ImageGeneric<B>
impl<B> Unpin for ImageGeneric<B>
impl<B> !UnwindSafe for ImageGeneric<B>
Blanket Implementations
Mutably borrows from an owned value. Read more