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]
pub fn new<P: AsRef<Path>>(context: &mut Context, path: P) -> GameResult<Image>
[src]
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]
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]
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]
&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]
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]
Return the width of the image.
pub fn height(&self) -> u32
[src]
Return the height of the image.
pub fn get_filter(&self) -> FilterMode
[src]
Get the filter mode for the image.
pub fn set_filter(&mut self, mode: FilterMode)
[src]
Set the filter mode for the image.
pub fn get_dimensions(&self) -> Rect
[src]
Returns the dimensions of the image.
pub fn get_wrap(&self) -> (WrapMode, WrapMode)
[src]
Gets the Image
's WrapMode
along the X and Y axes.
pub fn set_wrap(&mut self, wrap_x: WrapMode, wrap_y: WrapMode)
[src]
Sets the Image
's WrapMode
along the X and Y axes.
Trait Implementations
impl Debug for Image
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Drawable for Image
[src]
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
[src]
Actually draws the object to the screen. Read more
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
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]
Gets the blend mode to be used when drawing this drawable.
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
[src]
Draws the drawable onto the rendering target. Read more