pub struct Image { /* private fields */ }Implementations§
Source§impl Image
impl Image
pub fn new<P: AsRef<Path>>( ctx: &mut Context, quad_ctx: &mut GraphicsContext, path: P, ) -> GameResult<Self>
pub fn from_png_bytes( ctx: &mut Context, quad_ctx: &mut GraphicsContext, bytes: &[u8], ) -> GameResult<Self>
pub fn from_rgba8( ctx: &mut Context, quad_ctx: &mut GraphicsContext, width: u16, height: u16, bytes: &[u8], ) -> GameResult<Image>
pub fn from_texture( ctx: &mut Context, texture: Texture, filter: FilterMode, ) -> GameResult<Image>
Sourcepub fn solid(
context: &mut Context,
quad_ctx: &mut GraphicsContext,
size: u16,
color: Color,
) -> GameResult<Self>
pub fn solid( context: &mut Context, quad_ctx: &mut GraphicsContext, size: u16, color: Color, ) -> GameResult<Self>
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) -> u16
pub fn height(&self) -> u16
Sourcepub fn dimensions(&self) -> Rect
pub fn dimensions(&self) -> Rect
Returns the dimensions of the image.
pub fn set_filter(&mut self, filter: FilterMode)
pub fn filter(&self) -> FilterMode
Trait Implementations§
Source§impl Drawable for Image
impl Drawable for Image
Source§fn blend_mode(&self) -> Option<BlendMode>
fn blend_mode(&self) -> Option<BlendMode>
Gets the blend mode to be used when drawing this drawable.
Source§fn draw(
&self,
ctx: &mut Context,
quad_ctx: &mut GraphicsContext,
param: DrawParam,
) -> GameResult
fn draw( &self, ctx: &mut Context, quad_ctx: &mut GraphicsContext, param: DrawParam, ) -> GameResult
Draws the drawable onto the rendering target. Read more
Source§fn set_blend_mode(&mut self, mode: Option<BlendMode>)
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().fn dimensions(&self, _ctx: &mut Context) -> Option<Rect>
Auto Trait Implementations§
impl !Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more