#include <SDL.h>
+
+static Uint16* av_to_uint16 (AV* av)
+{
+ int len = av_len(av);
+ if( len != -1)
+ {
+ int i;
+ Uint16* table = (Uint16 *)safemalloc(sizeof(Uint16)*(len));
+ //fprintf( stderr, "Expecting 1,2,5,6 \n Length is %d \n", len);
+ for ( i = 0; i < len+1 ; i++ ){
+ SV ** temp = av_fetch(av,i,0);
+ if( temp != NULL)
+ {
+ table[i] = (Uint16 *) SvIV( *temp ) ;
+ /* fprintf( stderr, "table[%d] = ", i);
+ if (table[i] == NULL) { fprintf ( stderr, " NULL\n"); }
+ else{ fprintf(stderr, " %d \n", table[i]); } */
+ }
+ else { table[i] =0; }
+
+ }
+// warn("Got %d %d %d %d \n", table[0], table[1], table[2], table[3] );
+
+ return table;
+ }
+ return NULL;
+}
+
+
+
MODULE = SDL::Video PACKAGE = SDL::Video PREFIX = video_
=for documentation
float g;
float b;
CODE:
+ RETVAL = -1;
+#ifdef WINDOWS
+ warn( "SDL_SetGamma is unsupported in Windows. ");
+#else
RETVAL = SDL_SetGamma(r,g,b);
-
+#endif
OUTPUT:
RETVAL
+
int
-video_set_gamma_ramp( ... )
+video_set_gamma_ramp( rt, gt, bt )
+ AV* rt;
+ AV* gt;
+ AV* bt;
CODE:
+
+ RETVAL = -1;
+#ifdef WINDOWS
+ warn( "SDL_SetGammaRamp is unsupported in Windows. " );
+#else
Uint16 *redtable, *greentable, *bluetable;
- RETVAL = SDL_SetGammaRamp(NULL, NULL, NULL);
+ redtable = av_to_uint16(rt);
+ greentable = av_to_uint16(gt);
+ bluetable = av_to_uint16(bt);
+ RETVAL = SDL_SetGammaRamp(redtable, greentable, bluetable);
+ if( redtable != NULL) { safefree(redtable); }
+ if( greentable != NULL) { safefree(greentable); }
+ if( bluetable != NULL) { safefree(bluetable); }
+#endif
OUTPUT:
RETVAL