Commit | Line | Data |
997e38e1 |
1 | #include "EXTERN.h" |
2 | #include "perl.h" |
3 | #include "XSUB.h" |
4 | |
5 | #ifndef aTHX_ |
6 | #define aTHX_ |
7 | #endif |
8 | |
9 | #include <SDL.h> |
10 | |
11 | MODULE = SDL::Palette PACKAGE = SDL::Palette PREFIX = palette_ |
12 | |
13 | =for documentation |
14 | |
15 | SDL_Palette -- Color palette for 8-bit pixel formats |
16 | |
17 | typedef struct{ |
18 | int ncolors; |
19 | SDL_Color *colors |
20 | } SDL_Palette; |
21 | |
22 | =cut |
23 | |
24 | int |
25 | palette_ncolors ( palette ) |
26 | SDL_Palette *palette |
27 | CODE: |
28 | RETVAL = palette->ncolors; |
29 | OUTPUT: |
30 | RETVAL |
31 | |
32 | AV * |
33 | palette_colors ( palette ) |
34 | SDL_Palette *palette |
35 | CODE: |
36 | RETVAL = newAV(); |
37 | int i; |
38 | for(i = 0; i < palette->ncolors; i++) |
39 | { |
40 | |
41 | av_push(RETVAL,newSViv( PTR2IV( palette->colors + i ) ) ); |
42 | |
43 | } |
44 | OUTPUT: |
45 | RETVAL |
46 | |
47 | |
48 | SDL_Color * |
49 | palette_colors_index ( palette, index ) |
50 | SDL_Palette *palette |
51 | int index |
52 | PREINIT: |
53 | char * CLASS = "SDL::Color"; |
54 | CODE: |
55 | RETVAL = (SDL_Color *)(palette->colors + index); |
56 | OUTPUT: |
57 | RETVAL |
58 | |
59 | |
60 | |