Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: pkg/stm32/lib/lcd.dart

Issue 1996533003: Change framebuffer.clear to use background color (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Review feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | samples/stm32f746g-discovery/disco-light.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library stm32.lcd; 5 library stm32.lcd;
6 6
7 import 'dart:dartino.ffi'; 7 import 'dart:dartino.ffi';
8 8
9 final _lcdHeight = ForeignLibrary.main.lookup('lcd_height'); 9 final _lcdHeight = ForeignLibrary.main.lookup('lcd_height');
10 final _lcdWidth = ForeignLibrary.main.lookup('lcd_width'); 10 final _lcdWidth = ForeignLibrary.main.lookup('lcd_width');
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 /// Align text to the center. 74 /// Align text to the center.
75 center, 75 center,
76 /// Align text to the right. 76 /// Align text to the right.
77 right, 77 right,
78 } 78 }
79 79
80 class FrameBuffer { 80 class FrameBuffer {
81 int get height => _lcdHeight.icall$0(); 81 int get height => _lcdHeight.icall$0();
82 int get width => _lcdWidth.icall$0(); 82 int get width => _lcdWidth.icall$0();
83 83
84 clear([Color color = Color.black]) { 84 Color _backgroundColor = Color.white;
85
86 clear([Color color]) {
87 color ??= _backgroundColor;
85 _lcdClear.icall$1(color.rgb8888); 88 _lcdClear.icall$1(color.rgb8888);
86 } 89 }
87 90
91 set backgroundColor(Color color) {
92 _backgroundColor = color;
93 _lcdSetBackgroundColor.icall$1(color.rgb8888);
94 }
95
88 set foregroundColor(Color color) { 96 set foregroundColor(Color color) {
89 _lcdSetForegroundColor.icall$1(color.rgb8888); 97 _lcdSetForegroundColor.icall$1(color.rgb8888);
90 } 98 }
91 99
92 set backgroundColor(Color color) {
93 _lcdSetBackgroundColor.icall$1(color.rgb8888);
94 }
95
96 Color readPixel(int x, int y) { 100 Color readPixel(int x, int y) {
97 return new Color.fromRgb8888(_lcdReadPixel.icall$2(x, y)); 101 return new Color.fromRgb8888(_lcdReadPixel.icall$2(x, y));
98 } 102 }
99 103
100 void drawPixel(int x, int y, [Color color = Color.white]) { 104 void drawPixel(int x, int y, [Color color = Color.white]) {
101 _lcdDrawPixel.icall$3(x, y, color.rgb8888); 105 _lcdDrawPixel.icall$3(x, y, color.rgb8888);
102 } 106 }
103 107
104 void drawLine(int x1, int y1, int x2, int y2, [Color color = Color.white]) { 108 void drawLine(int x1, int y1, int x2, int y2, [Color color = Color.white]) {
105 _lcdSetForegroundColor.icall$1(color.rgb8888); 109 _lcdSetForegroundColor.icall$1(color.rgb8888);
(...skipping 10 matching lines...) Expand all
116 int alignMode; 120 int alignMode;
117 switch (align) { 121 switch (align) {
118 case TextAlign.left: alignMode = 3; break; 122 case TextAlign.left: alignMode = 3; break;
119 case TextAlign.center: alignMode = 1; break; 123 case TextAlign.center: alignMode = 1; break;
120 case TextAlign.right: alignMode = 2; break; 124 case TextAlign.right: alignMode = 2; break;
121 } 125 }
122 _lcdDisplayString.icall$4(x, y, m, alignMode); 126 _lcdDisplayString.icall$4(x, y, m, alignMode);
123 m.free(); 127 m.free();
124 } 128 }
125 } 129 }
OLDNEW
« no previous file with comments | « no previous file | samples/stm32f746g-discovery/disco-light.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698