Struct Surface

Source
pub struct Surface {
    pub raw: *mut SDL_Surface,
    pub owned: bool,
}

Fields§

§raw: *mut SDL_Surface§owned: bool

Implementations§

Source§

impl Surface

Source

pub fn new( surface_flags: &[SurfaceFlag], width: isize, height: isize, bpp: isize, rmask: u32, gmask: u32, bmask: u32, amask: u32, ) -> Result<Surface, String>

Source

pub fn from_bmp(path: &Path) -> Result<Surface, String>

Source

pub fn get_width(&self) -> u16

Source

pub fn get_height(&self) -> u16

Source

pub fn get_size(&self) -> (u16, u16)

Source

pub fn get_rect(&self) -> Rect

Source

pub fn update_rect(&self, rect: &Rect)

Source

pub fn update_rects(&self, rects: &[Rect])

Source

pub fn set_colors(&self, colors: &[Color]) -> bool

Source

pub fn set_palette(&self, palettes: &[PaletteType], colors: &[Color]) -> bool

Source

pub fn lock(&self) -> bool

Source

pub fn with_lock<F: Fn(&mut [u8]) -> bool>(&self, f: F) -> bool

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

Source

pub fn unlock(&self)

Source

pub fn flip(&self) -> bool

Source

pub fn convert( &self, fmt: &PixelFormat, flags: &[SurfaceFlag], ) -> Result<Surface, String>

Source

pub fn display_format(&self) -> Result<Surface, String>

Source

pub fn display_format_alpha(&self) -> Result<Surface, String>

Source

pub fn save_bmp(&self, path: &Path) -> bool

Source

pub fn set_alpha(&self, flags: &[SurfaceFlag], alpha: u8) -> bool

Source

pub fn set_color_key(&self, flags: &[SurfaceFlag], color: Color) -> bool

Source

pub fn set_clip_rect(&self, rect: &Rect)

Source

pub fn get_clip_rect(&self) -> Rect

Source

pub fn blit_rect( &self, src: &Surface, src_rect: Option<Rect>, dest_rect: Option<Rect>, ) -> bool

Source

pub fn blit(&self, src: &Surface) -> bool

Source

pub fn blit_at(&self, src: &Surface, x: i16, y: i16) -> bool

Source

pub fn fill_rect(&self, rect: Option<Rect>, color: Color) -> bool

Source

pub fn fill(&self, color: Color) -> bool

Source

pub fn clear(&self) -> bool

Trait Implementations§

Source§

impl Drop for Surface

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Surface

Source§

fn eq(&self, other: &Surface) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Surface

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.