12 static Uint16* av_to_uint16 (AV* av)
18 Uint16* table = (Uint16 *)safemalloc(sizeof(Uint16)*(len));
19 for ( i = 0; i < len+1 ; i++ ){
20 SV ** temp = av_fetch(av,i,0);
23 table[i] = (Uint16 *) SvIV( *temp );
35 MODULE = SDL::Video PACKAGE = SDL::Video PREFIX = video_
39 The Following are XS bindings to the Video category in the SDL API v2.1.13
41 Describe on the SDL API site.
43 See: L<http://www.libsdl.org/cgi/docwiki.cgi/SDL_API#head-813f033ec44914f267f32195aba7d9aff8c410c0>
48 video_get_video_surface()
50 char* CLASS = "SDL::Surface";
52 RETVAL = SDL_GetVideoSurface();
58 video_get_video_info()
60 char* CLASS = "SDL::VideoInfo";
62 RETVAL = (SDL_VideoInfo *) SDL_GetVideoInfo();
68 video_video_driver_name( )
72 if ( SDL_VideoDriverName(buffer, 1024) != NULL )
74 RETVAL = newSVpv(buffer, 0);
82 list_modes ( format, flags )
84 SDL_PixelFormat *format
89 mode = SDL_ListModes(format,flags);
90 if (mode == (SDL_Rect**)-1 ) {
91 av_push(RETVAL,newSVpv("all",0));
93 av_push(RETVAL,newSVpv("none",0));
96 av_push(RETVAL,newSViv(PTR2IV(*mode)));
104 video_video_mode_ok ( width, height, bpp, flags )
110 RETVAL = SDL_VideoModeOK(width,height,bpp,flags);
116 video_set_video_mode ( width, height, bpp, flags )
122 char* CLASS = "SDL::Surface";
124 RETVAL = SDL_SetVideoMode(width,height,bpp,flags);
130 video_update_rect ( surface, x, y, w ,h )
137 SDL_UpdateRect(surface,x,y,w,h);
140 video_update_rects ( surface, ... )
145 if ( items < 2 ) return;
146 num_rects = items - 1;
147 rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
148 for(i=0;i<num_rects;i++) {
149 rects[i] = *(SDL_Rect *)SvIV((SV*)SvRV( ST(i + 1) ));
151 SDL_UpdateRects(surface,num_rects,rects);
156 video_flip ( surface )
159 RETVAL = SDL_Flip(surface);
164 video_set_colors ( surface, start, ... )
168 SDL_Color *colors,*temp;
170 if ( items < 3 ) { RETVAL = 0;}
174 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
175 for ( i = 0; i < length ; i++ ) {
176 temp = (SDL_Color *)SvIV(ST(i+2));
177 colors[i].r = temp->r;
178 colors[i].g = temp->g;
179 colors[i].b = temp->b;
181 RETVAL = SDL_SetColors(surface, colors, start, length );
189 video_set_palette ( surface, flags, start, ... )
195 SDL_Color *colors,*temp;
203 colors = (SDL_Color *)safemalloc(sizeof(SDL_Color)*(length+1));
204 for ( i = 0; i < length ; i++ ){
205 temp = (SDL_Color *)SvIV(ST(i+3));
206 colors[i].r = temp->r;
207 colors[i].g = temp->g;
208 colors[i].b = temp->b;
210 RETVAL = SDL_SetPalette(surface, flags, colors, start, length );
217 video_set_gamma(r, g, b)
222 RETVAL = SDL_SetGamma(r,g,b);
228 video_set_gamma_ramp( rt, gt, bt )
233 Uint16 *redtable, *greentable, *bluetable;
234 redtable = av_to_uint16(rt);
235 greentable = av_to_uint16(gt);
236 bluetable = av_to_uint16(bt);
237 RETVAL = SDL_SetGammaRamp(redtable, greentable, bluetable);
238 if( redtable != NULL) { safefree(redtable); }
239 if( greentable != NULL) { safefree(greentable); }
240 if( bluetable != NULL) { safefree(bluetable); }
247 video_map_RGB ( pixel_format, r, g, b )
248 SDL_PixelFormat *pixel_format
253 RETVAL = SDL_MapRGB(pixel_format,r,g,b);
258 video_map_RGBA ( pixel_format, r, g, b, a )
259 SDL_PixelFormat *pixel_format
265 RETVAL = SDL_MapRGB(pixel_format,r,g,b);
270 video_lock_surface ( surface )
273 RETVAL = SDL_LockSurface(surface);
278 video_unlock_surface ( surface )
281 SDL_UnlockSurface(surface);