Index: sky/examples/raw/painting.sky |
diff --git a/sky/examples/raw/painting.sky b/sky/examples/raw/painting.sky |
deleted file mode 100644 |
index 61e43a9cdcf60974c01a951273ae61fd189f10fa..0000000000000000000000000000000000000000 |
--- a/sky/examples/raw/painting.sky |
+++ /dev/null |
@@ -1,91 +0,0 @@ |
-<sky> |
-<style> |
-div { |
- height: 200px; |
- background-color: lightblue; |
-} |
-</style> |
-<div id="canvas" /> |
-<script> |
-import 'dart:math' as math; |
-import 'dart:typed_data'; |
-import 'dart:sky'; |
- |
-void main() { |
- var element = document.getElementById('canvas'); |
- element.requestPaint((PaintingContext context) { |
- Paint paint = new Paint(); |
- Point mid = new Point(context.width / 2.0, context.height / 2.0); |
- double radius = math.min(mid.x, mid.y); |
- |
- context.save(); |
- |
- context.clipRect(new Rect.fromLTRB(0.0, 0.0, context.width, radius)); |
- |
- context.translate(mid.x, mid.y); |
- paint.color = const Color.fromARGB(128, 255, 0, 255); |
- context.rotate(math.PI/4.0); |
- |
- Gradient yellowBlue = new Gradient.linear( |
- [new Point(-radius, -radius), new Point(0.0, 0.0)], |
- [const Color(0xFFFFFF00), const Color(0xFF0000FF)]); |
- context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius), |
- new 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, |
- ]); |
- context.concat(scaleMatrix); |
- paint.color = const Color.fromARGB(128, 0, 255, 0); |
- context.drawCircle(0.0, 0.0, radius, paint); |
- |
- context.restore(); |
- |
- context.translate(0.0, 50.0); |
- var builder = new LayerDrawLooperBuilder() |
- ..addLayerOnTop( |
- new DrawLooperLayerInfo() |
- ..setOffset(const Point(150.0, 0.0)) |
- ..setColorMode(TransferMode.srcMode) |
- ..setPaintBits(PaintBits.all), |
- (Paint layerPaint) { |
- layerPaint.color = const Color.fromARGB(128, 255, 255, 0); |
- layerPaint.setColorFilter( |
- new ColorFilter.mode(const Color.fromARGB(128, 0, 0, 255), |
- TransferMode.srcInMode)); |
- layerPaint.setMaskFilter( |
- new MaskFilter.blur(BlurStyle.normal, 3.0, highQuality: true)); |
- }) |
- ..addLayerOnTop( |
- new DrawLooperLayerInfo() |
- ..setOffset(const Point(75.0, 75.0)) |
- ..setColorMode(TransferMode.srcMode) |
- ..setPaintBits(PaintBits.shader), |
- (Paint layerPaint) { |
- Gradient redYellow = new Gradient.radial( |
- new Point(0.0, 0.0), radius/3.0, |
- [const Color(0xFFFFFF00), const Color(0xFFFF0000)], |
- null, TileMode.mirror); |
- layerPaint.setShader(redYellow); |
- // Since we're don't set PaintBits.maskFilter, this has no effect. |
- layerPaint.setMaskFilter( |
- new MaskFilter.blur(BlurStyle.normal, 50.0, highQuality: true)); |
- }) |
- ..addLayerOnTop( |
- new DrawLooperLayerInfo()..setOffset(const Point(225.0, 75.0)), |
- (Paint layerPaint) { |
- // Since this layer uses a DST color mode, this has no effect. |
- layerPaint.color = const Color.fromARGB(128, 255, 0, 0); |
- }); |
- paint.setDrawLooper(builder.build()); |
- context.drawCircle(0.0, 0.0, radius, paint); |
- |
- context.commit(); |
- }); |
-} |
-</script> |
-</sky> |