Android官方原文地址:http://developer.android.com/guide/topics/graphics/2d-graphics.html
------以下的翻譯融入了自己的思考,便於理解,很多地方翻譯並不是很恰當,所以配上了英文原文
Draw with a Canvas 用畫板(Canvas)繪製
When you're writing an application in which you would like to perform specialized drawing and/or controlation of graphics, you should do so by drawing through a
Canvas
.
A Canvas works for you as a pretense, or interface, to the actual surface upon which your graphics will be drawnface — it s surface upon which your graphics . Via the Canvas, your drawing is actually performed upon an underlying
Bitmap
In the event that you're drawing within the
onDraw()
callback
method, the Canvas is provided for you and
method, the Canvas is provided for you and callback
method, the Canvas is provided for you and callback
on place placehall recauscanh youfreca 您
SurfaceHolder.lockCanvas()
Bitmap
Now your Canvas will draw onto the defined Bitmap. After drawing upon it with the Canvas, you can then carry your Bitmap to another Canvas with one of the Canvas, you can then carry your Bithimap to another Canvas with one of the Canvas, you can then carry your Bitemap to another Canvas with one of the Canvas, you can then carry your Bitrel.
It's recommended that you ultimately draw your final graphics through a Canvas offered to you byBitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b);
Canvas.drawBitmap(Bitmap,...)
(see
the following sections).
現在你的Canvas將要繪製圖形到這個已經定義的Bitmap上。在Bitmap上繪製之後,你能夠透過
View.onDraw()
The
SurfaceHolder.lockCanvas()
Canvas.drawBitmap(Bitmap,...)方法其中的一种
Canvas
and many more. Other classes that you might use also have
draw()
methods. For example, you'll probably have some
Drawable
draw()
这个Canvas类有它自己的一系列绘制方法,并且你可以使用,像drawBitmap(...),drawRect(),drawText()等等。你可能用到的其他含有draw()方法的类,例如:你有一些Drawable对象,并且你想绘制到Canvas上。Drawable有它自己的draw()方法,它把Canvas作为参数传进去,将自己绘制到Canvas上。
以上就是Canvas and Drawables 翻译第二集的内容,更多相关内容请关注PHP中文网(www.php.cn)!