Java – Change RadialGradient, gradient position?

Change RadialGradient, gradient position?… here is a solution to the problem.

Change RadialGradient, gradient position?

Here are the pictures I need:

http://imgur.com/prXA5
I need to go from 1 to 2 and it must be a program without XML.

//Create transparent circle
RadialGradient gradient = new android.graphics.RadialGradient(newBitmap.getWidth() /     2,newBitmap.getHeight() / 2, newBitmap.getWidth() - newBitmap.getWidth() / 2, 0x00000000, 0xFF000000, android.graphics.Shader.TileMode.CLAMP);

Solution

Figured it out,

//Create transparent circle
    int[] Colors = {0x00000000, 0xFF000000};
    float[] ColorPosition = {0.60f, 0.99f};
    RadialGradient gradient = new android.graphics.RadialGradient(newBitmap.getWidth() / 2,newBitmap.getHeight() / 2, newBitmap.getWidth() - newBitmap.getWidth() /2, Colors, ColorPosition, android.graphics.Shader.TileMode.CLAMP);

where the color position

is the percentage position of the color above (there can be many).

Related Problems and Solutions