画布转换成位图图像的android [英] converting a canvas into bitmap image in android

查看:111
本文介绍了画布转换成位图图像的android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向发展在画布上的应用程序,我在画布上用位​​图。经过图纸绘制,我想转换成位图图像。

I am trying to develope an app on canvas ,i am drawing on canvas with bitmap .After drawing,i am trying to convert into bitmap image .

谁能给我suggession

can anyone give me suggession

请多关照

推荐答案

咨询意见取决于你正在努力做的事情。

Advice depends upon what you are trying to do.

如果您担心您的控件需要很长的时间来画,你想画成位图,所以你可以的blit的位图,而不是通过一个帆布重新绘制,那么你的希望双猜平台 - 控制自动缓存它们的绘制临时的位图,而这些甚至可以从使用​​控制<一个获取href="http://developer.android.com/reference/android/view/View.html#getDrawingCache%28%29"><$c$c>getDrawingCache()

If you are concerned that your controls take a long time to draw, and you want to draw to a bitmap so you can blit the bitmap rather than re-drawing via a canvas, then you don't want to be double-guessing the platform - controls automatically cache their drawing to temporary bitmaps, and these can even be fetched from the control using getDrawingCache()

如果你想用一个帆布为位图绘制,通常的配方是:

If you want to draw using a canvas to a bitmap, the usual recipe is:

  1. 创建正确大小的使用位图<一href="http://developer.android.com/reference/android/graphics/Bitmap.html#createBitmap%28int,%20int,%20android.graphics.Bitmap.Config%29"><$c$c>Bitmap.createBitmap()
  2. 创建一个帆布的实例指出,这种使用位图<一href="http://developer.android.com/reference/android/graphics/Canvas.html#Canvas%28android.graphics.Bitmap%29"><$c$c>Canvas(Bitmap)构造
  3. 画到画布
  4. 使用位图

这篇关于画布转换成位图图像的android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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