Changeset 3774 for trunk/src/host/splash/splashimg.pl
- Timestamp:
- 01/05/08 19:07:00 (5 years ago)
- File:
-
- 1 edited
-
trunk/src/host/splash/splashimg.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/host/splash/splashimg.pl
r3552 r3774 3 3 # splashimg.pl - Convert a 480x640 PNG to a splash screen raw dump 4 4 # 5 # Copyright (C) 2006-200 7by OpenMoko, Inc.5 # Copyright (C) 2006-2008 by OpenMoko, Inc. 6 6 # Written by Werner Almesberger <werner@openmoko.org> 7 7 # All Rights Reserved … … 24 24 25 25 $bpp = 16; 26 $swap_pix = 0; 26 27 27 28 28 29 sub usage 29 30 { 30 print STDERR "usage: $0 [-32] [-pnm] [ System_boot.png]\n";31 print STDERR "usage: $0 [-32] [-pnm] [-swap] [System_boot.png]\n"; 31 32 exit(1); 32 33 } … … 40 41 elsif ($ARGV[0] eq "-pnm") { 41 42 $pnm = 1; 43 shift @ARGV; 44 } 45 elsif ($ARGV[0] eq "-swap") { 46 $swap_pix = 1; 42 47 shift @ARGV; 43 48 } … … 65 70 66 71 for ("red", "grn", "blu") { 67 open(FILE, "noname.$_") || die "noname.$_";68 $f = join("", <FILE>);72 open(FILE, "noname.$_") || die "noname.$_"; 73 $f = join("", <FILE>); 69 74 close FILE; 70 75 unlink("noname.$_"); 71 76 $f =~ s/^P5\s+(\d+)\s+(\d+)\s+(\d+)\s//s; 72 ($w, $h,$p) = ($1,$2,$3);77 ($w, $h, $p) = ($1, $2, $3); 73 78 $p{$_} = $f; 74 79 } … … 77 82 78 83 for ($i = 0; $i != $w*$h; $i++) { 79 $r = unpack("C", substr($p{"red"},$i,1));80 $g = unpack("C", substr($p{"grn"},$i,1));81 $b = unpack("C", substr($p{"blu"},$i,1));84 $r = unpack("C", substr($p{"red"}, $i ^ $swap_pix, 1)); 85 $g = unpack("C", substr($p{"grn"}, $i ^ $swap_pix, 1)); 86 $b = unpack("C", substr($p{"blu"}, $i ^ $swap_pix, 1)); 82 87 if ($bpp == 16) { 83 88 $v = ($r >> 3) << 11 | ($g >> 2) << 5 | ($b >> 3); 84 print pack("v", $v) || die "print: $!";89 print pack("v", $v) || die "print: $!"; 85 90 } 86 91 else { 87 92 $v = ($r) << 16 | ($g) << 8 | $b; 88 print pack("V", $v) || die "print: $!";93 print pack("V", $v) || die "print: $!"; 89 94 } 90 95 }
Note: See TracChangeset
for help on using the changeset viewer.
