1

I know we can crop a bitmap in rectangular shape using:

Bitmap.createBitmap(source, x, y, width, height)

But I want to know to crop a bitmap in freehand mode or some polygon shape. Its best example can be seen in Jigsaw Puzzle game

I have spent a lot of time googling about this but found no help. Can anybody help me in this regard?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Khawar Raza
  • 15,870
  • 24
  • 70
  • 127

1 Answers1

0

You can use a Path to determine a clip area on your Canvas when drawing a Bitmap.

For a full example see:

Android - Crop an image from multipoints

and also:

Cutting a multipoint ploygon out of Bitmap and placing it on transparency

Community
  • 1
  • 1
Gunnar Karlsson
  • 28,350
  • 10
  • 68
  • 71