Android BitmapShader change color

android, bitmap, shader

Solution

The color you are getting converted to hex is: FFFFFFFFF206FCAD. So youst need to get rid of the 8 leading Fs:

int color = -234423123;//0xFFFFFFFFF206FCAD
int myColor = 0x00000000FFFFFFFF & color;

myColor should be ok.

Problem

I need a little help with the thing that I want to achieve. I'm using `BitmapShader` in my application to draw on a canvas. I'm setting a custom png file as shader to my paint variable and I want to change the color of shader. Here is an example code which I'm using : ``` Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.particle_point); BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); mPaint.setShader(shader); ColorFilter filter = new LightingColorFilter(0xFFFFFFFF , 0x000000FF ); mPaint.setColorFilter(filter); ``` I find that I can change it's color by using : `ColorFilter filter = new LightingColorFilter(0xFFFFFFFF , 0x000000FF );` , but I need to be able to change it's color by using a custom color picker,which returns color code similar to this : `-234423123`. So is there any way that I can use this color code and set it as color to my paint variable. Thanks in advance!

Original source