@@ -7,11 +7,40 @@ final boxPixels = [
7
7
for (int y = 0 ; y <= 7 ; y++ ) Pixel (7 , y, 0xFFFFFF ),
8
8
];
9
9
10
+ final flutterLightBlue = 0x0000FF ;
11
+ final flutterMediumBlue = 0x3333FF ;
12
+ final flutterDarkBlue = 0x6666FF ;
13
+
14
+ final flutterLogo = [
15
+ Pixel (0 , 3 , flutterLightBlue),
16
+ Pixel (0 , 4 , flutterLightBlue),
17
+ Pixel (1 , 2 , flutterLightBlue),
18
+ Pixel (1 , 3 , flutterLightBlue),
19
+ Pixel (2 , 1 , flutterLightBlue),
20
+ Pixel (2 , 2 , flutterLightBlue),
21
+ Pixel (3 , 0 , flutterLightBlue),
22
+ Pixel (3 , 1 , flutterLightBlue),
23
+ Pixel (3 , 3 , flutterLightBlue),
24
+ Pixel (3 , 4 , flutterLightBlue),
25
+ Pixel (4 , 0 , flutterLightBlue),
26
+ Pixel (4 , 1 , flutterLightBlue),
27
+ Pixel (4 , 3 , flutterLightBlue),
28
+ Pixel (4 , 4 , flutterLightBlue),
29
+ Pixel (5 , 1 , flutterMediumBlue),
30
+ Pixel (5 , 2 , flutterMediumBlue),
31
+ Pixel (5 , 3 , flutterMediumBlue),
32
+ Pixel (6 , 2 , flutterDarkBlue),
33
+ Pixel (6 , 3 , flutterDarkBlue),
34
+ Pixel (7 , 3 , flutterDarkBlue),
35
+ Pixel (7 , 4 , flutterDarkBlue),
36
+ ];
37
+
10
38
main () {
11
39
// Zero out the test device file
12
40
//File('test.bin').writeAsBytes(List.generate(64 * 2, (i) => 0));
13
41
final buffer = FrameBuffer ('test.bin' );
14
- buffer.setPixels (boxPixels);
42
+ buffer.resetPixels ();
43
+ buffer.setPixels (flutterLogo);
15
44
// buffer.setPixel(1, 7, 255, 255, 255);
16
45
}
17
46
@@ -29,9 +58,13 @@ class FrameBuffer {
29
58
writer.closeSync ();
30
59
}
31
60
61
+ void resetPixels () async {
62
+ await setPixels (List .generate (64 , (i) => Pixel (i % 8 , (i ~ / 8 ), 0x000000 )));
63
+ }
64
+
32
65
void _setPixel (Pixel pixel, RandomAccessFile deviceFile) {
33
66
final bytes = _createColourBytes (pixel.rgb);
34
- deviceFile.setPositionSync (((pixel.y * 8 ) + pixel.x ) * 2 );
67
+ deviceFile.setPositionSync (((pixel.x * 8 ) + pixel.y ) * 2 );
35
68
deviceFile.writeFromSync ([upperByte (bytes), lowerByte (bytes)]);
36
69
}
37
70
0 commit comments