0

I'm creating a drawing game, and I wanted to integrate a filling function to it.

I tried to do a recursive function which gets the pixel position on my bitmap and give it a color. However the application stops every time, caused by "AndroidRuntime". I want to draw it on a Bitmap, and here you can see my function :

@RequiresApi(api = Build.VERSION_CODES.O)
    public void fill(int x, int y, int couleurDep, int couleurFinal) {
        if(mBitmap.getPixel(x, y) == couleurDep) {
            drawPath.lineTo(x, y);
            fill(x-1, y, couleurDep, couleurFinal);
            fill(x+1, y, couleurDep, couleurFinal);
            fill(x, y+1, couleurDep, couleurFinal);
            fill(x, y-1, couleurDep, couleurFinal);
        }
    }

I want to know if it is possible with bitmaps in Android to do that kind of function. My bitmap's dimensions are 1500 x 1140.

Is it too big ?

3iL
  • 2,146
  • 2
  • 23
  • 47

0 Answers0