From 211efea7376371ee755edd2ad03e83ef6eea464e Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 31 Jul 2012 21:16:07 -0700 Subject: Add dithering to gradients Change-Id: Ic1208855bde3a254eca2fd7cef43e0f1318ce419 --- .../src/com/android/test/hwui/GradientStopsActivity.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientStopsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientStopsActivity.java index ed00ecd645fe..a73eab579d12 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientStopsActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientStopsActivity.java @@ -19,6 +19,7 @@ package com.android.test.hwui; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.Shader; @@ -111,6 +112,14 @@ public class GradientStopsActivity extends Activity { canvas.translate(0.0f, 75.0f); canvas.drawRect(0.0f, 0.0f, 768.0f, 50.0f, paint); + + gradient = new LinearGradient(0.0f, 0.0f, 512.0f, 0.0f, + colors, null, Shader.TileMode.CLAMP); + + paint.setShader(gradient); + + canvas.translate(0.0f, 75.0f); + canvas.drawRect(0.0f, 0.0f, 512.0f, 50.0f, paint); } } } -- cgit v1.2.3-59-g8ed1b