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: impl Into<String>) -> 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 try_clone(&self) -> 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: impl Into<String>) -> 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

Source

pub fn draw_str(&self, font: &Font, msg: &str, x: i32, y: i32)

Trait Implementations§

Source§

impl Clone for Surface

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Surface

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Surface

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Graphics for Surface

Source§

fn draw_pixel(&self, point: Point, color: Color)

Source§

fn draw_horiz_line(&self, x1: i16, x2: i16, y: i16, color: Color)

Source§

fn draw_vert_line(&self, x: i16, y1: i16, y2: i16, color: Color)

Source§

fn draw_line(&self, point1: Point, point2: Point, color: Color)

Source§

fn draw_antialiased_line(&self, point1: Point, point2: Point, color: Color)

Source§

fn draw_thick_line(&self, point1: Point, point2: Point, width: u8, color: Color)

Source§

fn draw_rectangle(&self, point1: Point, point2: Point, color: Color)

Source§

fn draw_rounded_rectangle( &self, point1: Point, point2: Point, radius: i16, color: Color, )

Source§

fn draw_filled_rectangle(&self, point1: Point, point2: Point, color: Color)

Source§

fn draw_rounded_filled_rectangle( &self, point1: Point, point2: Point, radius: i16, color: Color, )

Source§

fn draw_circle(&self, center: Point, radius: i16, color: Color)

Source§

fn draw_filled_circle(&self, center: Point, radius: i16, color: Color)

Source§

fn draw_antialiased_circle(&self, center: Point, radius: i16, color: Color)

Source§

fn draw_arc( &self, center: Point, radius: i16, start: i16, end: i16, color: Color, )

Source§

fn draw_ellipse( &self, center: Point, x_radius: i16, y_radius: i16, color: Color, )

Source§

fn draw_filled_ellipse( &self, center: Point, x_radius: i16, y_radius: i16, color: Color, )

Source§

fn draw_antialiased_ellipse( &self, center: Point, x_radius: i16, y_radius: i16, color: Color, )

Source§

fn draw_pie( &self, center: Point, radius: i16, start: i16, end: i16, color: Color, )

Source§

fn draw_filled_pie( &self, center: Point, radius: i16, start: i16, end: i16, color: Color, )

Source§

fn draw_triangle(&self, points: [Point; 3], color: Color)

Source§

fn draw_filled_triangle(&self, points: [Point; 3], color: Color)

Source§

fn draw_antialiased_triangle(&self, points: [Point; 3], color: Color)

Source§

fn draw_polygon_list(&self, x_points: &[i16], y_points: &[i16], color: Color)

Source§

fn draw_filled_polygon_list( &self, x_points: &[i16], y_points: &[i16], color: Color, )

Source§

fn draw_antialiased_polygon_list( &self, x_points: &[i16], y_points: &[i16], color: Color, )

Source§

fn draw_textured_polygon_list( &self, x_points: &[i16], y_points: &[i16], texture: &Surface, texture_offset: Point, )

Source§

fn draw_bezier_list( &self, x_points: &[i16], y_points: &[i16], interpolation: i32, color: Color, )

Source§

fn draw_polygon(&self, points: &[Point], color: Color)

Source§

fn draw_filled_polygon(&self, points: &[Point], color: Color)

Source§

fn draw_antialiased_polygon(&self, points: &[Point], color: Color)

Source§

fn draw_textured_polygon( &self, points: &[Point], texture: &Surface, texture_offset: Point, )

Source§

fn draw_bezier(&self, points: &[Point], interpolation: i32, color: Color)

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.