Type Definition ggez::graphics::Image [−][src]
type Image = ImageGeneric<Resources>;
In-GPU-memory image data available to be drawn on the screen, using the OpenGL backend.
Under the hood this is just an Arc
'ed texture handle and
some metadata, so cloning it is fairly cheap; it doesn't
make another copy of the underlying image data.
Methods
impl Image
[src]
impl Image
pub fn new<P: AsRef<Path>>(context: &mut Context, path: P) -> GameResult<Image>
[src]
pub fn new<P: AsRef<Path>>(context: &mut Context, path: P) -> GameResult<Image>
Load a new image from the file at the given path.
pub fn from_rgba8(
context: &mut Context,
width: u16,
height: u16,
rgba: &[u8]
) -> GameResult<Image>
[src]
pub fn from_rgba8(
context: &mut Context,
width: u16,
height: u16,
rgba: &[u8]
) -> GameResult<Image>
Creates a new Image
from the given buffer of u8
RGBA values.
pub fn to_rgba8(&self, ctx: &mut Context) -> GameResult<Vec<u8>>
[src]
pub fn to_rgba8(&self, ctx: &mut Context) -> GameResult<Vec<u8>>
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<()>
[src]
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.
pub fn solid(
context: &mut Context,
size: u16,
color: Color
) -> GameResult<Image>
[src]
pub fn solid(
context: &mut Context,
size: u16,
color: Color
) -> GameResult<Image>
A little helper function that creates a new Image that is just a solid square of the given size and color. Mainly useful for debugging.
pub fn width(&self) -> u32
[src]
pub fn width(&self) -> u32
Return the width of the image.
pub fn height(&self) -> u32
[src]
pub fn height(&self) -> u32
Return the height of the image.
pub fn get_filter(&self) -> FilterMode
[src]
pub fn get_filter(&self) -> FilterMode
Get the filter mode for the image.
pub fn set_filter(&mut self, mode: FilterMode)
[src]
pub fn set_filter(&mut self, mode: FilterMode)
Set the filter mode for the image.
pub fn get_dimensions(&self) -> Rect
[src]
pub fn get_dimensions(&self) -> Rect
Returns the dimensions of the image.
pub fn get_wrap(&self) -> (WrapMode, WrapMode)
[src]
pub fn get_wrap(&self) -> (WrapMode, WrapMode)
Gets the Image
's WrapMode
along the X and Y axes.
pub fn set_wrap(&mut self, wrap_x: WrapMode, wrap_y: WrapMode)
[src]
pub fn set_wrap(&mut self, wrap_x: WrapMode, wrap_y: WrapMode)
Sets the Image
's WrapMode
along the X and Y axes.
Trait Implementations
impl Debug for Image
[src]
impl Debug for Image
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Drawable for Image
[src]
impl Drawable for Image
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
[src]
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
Actually draws the object to the screen. Read more
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
Sets the blend mode to be used when drawing this drawable. This overrides the general graphics::set_blend_mode()
. If None
is set, defers to the blend mode set by graphics::set_blend_mode()
. Read more
fn get_blend_mode(&self) -> Option<BlendMode>
[src]
fn get_blend_mode(&self) -> Option<BlendMode>
Gets the blend mode to be used when drawing this drawable.
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
[src]
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
Draws the drawable onto the rendering target. Read more