Android徒手画位图裁剪 [英] Android Freehand bitmap cropping
本文介绍了Android徒手画位图裁剪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我们可以使用以下方法将位图裁剪为矩形
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?
推荐答案
You can use a Path
to determine a clip area on your Canvas
when drawing a Bitmap
.
有关完整示例,请参见:
For a full example see:
还有:
这篇关于Android徒手画位图裁剪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文