1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4 #include "ppport.h"
5 #include "helper.h"
6 
7 #ifndef aTHX_
8 #define aTHX_
9 #endif
10 
11 #include <SDL.h>
12 
13 MODULE = SDL::Color 	PACKAGE = SDL::Color    PREFIX = color_
14 
15 =for documentation
16 
17 SDL_Color -- Format independent color description
18 
19   typedef struct{
20     Uint8 r;
21     Uint8 g;
22     Uint8 b;
23     Uint8 unused;
24   } SDL_Color;
25 
26 =cut
27 
28 SDL_Color *
29 color_new (CLASS, r, g, b )
30 	char* CLASS
31 	Uint8 r
32 	Uint8 g
33 	Uint8 b
34 	CODE:
35 		RETVAL = (SDL_Color *) safemalloc(sizeof(SDL_Color));
36 		RETVAL->r = r;
37 		RETVAL->g = g;
38 		RETVAL->b = b;
39 	OUTPUT:
40 		RETVAL
41 
42 Uint8
43 color_r ( color, ... )
44 	SDL_Color *color
45 	CODE:
46 		if (items > 1 ) color->r = SvIV(ST(1));
47 		RETVAL = color->r;
48 	OUTPUT:
49 		RETVAL
50 
51 Uint8
52 color_g ( color, ... )
53 	SDL_Color *color
54 	CODE:
55 		if (items > 1 ) color->g = SvIV(ST(1));
56 		RETVAL = color->g;
57 	OUTPUT:
58 		RETVAL
59 
60 Uint8
61 color_b ( color, ... )
62 	SDL_Color *color
63 	CODE:
64 		if (items > 1 ) color->b = SvIV(ST(1));
65 		RETVAL = color->b;
66 	OUTPUT:
67 		RETVAL
68 
69 void
70 color_DESTROY ( bag )
71 	SV *bag
72 	CODE:
73 		objDESTROY(bag, safefree);
74