保存绘图画布上的Andr​​oid图片 [英] Save Canvas Drawing on Image in Android

查看:144
本文介绍了保存绘图画布上的Andr​​oid图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序在我心中已经自定义的ImageView。使用自定义的ImageView我可以拖动,缩放和粘贴文本超过了它(使用它的onDraw()函数)。现在,在最后我想要把所有的帆布画了图像并希望将其保存在文件系统中。我曾尝试imageView.getDrawingCache()方法,但是当我缩小了它捕捉图像的黑色面太不符合我的要求。有什么建议?


解决方案

  1. 创建或加载您的位图。

  2. 创建画布。

  3. 将位图目标为受此画布。 <一href=\"http://developer.android.com/reference/android/graphics/Canvas.html#setBitmap%28android.graphics.Bitmap%29\"相对=nofollow>链接

  4. 使用画布绘制文本。

现在您的存储位图图像引起了在它上面的东西。

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?

解决方案

  1. Create or load your Bitmap.
  2. Create Canvas.
  3. Set the Bitmap as target for this canvas. link
  4. Draw your text using the canvas.

Now your image stored in Bitmap has drawn stuff on top of it.

这篇关于保存绘图画布上的Andr​​oid图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆