Struct sdl2::surface::Surface [] [src]

pub struct Surface<'a> { /* fields omitted */ }

Methods

impl<'a> Surface<'a>
[src]

Creates a new surface using a pixel format.

Example

use sdl2::pixels::PixelFormatEnum;
use sdl2::surface::Surface;

let surface = Surface::new(512, 512, PixelFormatEnum::RGB24).unwrap();

Creates a new surface using pixel masks.

Example

use sdl2::pixels::PixelFormatEnum;
use sdl2::surface::Surface;

let masks = PixelFormatEnum::RGB24.into_masks().unwrap();
let surface = Surface::from_pixelmasks(512, 512, masks).unwrap();

Creates a new surface from an existing buffer, using a pixel format.

Creates a new surface from an existing buffer, using pixel masks.

Methods from Deref<Target=SurfaceRef>

Locks a surface so that the pixels can be directly accessed safely.

Locks a surface so that the pixels can be directly accessed safely.

Returns the Surface's pixel buffer if the Surface doesn't require locking (e.g. it's a software surface).

Returns the Surface's pixel buffer if the Surface doesn't require locking (e.g. it's a software surface).

Returns true if the Surface needs to be locked before accessing the Surface pixels.

The function will fail if the surface doesn't have color key enabled.

The function will fail if the blend mode is not supported by SDL.

Sets the clip rectangle for the surface.

If the rectangle is None, clipping will be disabled.

Gets the clip rectangle for the surface.

Returns None if clipping is disabled.

Copies the surface into a new one that is optimized for blitting to a surface of a specified pixel format.

Performs surface blitting (surface copying).

Returns the final blit rectangle, if a dst_rect was provided.

Performs low-level surface blitting.

Unless you know what you're doing, use blit() instead, which will clip the input rectangles. This function could crash if the rectangles aren't pre-clipped to the surface, and is therefore unsafe.

Performs scaled surface bliting (surface copying).

Returns the final blit rectangle, if a dst_rect was provided.

Performs low-level scaled surface blitting.

Unless you know what you're doing, use blit_scaled() instead, which will clip the input rectangles. This function could crash if the rectangles aren't pre-clipped to the surface, and is therefore unsafe.

Trait Implementations

impl<'a> Drop for Surface<'a>
[src]

A method called when the value goes out of scope. Read more

impl<'a> Deref for Surface<'a>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<'a> DerefMut for Surface<'a>
[src]

The method called to mutably dereference a value

impl<'a> AsRef<SurfaceRef> for Surface<'a>
[src]

Performs the conversion.

impl<'a> AsMut<SurfaceRef> for Surface<'a>
[src]

Performs the conversion.