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

Unified Diff: sky/examples/raw/painting.dart

Issue 1218593002: Move sky/examples to sky/sdk/lib/example, and code changes to support that change. Fixes T277. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: sky/examples/raw/painting.dart
diff --git a/sky/examples/raw/painting.dart b/sky/examples/raw/painting.dart
deleted file mode 100644
index 29d381a8605abe44767781d54f8cb0ecefe9e901..0000000000000000000000000000000000000000
--- a/sky/examples/raw/painting.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-import 'dart:sky' as sky;
-import 'dart:math' as math;
-import 'dart:typed_data';
-
-void beginFrame(double timeStamp) {
- sky.PictureRecorder recorder = new sky.PictureRecorder();
- Canvas canvas = new Canvas(recorder, sky.view.width, 200.0);
-
- sky.Paint paint = new sky.Paint();
- sky.Point mid = new sky.Point(sky.view.width / 2.0, sky.view.height / 2.0);
- double radius = math.min(mid.x, mid.y);
-
- canvas.drawPaint(new sky.Paint()..color = const sky.Color(0xFFFFFFFF));
-
- canvas.save();
-
- canvas.translate(-mid.x/2.0, sky.view.height*2.0);
- canvas.clipRect(
- new sky.Rect.fromLTRB(0.0, -sky.view.height, sky.view.width, radius));
-
- canvas.translate(mid.x, mid.y);
- paint.color = const sky.Color.fromARGB(128, 255, 0, 255);
- canvas.rotate(math.PI/4.0);
-
- sky.Gradient yellowBlue = new sky.Gradient.linear(
- [new sky.Point(-radius, -radius), new sky.Point(0.0, 0.0)],
- [const sky.Color(0xFFFFFF00), const sky.Color(0xFF0000FF)]);
- canvas.drawRect(new sky.Rect.fromLTRB(-radius, -radius, radius, radius),
- new sky.Paint()..setShader(yellowBlue));
-
- // Scale x and y by 0.5.
- var scaleMatrix = new Float32List.fromList([
- 0.5, 0.0, 0.0, 0.0,
- 0.0, 0.5, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 1.0,
- ]);
- canvas.concat(scaleMatrix);
- paint.color = const sky.Color.fromARGB(128, 0, 255, 0);
- canvas.drawCircle(0.0, 0.0, radius, paint);
-
- canvas.restore();
-
- canvas.translate(0.0, 50.0);
- var builder = new sky.LayerDrawLooperBuilder()
- ..addLayerOnTop(
- new sky.DrawLooperLayerInfo()
- ..setOffset(const sky.Point(150.0, 0.0))
- ..setColorMode(sky.TransferMode.src)
- ..setPaintBits(sky.PaintBits.all),
- (sky.Paint layerPaint) {
- layerPaint.color = const sky.Color.fromARGB(128, 255, 255, 0);
- layerPaint.setColorFilter(new sky.ColorFilter.mode(
- const sky.Color.fromARGB(128, 0, 0, 255), sky.TransferMode.srcIn));
- layerPaint.setMaskFilter(new sky.MaskFilter.blur(
- sky.BlurStyle.normal, 3.0, highQuality: true));
- })
- ..addLayerOnTop(
- new sky.DrawLooperLayerInfo()
- ..setOffset(const sky.Point(75.0, 75.0))
- ..setColorMode(sky.TransferMode.src)
- ..setPaintBits(sky.PaintBits.shader),
- (sky.Paint layerPaint) {
- sky.Gradient redYellow = new sky.Gradient.radial(
- new sky.Point(0.0, 0.0), radius/3.0,
- [const sky.Color(0xFFFFFF00), const sky.Color(0xFFFF0000)],
- null, sky.TileMode.mirror);
- layerPaint.setShader(redYellow);
- // Since we're don't set sky.PaintBits.maskFilter, this has no effect.
- layerPaint.setMaskFilter(new sky.MaskFilter.blur(
- sky.BlurStyle.normal, 50.0, highQuality: true));
- })
- ..addLayerOnTop(
- new sky.DrawLooperLayerInfo()..setOffset(const sky.Point(225.0, 75.0)),
- (sky.Paint layerPaint) {
- // Since this layer uses a DST color mode, this has no effect.
- layerPaint.color = const sky.Color.fromARGB(128, 255, 0, 0);
- });
- paint.setDrawLooper(builder.build());
- canvas.drawCircle(0.0, 0.0, radius, paint);
-
- sky.view.picture = recorder.endRecording();
-}
-
-void main() {
- sky.view.setBeginFrameCallback(beginFrame);
- sky.view.scheduleFrame();
-}
« no previous file with comments | « sky/examples/raw/launcher.dart ('k') | sky/examples/raw/pubspec.yaml » ('j') | sky/sdk/README.md » ('J')

Powered by Google App Engine
This is Rietveld 408576698