1

I have created a shape with multiple paths on a canvas and now I want to fill that shape with a color, I tried using paint.setStyle(Paint.Style.FILL); but that only seems to fill the paths separately, my question is how to fill the whole shape.

Here is the code I use:

Bitmap output = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);

Canvas outputCanvas = new Canvas(output);

Paint outputPaint = new Paint(Paint.DITHER_FLAG);
outputPaint.setColor(0XFF000000);
outputPaint.setStyle(Paint.Style.FILL);

outputCanvas.setMatrix(matrix);

for(Path p : paths) {
    allPaths.addPath(p);
    allPaths.close();
}
outputCanvas.drawPath(allPaths, outputPaint);

for(RectF rectangle : rectangles) {
    outputCanvas.drawRect(rectangle, outputPaint);
}

Thanks in advance!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
smovie9
  • 788
  • 1
  • 8
  • 16

0 Answers0