comparison src/video/sdlgenblit.pl @ 2800:8969da2ef606

Added ARGB8888 destination format (used on Mac OS X)
author Sam Lantinga <slouken@libsdl.org>
date Sat, 29 Nov 2008 00:08:29 +0000
parents c785543d1843
children 99210400e8b9
comparison
equal deleted inserted replaced
2799:bbf3aac2672a 2800:8969da2ef606
36 "BGRA8888", 36 "BGRA8888",
37 ); 37 );
38 my @dst_formats = ( 38 my @dst_formats = (
39 "RGB888", 39 "RGB888",
40 "BGR888", 40 "BGR888",
41 "ARGB8888",
41 ); 42 );
42 43
43 my %format_size = ( 44 my %format_size = (
44 "RGB888" => 4, 45 "RGB888" => 4,
45 "BGR888" => 4, 46 "BGR888" => 4,
58 "BGRA8888" => "Uint32", 59 "BGRA8888" => "Uint32",
59 ); 60 );
60 61
61 my %get_rgba_string = ( 62 my %get_rgba_string = (
62 "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel; _A = 0xFF;", 63 "RGB888" => "_R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel; _A = 0xFF;",
63 "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", 64 "BGR888" => "_B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel; _A = 0xFF;", "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
64 "ARGB8888" => "_A = (Uint8)(_pixel >> 24); _R = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _B = (Uint8)_pixel;",
65 "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", 65 "RGBA8888" => "_R = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _B = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;",
66 "ABGR8888" => "_A = (Uint8)(_pixel >> 24); _B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;", 66 "ABGR8888" => "_A = (Uint8)(_pixel >> 24); _B = (Uint8)(_pixel >> 16); _G = (Uint8)(_pixel >> 8); _R = (Uint8)_pixel;",
67 "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;", 67 "BGRA8888" => "_B = (Uint8)(_pixel >> 24); _G = (Uint8)(_pixel >> 16); _R = (Uint8)(_pixel >> 8); _A = (Uint8)_pixel;",
68 ); 68 );
69 69
70 my %set_rgba_string = ( 70 my %set_rgba_string = (
71 "RGB888" => "_pixel = ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;", 71 "RGB888" => "_pixel = ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;",
72 "BGR888" => "_pixel = ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;", 72 "BGR888" => "_pixel = ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;",
73 "ARGB8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_R << 16) | ((Uint32)_G << 8) | _B;",
74 "RGBA8888" => "_pixel = ((Uint32)_R << 24) | ((Uint32)_G << 16) | ((Uint32)_B << 8) | _A;",
75 "ABGR8888" => "_pixel = ((Uint32)_A << 24) | ((Uint32)_B << 16) | ((Uint32)_G << 8) | _R;",
76 "BGRA8888" => "_pixel = ((Uint32)_B << 24) | ((Uint32)_G << 16) | ((Uint32)_R << 8) | _A;",
73 ); 77 );
74 78
75 sub open_file { 79 sub open_file {
76 my $name = shift; 80 my $name = shift;
77 open(FILE, ">$name.new") || die "Cant' open $name.new: $!"; 81 open(FILE, ">$name.new") || die "Cant' open $name.new: $!";