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";
54 RETVAL = surface->format;
59 surface_pitch( surface )
62 RETVAL = surface->pitch;
83 surface_get_pixels(surface)
86 if(!surface->pixels) croak("Incomplete surface");
87 RETVAL = PTR2IV(surface->pixels);
92 surface_set_pixels(surface, pixels)
102 p = SvPV(pixels, len);
103 if (len > surface->pitch*surface->h)
104 len = surface->pitch*surface->h;
105 memcpy(surface->pixels, p, len);
108 surface_DESTROY(surface)
111 Uint8* pixels = surface->pixels;
112 Uint32 flags = surface->flags;
113 SDL_FreeSurface(surface);
114 if (flags & SDL_PREALLOC)