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

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

Issue 12317107: ceil/floor/truncate/round return integers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload due to error3 Created 7 years, 9 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
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | samples/solar3d/web/solar.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) 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 static int _parseHex(String hex) { 54 static int _parseHex(String hex) {
55 return int.parse(hex, radix: 16); 55 return int.parse(hex, radix: 16);
56 } 56 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 document.query("input[name=invert]").onChange.listen((Event e) { 175 document.query("input[name=invert]").onChange.listen((Event e) {
176 InputElement invert = e.target; 176 InputElement invert = e.target;
177 if (invert.checked) { 177 if (invert.checked) {
178 logo.classes = ['inverse']; 178 logo.classes = ['inverse'];
179 } else { 179 } else {
180 logo.classes = []; 180 logo.classes = [];
181 } 181 }
182 }); 182 });
183 } 183 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | samples/solar3d/web/solar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698