diff options
Diffstat (limited to 'tools')
7 files changed, 14 insertions, 7 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader.java index 6453fdb..ad3974c 100644 --- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader.java +++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader.java @@ -41,7 +41,7 @@ public class BitmapShader extends Shader { } @Override - Paint getPaint() { + Paint getJavaPaint() { return null; } } diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas.java b/tools/layoutlib/bridge/src/android/graphics/Canvas.java index 9851ae3..9f4dfd0 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Canvas.java +++ b/tools/layoutlib/bridge/src/android/graphics/Canvas.java @@ -126,7 +126,7 @@ public class Canvas extends _Original_Canvas { Shader shader = paint.getShader(); if (shader != null) { - java.awt.Paint shaderPaint = shader.getPaint(); + java.awt.Paint shaderPaint = shader.getJavaPaint(); if (shaderPaint != null) { g.setPaint(shaderPaint); } else { diff --git a/tools/layoutlib/bridge/src/android/graphics/ComposeShader.java b/tools/layoutlib/bridge/src/android/graphics/ComposeShader.java index df1101d..863d64a 100644 --- a/tools/layoutlib/bridge/src/android/graphics/ComposeShader.java +++ b/tools/layoutlib/bridge/src/android/graphics/ComposeShader.java @@ -46,7 +46,7 @@ public class ComposeShader extends Shader { } @Override - Paint getPaint() { + Paint getJavaPaint() { return null; } } diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient.java index ea9eae9..7cb8f26 100644 --- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient.java +++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient.java @@ -48,6 +48,8 @@ public class LinearGradient extends Shader { // FIXME implement multi color linear gradient if (colors.length == 2) { + // The hasAlpha flag in Color() is only used to enforce alpha to 0xFF if false. + // If true the alpha is read from the int. mGradientPaint = new GradientPaint(x0, y0, new Color(colors[0], true /* hasalpha */), x1, y1, new Color(colors[1], true /* hasalpha */), tile != TileMode.CLAMP); } @@ -66,6 +68,8 @@ public class LinearGradient extends Shader { */ public LinearGradient(float x0, float y0, float x1, float y1, int color0, int color1, TileMode tile) { + // The hasAlpha flag in Color() is only used to enforce alpha to 0xFF if false. + // If true the alpha is read from the int. mGradientPaint = new GradientPaint(x0, y0, new Color(color0, true /* hasalpha */), x1, y1, new Color(color1, true /* hasalpha */), tile != TileMode.CLAMP); } @@ -73,7 +77,7 @@ public class LinearGradient extends Shader { // ---------- Custom Methods @Override - public Paint getPaint() { + public Paint getJavaPaint() { return mGradientPaint; } } diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient.java index e7c1828..13848c5 100644 --- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient.java +++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient.java @@ -62,7 +62,7 @@ public class RadialGradient extends Shader { } @Override - Paint getPaint() { + Paint getJavaPaint() { // TODO Auto-generated method stub return null; } diff --git a/tools/layoutlib/bridge/src/android/graphics/Shader.java b/tools/layoutlib/bridge/src/android/graphics/Shader.java index d14db9c..0cc5940 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Shader.java +++ b/tools/layoutlib/bridge/src/android/graphics/Shader.java @@ -76,5 +76,8 @@ public abstract class Shader { } } - abstract java.awt.Paint getPaint(); + /** + * Returns a java.awt.Paint object matching this shader. + */ + abstract java.awt.Paint getJavaPaint(); } diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient.java index 64a5f5a..21d8244 100644 --- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient.java +++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient.java @@ -60,7 +60,7 @@ public class SweepGradient extends Shader { } @Override - Paint getPaint() { + Paint getJavaPaint() { // TODO Auto-generated method stub return null; } |