aboutsummaryrefslogtreecommitdiff
path: root/sdl2/surface.ha
blob: 24153c3136e4a1b4f1d8f4b1b0fb1985f02d1e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// A collection of pixels used in software blitting.
//
// This structure should be treated as read-only, except for 'pixels', which, if
// not null, contains the raw pixel data for the surface.
export type SDL_Surface = struct {
	flags: u32,
	format: *SDL_PixelFormat,
	w: int,
	h: int,
	pitch: int,
	pixels: nullable *opaque,

	userdata: *opaque,

	locked: int,
	lock_data: *opaque,

	clip_rect: SDL_Rect,

	map: *SDL_BlitMap,

	refcount: int,
};

export type SDL_BlitMap = opaque;

@symbol("SDL_CreateRGBSurface") fn _SDL_CreateRGBSurface(flags: u32,
	width: int, height: int, depth: int, Rmask: u32, Gmask: u32, Bmask: u32,
	Amask: u32) *SDL_Surface;

// Allocate a new RGB surface.
export fn SDL_CreateRGBSurface(flags: u32,
	width: int, height: int, depth: int, Rmask: u32, Gmask: u32, Bmask: u32,
	Amask: u32) (*SDL_Surface | error) = {
	return wrapptr(_SDL_CreateRGBSurface(flags, width, height, depth, Rmask,
	Gmask, Bmask, Amask))?: *SDL_Surface;
};