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

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

Issue 1158693005: Add an API to set the ColorFilter on a Paint object. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: abarth Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/platform/graphics/GraphicsTypes.h ('k') | sky/examples/raw/shadow.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/raw/painting.sky
diff --git a/sky/examples/raw/painting.sky b/sky/examples/raw/painting.sky
index e295abd3c6f784ca8c117c5d82492a90a7f43162..fcfa3d56b36c118e1bfa33384f64c37b5c44cbe1 100644
--- a/sky/examples/raw/painting.sky
+++ b/sky/examples/raw/painting.sky
@@ -19,13 +19,13 @@ void main() {
context.save();
- context.clipRect(new Rect()..setLTRB(0.0, 0.0, context.width, radius));
+ context.clipRect(new Rect.fromLTRB(0.0, 0.0, context.width, radius));
context.translate(mid.x, mid.y);
paint.setARGB(128, 255, 0, 255);
context.rotateDegrees(45.0);
- context.drawRect(new Rect()..setLTRB(-radius, -radius, radius, radius),
+ context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius),
paint);
// Scale x and y by 0.5.
@@ -40,18 +40,25 @@ void main() {
context.restore();
+ context.translate(0.0, 50.0);
var builder = new LayerDrawLooperBuilder()
..addLayerOnTop(
- new DrawLooperLayerInfo()..setOffset(150.0, 0.0)..setPaintBits(-1),
+ new DrawLooperLayerInfo()
+ ..setOffset(150.0, 0.0)..setPaintBits(-1)..setColorMode(1),
(Paint layerPaint) {
- // TODO(mpcomplete): This won't do anything until we add support for
- // setting the color filter.
- layerPaint.setARGB(128, 0, 0, 255);
+ layerPaint.setARGB(128, 255, 255, 0);
+ layerPaint.setColorFilter(new ColorFilter(0x770000ff, 5));
})
..addLayerOnTop(
- new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setPaintBits(0),
+ new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setColorMode(1),
(Paint layerPaint) {
layerPaint.setARGB(128, 255, 0, 0);
+ })
+ ..addLayerOnTop(
+ new DrawLooperLayerInfo()..setOffset(225.0, 75.0),
+ (Paint layerPaint) {
+ // Since this layer uses a DST color mode, this has no effect.
+ layerPaint.setARGB(128, 255, 0, 0);
});
paint.setDrawLooper(builder.build());
context.drawCircle(0.0, 0.0, radius, paint);
« no previous file with comments | « sky/engine/platform/graphics/GraphicsTypes.h ('k') | sky/examples/raw/shadow.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698