diff --git a/src/video/sdl-video-surfaces-makers.adb b/src/video/sdl-video-surfaces-makers.adb index 33dec95..e797e40 100644 --- a/src/video/sdl-video-surfaces-makers.adb +++ b/src/video/sdl-video-surfaces-makers.adb @@ -122,7 +122,7 @@ package body SDL.Video.Surfaces.Makers is procedure Create (Self : in out Surface; File_Name : in UTF_Strings.UTF_String) is - function SDL_Load_BMP_RW (Src : in SDL.RWops.RWops; freesrc : C.int) return Internal_Surface_Pointer with + function SDL_Load_BMP_RW (Src : in SDL.RWops.RWops; freesrc : C.int) return Internal_Surface_Pointer with Import => True, Convention => C, External_Name => "SDL_LoadBMP_RW"; @@ -140,6 +140,26 @@ package body SDL.Video.Surfaces.Makers is Self.Owns := True; end Create; + procedure Convert (Self : in out Surface; + Src : SDL.Video.Surfaces.Surface; + Pixel_Format : SDL.Video.Pixel_Formats.Pixel_Format_Access) is + function SDL_ConvertSurface + (Src : in SDL.Video.Surfaces.Internal_Surface_Pointer; + Fmt : in SDL.Video.Pixel_Formats.Pixel_Format_Access; + Flags : in C.unsigned) return Internal_Surface_Pointer with + Import => True, + Convention => C, + External_Name => "SDL_ConvertSurface"; + Surface : Internal_Surface_Pointer := null; + begin + Surface := SDL_ConvertSurface (Src.Internal, Pixel_Format, 0); + if Surface = null then + raise Surface_Error with SDL.Error.Get; + end if; + + Self.Internal := Surface; + Self.Owns := True; + end Convert; function Get_Internal_Surface (Self : in Surface) return Internal_Surface_Pointer is begin diff --git a/src/video/sdl-video-surfaces-makers.ads b/src/video/sdl-video-surfaces-makers.ads index bf60705..ecbe1b9 100644 --- a/src/video/sdl-video-surfaces-makers.ads +++ b/src/video/sdl-video-surfaces-makers.ads @@ -54,6 +54,10 @@ package SDL.Video.Surfaces.Makers is procedure Create (Self : in out Surface; File_Name : in UTF_Strings.UTF_String); + + procedure Convert (Self : in out Surface; + Src : SDL.Video.Surfaces.Surface; + Pixel_Format : SDL.Video.Pixel_Formats.Pixel_Format_Access); private function Get_Internal_Surface (Self : in Surface) return Internal_Surface_Pointer with Export => True, @@ -64,7 +68,6 @@ private Export => True, Convention => Ada; - -- TODO: SDL_ConvertSurface -- TODO: SDL_ConvertSurfaceFormat -- TODO: SDL_CreateRGBSurfaceFrom end SDL.Video.Surfaces.Makers;