comparison chipsetsw/drivers/drv_app/r2d/lcds/D_Sample/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);
25 $g=int($4);
26 $b=int($5);
27 if ($x>$maxx)
28 {
29 $maxx=$x;
30 }
31
32 if ($y>$maxy)
33 {
34 $maxy=$y;
35 }
36
37 $b=$b & 0xFC;
38 $g=$g & 0xFC;
39 $r=$r & 0xFC;
40
41 $value = ($r << 16) | ($g << 8) | $b;
42
43 $data{$x.":".$y}=$value;
44
45
46 }
47 }
48 close(IN);
49
50 $maxx=$maxx+1;
51 $maxy=$maxy+1;
52
53 open(OUT,">$out.c") or die "Cannot create outputfile: $!\n";
54
55 $length=$maxy*$maxx+1;
56
57 print OUT "const UINT32 $out"."[]={\n";
58 print OUT "$maxx,$maxy,$length,\n";
59 for($j=0;$j<$maxy;$j++)
60 {
61 for($i=0;$i<$maxx;$i++)
62 {
63
64
65 $ra= (~$data{$i.":".$j}) & 0x0FFFFFF;
66
67
68 $value=$ra;
69 $result=sprintf "0x%08X",$value;
70 print OUT "$result,\n";
71 }
72 }
73 print OUT "0x0\n";
74 print OUT "};\n";
75 close(OUT);
76
77 #rename "$out.c","E:\\BT\\Drivers\\Common\\R2D\\$out.c"