[−][src]Struct quicksilver::graphics::Image
A 2D image, stored on the GPU
See Graphics::draw_image
to draw it
Implementations
impl Image
[src]
pub fn from_raw(
gfx: &Graphics,
data: Option<&[u8]>,
width: u32,
height: u32,
format: PixelFormat
) -> Result<Image, GolemError>
[src]
gfx: &Graphics,
data: Option<&[u8]>,
width: u32,
height: u32,
format: PixelFormat
) -> Result<Image, GolemError>
Create an image with a given width and height
Either source the data from an array of bytes, or create a blank image.
format
determines how to interpet the bytes when creating the image
pub fn from_encoded_bytes(
gfx: &Graphics,
raw: &[u8]
) -> Result<Image, QuicksilverError>
[src]
gfx: &Graphics,
raw: &[u8]
) -> Result<Image, QuicksilverError>
Create an image from an encoded image format
JPEG and PNG are supported
pub async fn load<'_>(
gfx: &'_ Graphics,
path: impl AsRef<Path>
) -> Result<Image, QuicksilverError>
[src]
gfx: &'_ Graphics,
path: impl AsRef<Path>
) -> Result<Image, QuicksilverError>
Load an image from a file at the given path
JPEG and PNG file formats are supported
pub fn set_data(
&mut self,
data: Option<&[u8]>,
width: u32,
height: u32,
color: ColorFormat
)
[src]
&mut self,
data: Option<&[u8]>,
width: u32,
height: u32,
color: ColorFormat
)
Replace the backing data for the image, or create a blank image
pub fn set_sub_data(
&self,
data: &[u8],
x: u32,
y: u32,
width: u32,
height: u32,
color: ColorFormat
)
[src]
&self,
data: &[u8],
x: u32,
y: u32,
width: u32,
height: u32,
color: ColorFormat
)
Set the data for some region of this image, without clearing it
pub fn size(&self) -> Vector
[src]
Get the size of the image
pub fn set_minification(
&self,
min: TextureFilter
) -> Result<(), QuicksilverError>
[src]
&self,
min: TextureFilter
) -> Result<(), QuicksilverError>
Determine how the texture should scale down
Only textures with a power-of-2 size support mipmaps, all others will return errors
pub fn set_magnification(
&self,
max: TextureFilter
) -> Result<(), QuicksilverError>
[src]
&self,
max: TextureFilter
) -> Result<(), QuicksilverError>
Determine how the texture should scale up
Attempting to use a mipmap filter for magnification will result in an error
pub fn set_wrap_h(&self, wrap: TextureWrap) -> Result<(), QuicksilverError>
[src]
Determine how the texture is wrapped horizontally
Only textures with a power-of-2 size support texture wrapping, all others must ClampToEdge or will return an error
pub fn set_wrap_v(&self, wrap: TextureWrap) -> Result<(), QuicksilverError>
[src]
Determine how the texture is wrapped vertically
Only textures with a power-of-2 size support texture wrapping, all others must ClampToEdge or will return an error
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Image
impl !Send for Image
impl !Sync for Image
impl Unpin for Image
impl !UnwindSafe for Image
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,