Skip to content

Commit

Permalink
Added all the pixel formats enum. Might have to move them later. WIP #2
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rodo committed Aug 11, 2013
1 parent 8d8b1b6 commit 989521b
Show file tree
Hide file tree
Showing 3 changed files with 296 additions and 3 deletions.
40 changes: 40 additions & 0 deletions lib/SDL2/Constants.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,46 @@ our %EXPORT_TAGS = (
SDL_TEXTUREACCESS_STATIC
SDL_TEXTUREACCESS_STREAMING
)
],
'SDL2::Texture/pixelformat' => [
qw(
SDL_PIXELFORMAT_UNKNOWN
SDL_PIXELFORMAT_INDEX1LSB
SDL_PIXELFORMAT_INDEX1MSB
SDL_PIXELFORMAT_INDEX4LSB
SDL_PIXELFORMAT_INDEX4MSB
SDL_PIXELFORMAT_INDEX8
SDL_PIXELFORMAT_RGB332
SDL_PIXELFORMAT_RGB444
SDL_PIXELFORMAT_RGB555
SDL_PIXELFORMAT_BGR555
SDL_PIXELFORMAT_ARGB4444
SDL_PIXELFORMAT_RGBA4444
SDL_PIXELFORMAT_ABGR4444
SDL_PIXELFORMAT_BGRA4444
SDL_PIXELFORMAT_ARGB1555
SDL_PIXELFORMAT_RGBA5551
SDL_PIXELFORMAT_ABGR1555
SDL_PIXELFORMAT_BGRA5551
SDL_PIXELFORMAT_RGB565
SDL_PIXELFORMAT_BGR565
SDL_PIXELFORMAT_RGB24
SDL_PIXELFORMAT_BGR24
SDL_PIXELFORMAT_RGB888
SDL_PIXELFORMAT_RGBX8888
SDL_PIXELFORMAT_BGR888
SDL_PIXELFORMAT_BGRX8888
SDL_PIXELFORMAT_ARGB8888
SDL_PIXELFORMAT_RGBA8888
SDL_PIXELFORMAT_ABGR8888
SDL_PIXELFORMAT_BGRA8888
SDL_PIXELFORMAT_ARGB2101010
SDL_PIXELFORMAT_YV12
SDL_PIXELFORMAT_IYUV
SDL_PIXELFORMAT_YUY2
SDL_PIXELFORMAT_UYVY
SDL_PIXELFORMAT_YVYU
)
]

);
Expand Down
250 changes: 250 additions & 0 deletions src/Core/Constants.xs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,254 @@ constant_SDL_TEXTUREACCESS_STREAMING ( )
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_UNKNOWN ()
CODE:
RETVAL = SDL_PIXELFORMAT_UNKNOWN;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_INDEX1LSB ()
CODE:
RETVAL = SDL_PIXELFORMAT_INDEX1LSB;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_INDEX1MSB ()
CODE:
RETVAL = SDL_PIXELFORMAT_INDEX1MSB;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_INDEX4LSB ()
CODE:
RETVAL = SDL_PIXELFORMAT_INDEX4LSB;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_INDEX4MSB ()
CODE:
RETVAL = SDL_PIXELFORMAT_INDEX4MSB;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_INDEX8 ()
CODE:
RETVAL = SDL_PIXELFORMAT_INDEX8;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB332 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB332;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB444 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB444;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB555 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB555;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGR555 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGR555;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ARGB4444 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ARGB4444;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGBA4444 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGBA4444;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ABGR4444 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ABGR4444;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGRA4444 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGRA4444;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ARGB1555 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ARGB1555;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGBA5551 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGBA5551;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ABGR1555 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ABGR1555;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGRA5551 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGRA5551;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB565 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB565;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGR565 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGR565;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB24 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB24;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGR24 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGR24;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGB888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGB888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGBX8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGBX8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGR888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGR888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGRX8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGRX8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ARGB8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ARGB8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_RGBA8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_RGBA8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ABGR8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ABGR8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_BGRA8888 ()
CODE:
RETVAL = SDL_PIXELFORMAT_BGRA8888;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_ARGB2101010 ()
CODE:
RETVAL = SDL_PIXELFORMAT_ARGB2101010;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_YV12 ()
CODE:
RETVAL = SDL_PIXELFORMAT_YV12;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_IYUV ()
CODE:
RETVAL = SDL_PIXELFORMAT_IYUV;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_YUY2 ()
CODE:
RETVAL = SDL_PIXELFORMAT_YUY2;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_UYVY ()
CODE:
RETVAL = SDL_PIXELFORMAT_UYVY;
OUTPUT:
RETVAL

int
constant_SDL_PIXELFORMAT_YVYU ()
CODE:
RETVAL = SDL_PIXELFORMAT_YVYU;
OUTPUT:
RETVAL
9 changes: 6 additions & 3 deletions t/106_sdl2_texture.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Test::More tests => 2;
use Test::More tests => 3;
use SDL2pp;
use SDL2::Window;
use SDL2::Renderer;
Expand All @@ -22,10 +22,13 @@ my $renderer = SDL2::Renderer->new($win, -1, SDL_RENDERER_SOFTWARE); #Hardware a

can_ok('SDL2::Texture', qw/new/);

my $texture = SDL2::Texture->new($renderer, 0, SDL_TEXTUREACCESS_STATIC, 100, 100);
my $texture = SDL2::Texture->new($renderer, SDL_PIXELFORMAT_RGB332, SDL_TEXTUREACCESS_STATIC, 100, 100);
fail( SDL2pp::get_error() ) unless $texture;
my $texture2 = SDL2::Texture->new($renderer, 0, SDL_TEXTUREACCESS_STREAMING, 100, 100);
my $texture2 = SDL2::Texture->new($renderer, SDL_PIXELFORMAT_RGB565, SDL_TEXTUREACCESS_STREAMING, 100, 100);
fail( SDL2pp::get_error() ) unless $texture2;

isa_ok($texture, 'SDL2::Texture');

isa_ok($texture2, 'SDL2::Texture');


0 comments on commit 989521b

Please sign in to comment.