Loading tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java +5 −4 Original line number Diff line number Diff line Loading @@ -75,14 +75,14 @@ public class BitmapShader_Delegate extends Shader_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(Bitmap androidBitmap, int shaderTileModeX, int shaderTileModeY) { /*package*/ static long nativeCreate(long nativeMatrix, Bitmap androidBitmap, int shaderTileModeX, int shaderTileModeY) { Bitmap_Delegate bitmap = Bitmap_Delegate.getDelegate(androidBitmap); if (bitmap == null) { return 0; } BitmapShader_Delegate newDelegate = new BitmapShader_Delegate( BitmapShader_Delegate newDelegate = new BitmapShader_Delegate(nativeMatrix, bitmap.getImage(), Shader_Delegate.getTileMode(shaderTileModeX), Shader_Delegate.getTileMode(shaderTileModeY)); Loading @@ -91,8 +91,9 @@ public class BitmapShader_Delegate extends Shader_Delegate { // ---- Private delegate/helper methods ---- private BitmapShader_Delegate(BufferedImage image, private BitmapShader_Delegate(long matrix, BufferedImage image, TileMode tileModeX, TileMode tileModeY) { super(matrix); mJavaPaint = new BitmapShaderPaint(image, tileModeX, tileModeY); } Loading tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java +6 −3 Original line number Diff line number Diff line Loading @@ -63,14 +63,17 @@ public class ComposeShader_Delegate extends Shader_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(long native_shaderA, long native_shaderB, int native_mode) { /*package*/ static long nativeCreate(long nativeMatrix, long native_shaderA, long native_shaderB, int native_mode) { // FIXME not supported yet. ComposeShader_Delegate newDelegate = new ComposeShader_Delegate(); ComposeShader_Delegate newDelegate = new ComposeShader_Delegate(nativeMatrix); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- private ComposeShader_Delegate(long nativeMatrix) { super(nativeMatrix); } } tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java +3 −1 Original line number Diff line number Diff line Loading @@ -41,12 +41,14 @@ public abstract class Gradient_Delegate extends Shader_Delegate { /** * Creates the base shader and do some basic test on the parameters. * * @param nativeMatrix reference to the shader's native transformation matrix * @param colors The colors to be distributed along the gradient line * @param positions May be null. The relative positions [0..1] of each * corresponding color in the colors array. If this is null, the * the colors are distributed evenly along the gradient line. */ protected Gradient_Delegate(int colors[], float positions[]) { protected Gradient_Delegate(long nativeMatrix, int colors[], float positions[]) { super(nativeMatrix); if (colors.length < 2) { throw new IllegalArgumentException("needs >= 2 number of colors"); } Loading tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java +10 −10 Original line number Diff line number Diff line Loading @@ -56,21 +56,20 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate1(LinearGradient thisGradient, /*package*/ static long nativeCreate1(LinearGradient thisGradient, long matrix, float x0, float y0, float x1, float y1, int colors[], float positions[], int tileMode) { LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(x0, y0, x1, y1, colors, positions, Shader_Delegate.getTileMode(tileMode)); LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(matrix, x0, y0, x1, y1, colors, positions, Shader_Delegate.getTileMode(tileMode)); return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static long nativeCreate2(LinearGradient thisGradient, /*package*/ static long nativeCreate2(LinearGradient thisGradient, long matrix, float x0, float y0, float x1, float y1, int color0, int color1, int tileMode) { return nativeCreate1(thisGradient, x0, y0, x1, y1, new int[] { color0, color1}, null /*positions*/, tileMode); return nativeCreate1(thisGradient, matrix, x0, y0, x1, y1, new int[] { color0, color1}, null /*positions*/, tileMode); } // ---- Private delegate/helper methods ---- Loading @@ -78,6 +77,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { /** * Create a shader that draws a linear gradient along a line. * * @param nativeMatrix reference to the shader's native transformation matrix * @param x0 The x-coordinate for the start of the gradient line * @param y0 The y-coordinate for the start of the gradient line * @param x1 The x-coordinate for the end of the gradient line Loading @@ -88,9 +88,9 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { * the colors are distributed evenly along the gradient line. * @param tile The Shader tiling mode */ private LinearGradient_Delegate(float x0, float y0, float x1, float y1, int colors[], float positions[], TileMode tile) { super(colors, positions); private LinearGradient_Delegate(long nativeMatrix, float x0, float y0, float x1, float y1, int colors[], float positions[], TileMode tile) { super(nativeMatrix, colors, positions); mJavaPaint = new LinearGradientPaint(x0, y0, x1, y1, mColors, mPositions, tile); } Loading tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java +9 −8 Original line number Diff line number Diff line Loading @@ -56,18 +56,18 @@ public class RadialGradient_Delegate extends Gradient_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate1(float x, float y, float radius, /*package*/ static long nativeCreate1(long matrix, float x, float y, float radius, int colors[], float positions[], int tileMode) { RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(x, y, radius, RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(matrix, x, y, radius, colors, positions, Shader_Delegate.getTileMode(tileMode)); return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static long nativeCreate2(float x, float y, float radius, /*package*/ static long nativeCreate2(long matrix, float x, float y, float radius, int color0, int color1, int tileMode) { return nativeCreate1(x, y, radius, new int[] { color0, color1 }, null /*positions*/, tileMode); return nativeCreate1(matrix, x, y, radius, new int[] { color0, color1 }, null /*positions*/, tileMode); } // ---- Private delegate/helper methods ---- Loading @@ -75,6 +75,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { /** * Create a shader that draws a radial gradient given the center and radius. * * @param nativeMatrix reference to the shader's native transformation matrix * @param x The x-coordinate of the center of the radius * @param y The y-coordinate of the center of the radius * @param radius Must be positive. The radius of the circle for this Loading @@ -86,9 +87,9 @@ public class RadialGradient_Delegate extends Gradient_Delegate { * distributed evenly between the center and edge of the circle. * @param tile The Shader tiling mode */ private RadialGradient_Delegate(float x, float y, float radius, int colors[], float positions[], TileMode tile) { super(colors, positions); private RadialGradient_Delegate(long nativeMatrix, float x, float y, float radius, int colors[], float positions[], TileMode tile) { super(nativeMatrix, colors, positions); mJavaPaint = new RadialGradientPaint(x, y, radius, mColors, mPositions, tile); } Loading Loading
tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java +5 −4 Original line number Diff line number Diff line Loading @@ -75,14 +75,14 @@ public class BitmapShader_Delegate extends Shader_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(Bitmap androidBitmap, int shaderTileModeX, int shaderTileModeY) { /*package*/ static long nativeCreate(long nativeMatrix, Bitmap androidBitmap, int shaderTileModeX, int shaderTileModeY) { Bitmap_Delegate bitmap = Bitmap_Delegate.getDelegate(androidBitmap); if (bitmap == null) { return 0; } BitmapShader_Delegate newDelegate = new BitmapShader_Delegate( BitmapShader_Delegate newDelegate = new BitmapShader_Delegate(nativeMatrix, bitmap.getImage(), Shader_Delegate.getTileMode(shaderTileModeX), Shader_Delegate.getTileMode(shaderTileModeY)); Loading @@ -91,8 +91,9 @@ public class BitmapShader_Delegate extends Shader_Delegate { // ---- Private delegate/helper methods ---- private BitmapShader_Delegate(BufferedImage image, private BitmapShader_Delegate(long matrix, BufferedImage image, TileMode tileModeX, TileMode tileModeY) { super(matrix); mJavaPaint = new BitmapShaderPaint(image, tileModeX, tileModeY); } Loading
tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java +6 −3 Original line number Diff line number Diff line Loading @@ -63,14 +63,17 @@ public class ComposeShader_Delegate extends Shader_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(long native_shaderA, long native_shaderB, int native_mode) { /*package*/ static long nativeCreate(long nativeMatrix, long native_shaderA, long native_shaderB, int native_mode) { // FIXME not supported yet. ComposeShader_Delegate newDelegate = new ComposeShader_Delegate(); ComposeShader_Delegate newDelegate = new ComposeShader_Delegate(nativeMatrix); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- private ComposeShader_Delegate(long nativeMatrix) { super(nativeMatrix); } }
tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java +3 −1 Original line number Diff line number Diff line Loading @@ -41,12 +41,14 @@ public abstract class Gradient_Delegate extends Shader_Delegate { /** * Creates the base shader and do some basic test on the parameters. * * @param nativeMatrix reference to the shader's native transformation matrix * @param colors The colors to be distributed along the gradient line * @param positions May be null. The relative positions [0..1] of each * corresponding color in the colors array. If this is null, the * the colors are distributed evenly along the gradient line. */ protected Gradient_Delegate(int colors[], float positions[]) { protected Gradient_Delegate(long nativeMatrix, int colors[], float positions[]) { super(nativeMatrix); if (colors.length < 2) { throw new IllegalArgumentException("needs >= 2 number of colors"); } Loading
tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java +10 −10 Original line number Diff line number Diff line Loading @@ -56,21 +56,20 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate1(LinearGradient thisGradient, /*package*/ static long nativeCreate1(LinearGradient thisGradient, long matrix, float x0, float y0, float x1, float y1, int colors[], float positions[], int tileMode) { LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(x0, y0, x1, y1, colors, positions, Shader_Delegate.getTileMode(tileMode)); LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(matrix, x0, y0, x1, y1, colors, positions, Shader_Delegate.getTileMode(tileMode)); return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static long nativeCreate2(LinearGradient thisGradient, /*package*/ static long nativeCreate2(LinearGradient thisGradient, long matrix, float x0, float y0, float x1, float y1, int color0, int color1, int tileMode) { return nativeCreate1(thisGradient, x0, y0, x1, y1, new int[] { color0, color1}, null /*positions*/, tileMode); return nativeCreate1(thisGradient, matrix, x0, y0, x1, y1, new int[] { color0, color1}, null /*positions*/, tileMode); } // ---- Private delegate/helper methods ---- Loading @@ -78,6 +77,7 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { /** * Create a shader that draws a linear gradient along a line. * * @param nativeMatrix reference to the shader's native transformation matrix * @param x0 The x-coordinate for the start of the gradient line * @param y0 The y-coordinate for the start of the gradient line * @param x1 The x-coordinate for the end of the gradient line Loading @@ -88,9 +88,9 @@ public final class LinearGradient_Delegate extends Gradient_Delegate { * the colors are distributed evenly along the gradient line. * @param tile The Shader tiling mode */ private LinearGradient_Delegate(float x0, float y0, float x1, float y1, int colors[], float positions[], TileMode tile) { super(colors, positions); private LinearGradient_Delegate(long nativeMatrix, float x0, float y0, float x1, float y1, int colors[], float positions[], TileMode tile) { super(nativeMatrix, colors, positions); mJavaPaint = new LinearGradientPaint(x0, y0, x1, y1, mColors, mPositions, tile); } Loading
tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java +9 −8 Original line number Diff line number Diff line Loading @@ -56,18 +56,18 @@ public class RadialGradient_Delegate extends Gradient_Delegate { // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate1(float x, float y, float radius, /*package*/ static long nativeCreate1(long matrix, float x, float y, float radius, int colors[], float positions[], int tileMode) { RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(x, y, radius, RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(matrix, x, y, radius, colors, positions, Shader_Delegate.getTileMode(tileMode)); return sManager.addNewDelegate(newDelegate); } @LayoutlibDelegate /*package*/ static long nativeCreate2(float x, float y, float radius, /*package*/ static long nativeCreate2(long matrix, float x, float y, float radius, int color0, int color1, int tileMode) { return nativeCreate1(x, y, radius, new int[] { color0, color1 }, null /*positions*/, tileMode); return nativeCreate1(matrix, x, y, radius, new int[] { color0, color1 }, null /*positions*/, tileMode); } // ---- Private delegate/helper methods ---- Loading @@ -75,6 +75,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { /** * Create a shader that draws a radial gradient given the center and radius. * * @param nativeMatrix reference to the shader's native transformation matrix * @param x The x-coordinate of the center of the radius * @param y The y-coordinate of the center of the radius * @param radius Must be positive. The radius of the circle for this Loading @@ -86,9 +87,9 @@ public class RadialGradient_Delegate extends Gradient_Delegate { * distributed evenly between the center and edge of the circle. * @param tile The Shader tiling mode */ private RadialGradient_Delegate(float x, float y, float radius, int colors[], float positions[], TileMode tile) { super(colors, positions); private RadialGradient_Delegate(long nativeMatrix, float x, float y, float radius, int colors[], float positions[], TileMode tile) { super(nativeMatrix, colors, positions); mJavaPaint = new RadialGradientPaint(x, y, radius, mColors, mPositions, tile); } Loading