FreeCalypso > hg > tcs211-pirelli
comparison chipsetsw/drivers/drv_app/r2d/lcds/ColorPC/Demo/tor2d.pl @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 #!perl | |
2 | |
3 $in=$ARGV[0]; | |
4 $out=$ARGV[1]; | |
5 | |
6 $nin = $in; | |
7 | |
8 $nin =~ s/\..*$/.txt/; | |
9 | |
10 #print "->$nin"; | |
11 | |
12 print "convert $in TEXT:$nin\n"; | |
13 system("convert $in TEXT:$nin"); | |
14 | |
15 $maxx=0; | |
16 $maxy=0; | |
17 open(IN,$nin) or die "Cannot read input file:$! \n"; | |
18 while($line=<IN>) | |
19 { | |
20 if ($line =~ /^([0-9]+),([0-9]+):[\s\t]*([0-9]+),([0-9]+),([0-9]+)[\s\t]*.*$/) | |
21 { | |
22 $x=int($1); | |
23 $y=int($2); | |
24 $r=(int($3)>>8) & 0x0FF; | |
25 $g=(int($4)>>8) & 0x0FF; | |
26 $b=(int($5)>>8) & 0x0FF; | |
27 if ($x>$maxx) | |
28 { | |
29 $maxx=$x; | |
30 } | |
31 | |
32 if ($y>$maxy) | |
33 { | |
34 $maxy=$y; | |
35 } | |
36 | |
37 | |
38 $value = ($r << 16) | ($g << 8) | $b; | |
39 | |
40 $data{$x.":".$y}=$value; | |
41 | |
42 | |
43 } | |
44 } | |
45 close(IN); | |
46 | |
47 $maxx=$maxx+1; | |
48 $maxy=$maxy+1; | |
49 | |
50 open(OUT,">$out.c") or die "Cannot create outputfile: $!\n"; | |
51 | |
52 $length=$maxy*$maxx; | |
53 | |
54 print OUT "const UINT32 $out"."[]={\n"; | |
55 print OUT "$maxx,$maxy,$length,\n"; | |
56 for($j=0;$j<$maxy;$j++) | |
57 { | |
58 for($i=0;$i<$maxx;$i++) | |
59 { | |
60 | |
61 $x=$i; | |
62 | |
63 if (exists $data{$i.":".$j}) | |
64 { | |
65 $ra= ($data{$i.":".$j}) & 0x0FFFFFF; | |
66 } | |
67 else | |
68 { | |
69 $ra=0x0000; | |
70 } | |
71 | |
72 | |
73 $value=$ra; | |
74 $result=sprintf "0x%08X",$value; | |
75 print OUT "$result,\n"; | |
76 } | |
77 } | |
78 print OUT "0x0\n"; | |
79 print OUT "};\n"; | |
80 close(OUT); | |
81 | |
82 #rename "$out.c","E:\\BT\\Drivers\\Common\\R2D\\$out.c" |