保存绘图画布上的Android图片 [英] Save Canvas Drawing on Image in Android
问题描述
我工作的一个应用程序在我心中已经自定义的ImageView。使用自定义的ImageView我可以拖动,缩放和粘贴文本超过了它(使用它的onDraw()函数)。现在,在最后我想要把所有的帆布画了图像并希望将其保存在文件系统中。我曾尝试imageView.getDrawingCache()方法,但是当我缩小了它捕捉图像的黑色面太不符合我的要求。有什么建议?
- 创建或加载您的位图。
- 创建画布。
- 将位图目标为受此画布。 <一href=\"http://developer.android.com/reference/android/graphics/Canvas.html#setBitmap%28android.graphics.Bitmap%29\"相对=nofollow>链接
- 使用画布绘制文本。
现在您的存储位图图像引起了在它上面的东西。
I'm working on an application in which I'v a custom ImageView. Using custom imageview I can drag,zoom, and paste text over over it (using its onDraw() function). Now at the end I want to put all the canvas drawing over image and want to save it in the file system. I have tried imageView.getDrawingCache() method but it does not fulfill my requirements as when I zoom out the it captures black sides of the image too. Any suggestions?
- Create or load your Bitmap.
- Create Canvas.
- Set the Bitmap as target for this canvas. link
- Draw your text using the canvas.
Now your image stored in Bitmap has drawn stuff on top of it.
这篇关于保存绘图画布上的Android图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!