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

Side by Side Diff: samples/logo/logo.dart

Issue 11748016: Make ~/, round, ceil, floor, truncate return ints. Remove toInt. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Checked mode fixes. Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:svg'; 6 import 'dart:svg';
7 import 'dart:math' as Math; 7 import 'dart:math' as Math;
8 8
9 class Color { 9 class Color {
10 int hue; 10 int hue;
(...skipping 25 matching lines...) Expand all
36 36
37 double s; 37 double s;
38 if (max == min) { 38 if (max == min) {
39 s = 0.0; 39 s = 0.0;
40 } else if (l < 0.5) { 40 } else if (l < 0.5) {
41 s = d/(2*l); 41 s = d/(2*l);
42 } else { 42 } else {
43 s = d/(2 - 2*l); 43 s = d/(2 - 2*l);
44 } 44 }
45 45
46 return new Color((h.round() % 360).toInt(), s, l); 46 return new Color(h.round() % 360, s, l);
47 } 47 }
48 48
49 factory Color.fromHex(String hex) => new Color.rgb( 49 factory Color.fromHex(String hex) => new Color.rgb(
50 _parseHex(hex.substring(1, 3))/255, 50 _parseHex(hex.substring(1, 3))/255,
51 _parseHex(hex.substring(3, 5))/255, 51 _parseHex(hex.substring(3, 5))/255,
52 _parseHex(hex.substring(5, 7))/255); 52 _parseHex(hex.substring(5, 7))/255);
53 53
54 // This should be in the core library. Issue #233 54 // This should be in the core library. Issue #233
55 static int _parseHex(String hex) { 55 static int _parseHex(String hex) {
56 final codes = hex.charCodes; 56 final codes = hex.charCodes;
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 document.query("input[name=invert]").on.change.add((Event e) { 191 document.query("input[name=invert]").on.change.add((Event e) {
192 InputElement invert = e.target; 192 InputElement invert = e.target;
193 if (invert.checked) { 193 if (invert.checked) {
194 logo.classes = ['inverse']; 194 logo.classes = ['inverse'];
195 } else { 195 } else {
196 logo.classes = []; 196 logo.classes = [];
197 } 197 }
198 }); 198 });
199 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698