简体   繁体   中英

Draw portion of image on Canvas

我的图像尺寸为265x256,我想在画布上的任意位置绘制尺寸为16x16的左上和右下部分

I think you can use Canvas method

public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)

where documentation states second argument src as

If the source rectangle is not null, it specifies the subset of the bitmap to draw.

So you can pass the rectangle of the source bitmap that you want to draw in the second argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM