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::PixelFormat 	PACKAGE = SDL::PixelFormat    PREFIX = pixelformat_
14 
15 =for documentation
16 
17 SDL_PixelFormat -- Stores surface format information
18 
19   typedef struct SDL_PixelFormat {
20     SDL_Palette *palette;
21     Uint8  BitsPerPixel;
22     Uint8  BytesPerPixel;
23     Uint8  Rloss, Gloss, Bloss, Aloss;
24     Uint8  Rshift, Gshift, Bshift, Ashift;
25     Uint32 Rmask, Gmask, Bmask, Amask;
26     Uint32 colorkey;
27     Uint8  alpha;
28   } SDL_PixelFormat;
29 
30 =cut
31 
32 SV *
33 pixelformat_palette( pixelformat )
34 	SDL_PixelFormat *pixelformat
35 	PREINIT:
36 		char* CLASS = "SDL::Palette";
37 	CODE:
38 		if(pixelformat->palette)
39 			RETVAL = cpy2bag( pixelformat->palette, sizeof(SDL_Palette *), sizeof(SDL_Palette), "SDL::Palette" );
40 		else
41 			XSRETURN_UNDEF;
42 	OUTPUT:
43 		RETVAL
44 
45 
46 Uint8
47 pixelformat_BitsPerPixel( pixelformat )
48 	SDL_PixelFormat *pixelformat
49 	CODE:
50 		RETVAL = pixelformat->BitsPerPixel;
51 	OUTPUT:
52 		RETVAL
53 
54 Uint8
55 pixelformat_BytesPerPixel( pixelformat )
56 	SDL_PixelFormat *pixelformat
57 	CODE:
58 		RETVAL = pixelformat->BytesPerPixel;
59 	OUTPUT:
60 		RETVAL
61 
62 Uint8
63 pixelformat_Rloss( pixelformat )
64 	SDL_PixelFormat *pixelformat
65 	CODE:
66 		RETVAL = pixelformat->Rloss;
67 	OUTPUT:
68 		RETVAL
69 
70 Uint8
71 pixelformat_Bloss( pixelformat )
72 	SDL_PixelFormat *pixelformat
73 	CODE:
74 		RETVAL = pixelformat->Bloss;
75 	OUTPUT:
76 		RETVAL
77 
78 Uint8
79 pixelformat_Gloss( pixelformat )
80 	SDL_PixelFormat *pixelformat
81 	CODE:
82 		RETVAL = pixelformat->Gloss;
83 	OUTPUT:
84 		RETVAL
85 
86 Uint8
87 pixelformat_Aloss( pixelformat )
88 	SDL_PixelFormat *pixelformat
89 	CODE:
90 		RETVAL = pixelformat->Aloss;
91 	OUTPUT:
92 		RETVAL
93 
94 Uint8
95 pixelformat_Rshift( pixelformat )
96 	SDL_PixelFormat *pixelformat
97 	CODE:
98 		RETVAL = pixelformat->Rshift;
99 	OUTPUT:
100 		RETVAL
101 
102 Uint8
103 pixelformat_Bshift( pixelformat )
104 	SDL_PixelFormat *pixelformat
105 	CODE:
106 		RETVAL = pixelformat->Bshift;
107 	OUTPUT:
108 		RETVAL
109 
110 Uint8
111 pixelformat_Gshift( pixelformat )
112 	SDL_PixelFormat *pixelformat
113 	CODE:
114 		RETVAL = pixelformat->Gshift;
115 	OUTPUT:
116 		RETVAL
117 
118 Uint8
119 pixelformat_Ashift( pixelformat )
120 	SDL_PixelFormat *pixelformat
121 	CODE:
122 		RETVAL = pixelformat->Ashift;
123 	OUTPUT:
124 		RETVAL
125 
126 Uint32
127 pixelformat_Rmask( pixelformat )
128 	SDL_PixelFormat *pixelformat
129 	CODE:
130 		RETVAL = pixelformat->Rmask;
131 	OUTPUT:
132 		RETVAL
133 
134 Uint32
135 pixelformat_Bmask( pixelformat )
136 	SDL_PixelFormat *pixelformat
137 	CODE:
138 		RETVAL = pixelformat->Bmask;
139 	OUTPUT:
140 		RETVAL
141 
142 Uint32
143 pixelformat_Gmask( pixelformat )
144 	SDL_PixelFormat *pixelformat
145 	CODE:
146 		RETVAL = pixelformat->Gmask;
147 	OUTPUT:
148 		RETVAL
149 
150 Uint32
151 pixelformat_Amask( pixelformat )
152 	SDL_PixelFormat *pixelformat
153 	CODE:
154 		RETVAL = pixelformat->Amask;
155 	OUTPUT:
156 		RETVAL
157 
158 Uint32
159 pixelformat_colorkey( pixelformat )
160 	SDL_PixelFormat *pixelformat
161 	CODE:
162 		RETVAL = pixelformat->colorkey;
163 	OUTPUT:
164 		RETVAL
165 
166 Uint8
167 pixelformat_alpha( pixelformat )
168 	SDL_PixelFormat *pixelformat
169 	CODE:
170 		RETVAL = pixelformat->alpha;
171 	OUTPUT:
172 		RETVAL
173 
174 void
175 pixelformat_DESTROY ( bag )
176 	SV *bag
177 	CODE:
178 		objDESTROY(bag, safefree);
179