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
  • 34,719
  • 24
  • 185
  • 251
Khawar Raza
  • 15,620
  • 24
  • 65
  • 122

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
onosendai
  • 28,120
  • 10
  • 66
  • 71