1with SDL.video; 2with SDL; 3with agar.core.types; 4with agar.core; 5with agar.gui.pixelformat; 6 7package agar.gui.surface is 8 9 -- types 10 type surface_t is new SDL.video.surface_t; 11 type surface_access_t is access all surface_t; 12 pragma convention (c, surface_t); 13 14 type index_t is new c.int; 15 type index_access_t is access all index_t; 16 pragma convention (c, index_t); 17 pragma convention (c, index_access_t); 18 19 -- constants 20 type flags_t is new c.unsigned; 21 pragma convention (c, flags_t); 22 23 HWSURFACE : constant flags_t := flags_t (SDL.video.HWSURFACE); 24 SRCCOLORKEY : constant flags_t := flags_t (SDL.video.SRCCOLORKEY); 25 SRCALPHA : constant flags_t := flags_t (SDL.video.SRCALPHA); 26 27 -- 28 -- API 29 -- 30 31 function allocate 32 (width : positive; 33 height : positive; 34 format : agar.gui.pixelformat.pixel_format_access_t; 35 flags : flags_t) return surface_access_t; 36 pragma inline (allocate); 37 38 function empty return surface_access_t; 39 pragma import (c, empty, "AG_SurfaceEmpty"); 40 41 function std_rgb 42 (width : positive; 43 height : positive) return surface_access_t; 44 pragma inline (std_rgb); 45 46 function std_rgba 47 (width : positive; 48 height : positive) return surface_access_t; 49 pragma inline (std_rgba); 50 51 function indexed 52 (width : positive; 53 height : positive; 54 bits_per_pixel : positive; 55 flags : flags_t) return surface_access_t; 56 pragma inline (indexed); 57 58 function rgb 59 (width : positive; 60 height : positive; 61 bits_per_pixel : positive; 62 flags : flags_t; 63 rmask : agar.core.types.uint32_t; 64 gmask : agar.core.types.uint32_t; 65 bmask : agar.core.types.uint32_t) return surface_access_t; 66 pragma inline (rgb); 67 68 function rgba 69 (width : positive; 70 height : positive; 71 bits_per_pixel : positive; 72 flags : flags_t; 73 rmask : agar.core.types.uint32_t; 74 gmask : agar.core.types.uint32_t; 75 bmask : agar.core.types.uint32_t; 76 amask : agar.core.types.uint32_t) return surface_access_t; 77 pragma inline (rgba); 78 79 function from_pixels_rgb 80 (pixels : agar.core.types.void_ptr_t; 81 width : positive; 82 height : positive; 83 bits_per_pixel : positive; 84 flags : flags_t; 85 rmask : agar.core.types.uint32_t; 86 gmask : agar.core.types.uint32_t; 87 bmask : agar.core.types.uint32_t) return surface_access_t; 88 pragma inline (from_pixels_rgb); 89 90 function from_pixels_rgba 91 (pixels : agar.core.types.void_ptr_t; 92 width : positive; 93 height : positive; 94 bits_per_pixel : positive; 95 flags : flags_t; 96 rmask : agar.core.types.uint32_t; 97 gmask : agar.core.types.uint32_t; 98 bmask : agar.core.types.uint32_t; 99 amask : agar.core.types.uint32_t) return surface_access_t; 100 pragma inline (from_pixels_rgba); 101 102 function from_bmp (file : string) return surface_access_t; 103 pragma inline (from_bmp); 104 105 function from_sdl (surface : sdl.video.surface_access_t) return surface_access_t; 106 pragma import (c, from_sdl, "AG_SurfaceFromSDL"); 107 108 procedure free (surface : surface_access_t); 109 pragma import (c, free, "AG_SurfaceFree"); 110 111 procedure copy 112 (dest : surface_access_t; 113 src : surface_access_t); 114 pragma import (c, copy, "AG_SurfaceCopy"); 115 116end agar.gui.surface; 117