mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Implement SDL_UpperBlit as upper_blit
This commit is contained in:
+16
-1
@@ -247,6 +247,22 @@ impl Surface {
|
||||
Err(get_error())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn upper_blit( &self, src: &Surface, dstrect: Option<Rect>, srcrect: Option<Rect> ) -> bool {
|
||||
unsafe {
|
||||
match( srcrect, dstrect ) {
|
||||
(Some( srcrect ), Some( dstrect )) =>
|
||||
ll::SDL_UpperBlit( src.raw, &srcrect, self.raw, &dstrect ) == 0,
|
||||
(Some( srcrect ), None) =>
|
||||
ll::SDL_UpperBlit( src.raw, &srcrect, self.raw, ptr::null() ) == 0,
|
||||
(None, Some( dstrect )) =>
|
||||
ll::SDL_UpperBlit( src.raw, ptr::null(), self.raw, &dstrect ) == 0,
|
||||
(None, None) =>
|
||||
ll::SDL_UpperBlit( src.raw, ptr::null(), self.raw, ptr::null() ) == 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub fn SDL_SetSurfaceAlphaMod(surface: *SDL_Surface, alpha: uint8_t) -> c_int;
|
||||
pub fn SDL_GetSurfaceAlphaMod(surface: *SDL_Surface, alpha: *uint8_t ) -> c_int;
|
||||
@@ -259,7 +275,6 @@ impl Surface {
|
||||
pub fn SDL_ConvertPixels(width: c_int, height: c_int, src_format: uint32_t, src: *c_void, src_pitch: c_int, dst_format: uint32_t, dst: *c_void, dst_pitch: c_int) -> c_int;
|
||||
pub fn SDL_FillRect(dst: *SDL_Surface, rect: *SDL_Rect, color: uint32_t) -> c_int;
|
||||
pub fn SDL_FillRects(dst: *SDL_Surface, rects: *SDL_Rect, count: c_int, color: uint32_t) -> c_int;
|
||||
pub fn SDL_UpperBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
|
||||
pub fn SDL_LowerBlit(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
|
||||
pub fn SDL_SoftStretch(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
|
||||
pub fn SDL_UpperBlitScaled(src: *SDL_Surface, srcrect: *SDL_Rect, dst: *SDL_Surface, dstrect: *SDL_Rect) -> c_int;
|
||||
|
||||
Reference in New Issue
Block a user