2

I am trying to develop applications for children. They will match objects with their own shadows. It's not grayscale. I want to make it completely black.

I tried the codes here. I tried changing some codes, but it wasn't successful.

Android : Converting color image to grayscale

public Bitmap onlyBlack(Bitmap bmpOriginal)
{
    int width, height;
    height = bmpOriginal.getHeight();
    width = bmpOriginal.getWidth();

    Bitmap bmpBlack = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
    Canvas c = new Canvas(bmpBlack);
    Paint paint = new Paint();

    float blck = 0;
    float[] mat = new float[]{
            blck, blck, blck, 0, 0,
            blck, blck, blck, 0, 0,
            blck, blck, blck, 0, 0,
            0, 0, 0, 0, 0,};
    ColorMatrixColorFilter filter = new ColorMatrixColorFilter(mat);
    paint.setColorFilter(filter);

    c.drawBitmap(bmpOriginal, 0, 0, paint);
    return bmpBlack;
}

I've done color in zero. But the colorless places in the picture are black.

How can I make a shadow appearance of a picture without a background?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Mahmut K.
  • 707
  • 1
  • 8
  • 20

0 Answers0