[][src]Struct quicksilver::graphics::Surface

pub struct Surface(_);

A Surface is the core struct for rendering to textures, or getting data from them.

If you want to render to a texture, attach it and then pass the surface to Graphics::flush.

If you want to get data from a texture, attach it and use Surface::screenshot.

Methods

impl Surface[src]

pub fn new(
    gfx: &Graphics,
    attachment: Image
) -> Result<Surface, QuicksilverError>
[src]

Create a Surface with an attached Image

The image must not have any other references to it, or this function will return an error.

pub fn attach(&mut self, attachment: Image) -> Result<(), QuicksilverError>[src]

Use the attached image as the backing data for this Surface

To either get the data for an image via Surface::screenshot or set it via Graphics::flush, an image needs to be attached to this Surface.

The image must not have any other references to it, or this function will return an error.

It's generally faster to create one Surface per Image, and only attach and detach when necessary.

pub fn detach(&mut self) -> Option<Image>[src]

Take the Image out of this Surface

To use the data that has been rendered to a Surface, its attachment has to be removed to avoid creating a loop (where the Image is both being drawn from and being drawn to.)

Important traits for Vec<u8>
pub fn screenshot(
    &self,
    gfx: &Graphics,
    x: u32,
    y: u32,
    width: u32,
    height: u32,
    format: ColorFormat
) -> Vec<u8>
[src]

Get the pixel data of a given region of this surface

pub fn size(&self) -> Option<Vector>[src]

Return the size of the attached image, or None if there is no image

Auto Trait Implementations

impl !RefUnwindSafe for Surface

impl !Send for Surface

impl !Sync for Surface

impl Unpin for Surface

impl !UnwindSafe for Surface

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, 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.