画布转换成位图图像的android位图、画布、转换成、图像

2023-09-11 12:47:48 作者:分手假期◎∮

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

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的位图,而不是通过一个帆布重新绘制,那么你的不希望双猜平台 - 控制自动缓存它们的绘制临时的位图,而这些甚至可以从使用​​控制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:

创建正确大小的使用位图Bitmap.createBitmap() 创建一个帆布的实例指出,这种使用位图Canvas(Bitmap)构造 画到画布 使用位图