[][src]Struct quicksilver::graphics::Image

pub struct 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]

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]

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]

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]

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]

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]

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]

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

impl Clone for Image[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.