Struct sdl2::surface::Surface
[−]
[src]
pub struct Surface<'a> { // some fields omitted }
Methods
impl<'a> Surface<'a>
[src]
unsafe fn raw(&self) -> *mut SDL_Surface
unsafe fn owned(&self) -> bool
unsafe fn from_ll<'b>(raw: *mut SDL_Surface, owned: bool) -> Surface<'b>
fn new(width: u32, height: u32, format: PixelFormatEnum) -> SdlResult<Surface<'static>>
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();
fn from_pixelmasks(width: u32, height: u32, masks: PixelMasks) -> SdlResult<Surface<'static>>
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();
fn from_data(data: &'a mut [u8], width: u32, height: u32, pitch: u32, format: PixelFormatEnum) -> SdlResult<Surface<'a>>
Creates a new surface from an existing buffer, using a pixel format.
fn from_data_pixelmasks(data: &'a mut [u8], width: u32, height: u32, pitch: u32, masks: PixelMasks) -> SdlResult<Surface<'a>>
Creates a new surface from an existing buffer, using pixel masks.
fn get_width(&self) -> u32
fn get_height(&self) -> u32
fn get_pitch(&self) -> u32
fn get_size(&self) -> (u32, u32)
fn get_rect(&self) -> Rect
fn get_pixel_format(&self) -> PixelFormat
fn lock(&self) -> bool
fn with_lock<R, F: FnOnce(&mut [u8]) -> R>(&mut self, f: F) -> R
Locks a surface so that the pixels can be directly accessed safely.
fn unlock(&self)
fn load_bmp_rw(rwops: &mut RWops) -> SdlResult<Surface<'static>>
fn save_bmp_rw(&self, rwops: &mut RWops) -> SdlResult<()>
fn load_bmp<P: AsRef<Path>>(path: P) -> SdlResult<Surface<'static>>
fn save_bmp<P: AsRef<Path>>(&self, path: P) -> SdlResult<()>
fn set_palette(&self, palette: &Palette) -> bool
fn enable_RLE(&self) -> bool
fn disable_RLE(&self) -> bool
fn set_color_key(&self, enable: bool, color: Color) -> SdlResult<()>
fn get_color_key(&self) -> SdlResult<Color>
fn set_color_mod(&self, color: Color) -> bool
fn get_color_mod(&self) -> SdlResult<Color>
fn blit(&self, src: &Surface, dstrect: Option<Rect>, srcrect: Option<Rect>) -> bool
fn fill_rect(&mut self, rect: Option<Rect>, color: Color) -> SdlResult<()>
fn fill_rects(&mut self, rects: &[Option<Rect>], color: Color) -> SdlResult<()>
fn set_alpha_mod(&mut self, alpha: u8) -> SdlResult<()>
fn get_alpha_mod(&self) -> SdlResult<u8>
fn set_blend_mode(&mut self, mode: BlendMode) -> SdlResult<()>
fn get_blend_mode(&self) -> SdlResult<BlendMode>
fn set_clip_rect(&mut self, rect: Option<Rect>) -> bool
fn get_clip_rect(&self) -> Rect
fn convert(&self, format: &PixelFormat) -> SdlResult<Surface<'static>>
fn convert_format(&self, format: PixelFormatEnum) -> SdlResult<Surface<'static>>
fn lower_blit(&self, src_rect: Option<Rect>, dst: &mut Surface, dst_rect: Option<Rect>) -> SdlResult<()>
fn soft_stretch(&self, src_rect: Option<Rect>, dst: &mut Surface, dst_rect: Option<Rect>) -> SdlResult<()>
fn blit_scaled(&self, src_rect: Option<Rect>, dst: &mut Surface, dst_rect: Option<Rect>) -> SdlResult<()>
fn upper_blit_scaled(&self, src_rect: Option<Rect>, dst: &mut Surface, dst_rect: Option<Rect>) -> SdlResult<()>
This function is deprecated