mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 00:51:29 +00:00
Change bitmap scripts for two-color/two-font text labeling.
Change-Id: I4620966554ca26ea91b01e65fd441c9c09db2a83 BUG=chrome-os-parter:792 TEST=none As with every previous change to the BIOS bitmaps, you'll have to 1) get a new factory-install shim with the bitmaps embedded 2) run the factory-install shim to change the screens on the device 3) boot in developer and/or recovery mode to see the screens There is no direct test for this particular bug alone. Review URL: http://codereview.chromium.org/4158003
This commit is contained in:
@@ -11,12 +11,18 @@
|
||||
# to the full screen size.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
# Require one arg
|
||||
if [ $# -ne "1" ]; then
|
||||
echo "Usage: $(basename $0) URL" 1>&2
|
||||
echo "Usage: $(basename $0) MODEL" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
url=$1
|
||||
MODEL=$1
|
||||
|
||||
# Default URL
|
||||
URL='http://google.com/chromeos/recovery'
|
||||
|
||||
|
||||
# Image parameters
|
||||
@@ -24,8 +30,11 @@ geom_orig='1366x800'
|
||||
geom_crop_a='1366x768'
|
||||
geom_crop_b='1280x800'
|
||||
geom_final='800x600!'
|
||||
font="Helvetica-Narrow"
|
||||
pointsize=30
|
||||
bluecolor='#9ccaec'
|
||||
bluefont="Helvetica-Narrow"
|
||||
bluepointsize=30
|
||||
whitefont="Helvetica-Narrow"
|
||||
whitepointsize=48
|
||||
|
||||
|
||||
# Temporary files
|
||||
@@ -37,6 +46,7 @@ img_crop_b="${tmpdir}/img_crop_b.bmp"
|
||||
img_txt_a="${tmpdir}/img_txt_a.bmp"
|
||||
img_txt_b="${tmpdir}/img_txt_b.bmp"
|
||||
label_file="${tmpdir}/label.txt"
|
||||
label_img="${tmpdir}/label.bmp"
|
||||
|
||||
# Output directories
|
||||
thisdir=$(readlink -e $(dirname $0))
|
||||
@@ -81,18 +91,35 @@ function process_one_file {
|
||||
|
||||
# Add the labels in
|
||||
if [ -r "$txt_file" ]; then
|
||||
# Replace all '$URL' in the URL in the text file with the real url
|
||||
perl -p \
|
||||
-e 'BEGIN {$/ = undef; $url = shift; }' \
|
||||
-e 's/\s+$/\n/gs; s/\$URL/$url/gs;' \
|
||||
"$url" "$txt_file" > "$label_file"
|
||||
# Render it
|
||||
convert "$img_crop_a" -fill white \
|
||||
-font "$font" -pointsize "$pointsize" -interline-spacing 5 \
|
||||
-gravity south -annotate '+0+0' '@'"$label_file" "$img_txt_a"
|
||||
convert "$img_crop_b" -fill white \
|
||||
-font "$font" -pointsize "$pointsize" -interline-spacing 5 \
|
||||
-gravity south -annotate '+0+0' '@'"$label_file" "$img_txt_b"
|
||||
# The only way to change font and color in multiline text is to split each
|
||||
# line into a separate image and then composite them together. Ugh.
|
||||
# First, split each input line into a separate file.
|
||||
"${thisdir}/makelines" -u "$URL" -m "$MODEL" -d "$tmpdir" "$txt_file"
|
||||
# Convert each line file into an image file.
|
||||
for txtfile in ${tmpdir}/linetxt_*; do
|
||||
case "$txtfile" in
|
||||
*.txt)
|
||||
convert \
|
||||
-background "$bg" -fill "$bluecolor" \
|
||||
-font "$bluefont" -pointsize "$bluepointsize" \
|
||||
-bordercolor "$bg" -border 0x1 \
|
||||
label:'@'"$txtfile" "${txtfile%.*}".bmp
|
||||
;;
|
||||
*.TXT)
|
||||
convert \
|
||||
-background "$bg" -fill "white" \
|
||||
-font "$whitefont" -pointsize "$whitepointsize" \
|
||||
-bordercolor "$bg" -border 0x10 \
|
||||
label:'@'"$txtfile" "${txtfile%.*}".bmp
|
||||
;;
|
||||
esac
|
||||
done
|
||||
# Now bash them all together to make one image.
|
||||
convert -background "$bg" -gravity center ${tmpdir}/linetxt_*.bmp \
|
||||
label:'\n\n\n\n' -append "$label_img"
|
||||
# Finally, layer the label image on top of the original.
|
||||
composite "$label_img" -gravity south "$img_crop_a" "$img_txt_a"
|
||||
composite "$label_img" -gravity south "$img_crop_b" "$img_txt_b"
|
||||
else
|
||||
mv "$img_crop_a" "$img_txt_a"
|
||||
mv "$img_crop_b" "$img_txt_b"
|
||||
@@ -110,6 +137,6 @@ for file in originals/*.gif; do
|
||||
done
|
||||
|
||||
# Zip up the bitmaps
|
||||
nicename=${url// /_}
|
||||
nicename=${MODEL// /_}
|
||||
(cd "$outdir_a" && zip -qr "${thisdir}/out_${nicename}__${geom_crop_a}.zip" *)
|
||||
(cd "$outdir_b" && zip -qr "${thisdir}/out_${nicename}__${geom_crop_b}.zip" *)
|
||||
|
||||
41
scripts/bitmaps/makelines
Executable file
41
scripts/bitmaps/makelines
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
our $opt_u = 'http://www.chromium.org';
|
||||
our $opt_m = 'Unsupported Prototype 0000';
|
||||
our $opt_d = '.';
|
||||
|
||||
use File::Basename;
|
||||
my $progdir = dirname($0);
|
||||
my $prog = basename($0);
|
||||
|
||||
use Getopt::Std;
|
||||
my $usage = "
|
||||
Usage: $prog
|
||||
|
||||
";
|
||||
getopts('u:m:d:') or die $usage;
|
||||
|
||||
my @old = glob("$opt_d/linetxt_*");
|
||||
unlink(@old) if @old;
|
||||
|
||||
$/ = undef;
|
||||
$_ = <>;
|
||||
s/\s+$//gs;
|
||||
|
||||
my $count = 1;
|
||||
foreach (split(/\n/, $_))
|
||||
{
|
||||
s/^\s+//;
|
||||
s/\s+$//;
|
||||
s/\$URL/$opt_u/g;
|
||||
s/\$MODEL/$opt_m/g;
|
||||
$_ = ' ' unless $_;
|
||||
my $big = s/^\$BIG:\s*//;
|
||||
my $filename = sprintf('%s/linetxt_%02d.%s', $opt_d, $count++,
|
||||
$big ? 'TXT' : 'txt');
|
||||
# print "$filename: ($_)\n"; next;
|
||||
open(OUT, ">$filename") || die "$0 can't write $filename: $!\n";
|
||||
print OUT "$_";
|
||||
close(OUT);
|
||||
}
|
||||
@@ -1,20 +1,2 @@
|
||||
Chrome OS verification is currently turned OFF.
|
||||
Please turn on verification, or press SPACE to begin recovery.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
http://google.com/chromeos/unverified
|
||||
$URL
|
||||
Chrome OS verification is turned off.
|
||||
Press space to begin recovery.
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
Please remove all USB and SD devices to begin recovery.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
http://google.com/chromeos/recovery
|
||||
$URL
|
||||
$BIG: $URL
|
||||
Model: $MODEL
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
Chrome OS is missing or damaged. Please connect a recovery device.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
http://google.com/chromeos/recovery
|
||||
$URL
|
||||
Chrome OS is missing or damaged.
|
||||
Please connect a recovery device.
|
||||
$BIG: $URL
|
||||
Model: $MODEL
|
||||
|
||||
@@ -1,20 +1,3 @@
|
||||
The device you inserted does not contain Chrome OS. Try another?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
http://google.com/chromeos/recovery
|
||||
$URL
|
||||
$BIG: $URL
|
||||
Model: $MODEL
|
||||
|
||||
Reference in New Issue
Block a user