Canvas drawText()和drawBitmap()

本文详细介绍了在Canvas中使用drawText()和drawBitmap()方法进行绘图的操作。重点讨论了drawText()的baseline基线概念,并解释了drawBitmap()方法中left和top参数的作用,它们分别表示图片左边缘和顶部的绘制位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public void drawText (String text, float x, float y, Paint paint)
Draw the text, with origin at (x,y), using the specified paint. The origin is interpreted based on the Align setting in the paint. 
Parameters:
text The text to be drawn
x The x-coordinate of the origin of the text being drawn
y The y-coordinate of the origin of the text being drawn
paint The paint used for the text (e.g. color, size, style)

这个origin就是文字baseline基线的坐标。


public void drawBitmap(Bitmap btmap, float left, float top, Paint paint)

            left   The position of the left side of the bitmap being drawn

            top   The position of the top side of the bitmap being drawn

           被绘制的图片的左边的位置,被绘制的图片的上边的位置.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值