11 MODULE = SDL::Surface PACKAGE = SDL::Surface PREFIX = surface_
15 SDL_Surface -- Graphic surface structure
17 typedef struct SDL_Surface {
18 Uint32 flags; /* Read-only */
19 SDL_PixelFormat *format; /* Read-only */
20 int w, h; /* Read-only */
21 Uint16 pitch; /* Read-only */
22 void *pixels; /* Read-write */
23 SDL_Rect clip_rect; /* Read-only */
24 int refcount; /* Read-mostly */
26 /* This structure also contains private fields not shown here */
32 surface_new (CLASS, flags, width, height, depth, Rmask, Gmask, Bmask, Amask )
43 RETVAL = SDL_CreateRGBSurface ( flags, width, height,
44 depth, Rmask, Gmask, Bmask, Amask );
49 surface_format ( surface )
52 char* CLASS = "SDL::PixelFormat";
53 RETVAL = surface->format;
58 surface_pitch( surface )
61 RETVAL = surface->pitch;
82 surface_get_pixels(surface)
85 if(!surface->pixels) croak("Incomplete surface");
86 RETVAL = PTR2IV(surface->pixels);
91 surface_set_pixels(surface, pixels)
101 p = SvPV(pixels, len);
102 if (len > surface->pitch*surface->h)
103 len = surface->pitch*surface->h;
104 memcpy(surface->pixels, p, len);
107 surface_DESTROY(surface)
110 Uint8* pixels = surface->pixels;
111 Uint32 flags = surface->flags;
112 SDL_FreeSurface(surface);
113 if (flags & SDL_PREALLOC)