Android Bitmapshader separating the colors of a two-color bitmap

60 views Asked by At

I have created a bitmap that I want to use for a BitmapShader.

The bitmap and the result after using it with a BitmapShader and a paint object looks as follows: Ignore the word 'new game' on the left picture. The bitmap does not have that word in it

enter image description here

I was expecting to get a nice double color border all around. The colors of the bitmap are separated. Why is it doing this?

Here is the code of how I create the paint object and the bitmapshader:

    strokePaint = new Paint();
    strokePaint.setAntiAlias(true);
    strokePaint.setStyle(Paint.Style.STROKE);
    strokePaint.setStrokeWidth(21f);
    strokePaint.setStrokeCap(Paint.Cap.ROUND);
    strokePaint.setStrokeJoin(Paint.Join.ROUND);

BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
    strokePaint.setShader(shader);
0

There are 0 answers