Android Freehand bitmap cropping

删除回忆录丶 提交于 2019-12-08 05:47:14

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/13468765/android-freehand-bitmap-cropping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!