Import coco-planes 0.1.0 upstream source snapshot
Original author: Pierre Sarrazin. Preserve upstream GPLv3-or-later and file-specific notices. Source: http://sarrazip.com/dev/coco-planes-0.1.0.tar.gz Archive SHA-256: 29191e6ba225965caa637ee726e1189639dc7fcdf2b68310fb93fbffd56c9c52
This commit is contained in:
commit
7939132267
78 files changed
+6990
No files matched your search
Executable
+51
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Converts a 128x14 2-color XPM to a C file containing an array
|
||||
# of 32-bit values.
|
||||
|
||||
use strict;
|
||||
|
||||
|
||||
my $blackColorCode;
|
||||
my $whiteColorCode;
|
||||
my $numPixelRows = 0;
|
||||
|
||||
|
||||
print "#include <coco.h>\n";
|
||||
print "const uint32_t titleBitmap[14][8] =\n{\n";
|
||||
|
||||
|
||||
while (<>)
|
||||
{
|
||||
if (/"(.)\s+c\s+#000000"/i) # if black color code line
|
||||
{
|
||||
$blackColorCode = $1;
|
||||
}
|
||||
elsif (/"(.)\s+c\s+#FFFFFF"/i) # if white color code line
|
||||
{
|
||||
$whiteColorCode = $1;
|
||||
}
|
||||
elsif (defined $blackColorCode && defined $whiteColorCode && /"(.*?)"/) # if pixel row
|
||||
{
|
||||
# Only keep the pixels.
|
||||
$_ = $1;
|
||||
die unless length($_) == 128;
|
||||
++$numPixelRows;
|
||||
|
||||
# Change the two codes to 0 and 1.
|
||||
s/\Q$blackColorCode\E/0/g;
|
||||
s/\Q$whiteColorCode\E/1/g;
|
||||
|
||||
# Double each pixel horizontally.
|
||||
s/([01])/$1$1/g;
|
||||
|
||||
# Group strings of 32 bits into a hex value.
|
||||
s/([01]{32})/ sprintf("0x%08x, ", eval "0b$1") /ge;
|
||||
|
||||
print " { $_},\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "};\n";
|
||||
|
||||
die unless $numPixelRows == 14;
|
||||
Reference in new issue
Block a user