覆盖画布图像与另一个图像android [英] overlay canvas image with another image android

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

问题描述

我有一个显示在屏幕上的楼层平面图的图片,我的问题如何覆盖另一个图片。

I have an image of a floor plan displayed on screen, My Question how do I overlay another image on that.

查看来自另一个线程的图片如何此处 p>

see the image from another thread where I asked a how to here

/**
 * floor plan drawing.
 *
 * @param canvas the canvas on which the background will be drawn
 */
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    Bitmap temp = BitmapFactory.decodeResource(getResources(), R.drawable.floorplan);
    image= Bitmap.createScaledBitmap(temp, canvas.getWidth(), canvas.getHeight(), true);
    canvas.drawBitmap(image, 0, 0, null);

}

G

推荐答案

如何在第一张图片上添加第二张图片?

What about adding the second image over the first one?

@Override
protected void onDraw(Canvas canvas)
{
    super.onDraw(canvas);
    Bitmap temp = BitmapFactory.decodeResource(getResources(), R.drawable.floorplan);
    image = Bitmap.createScaledBitmap(temp, canvas.getWidth(), canvas.getHeight(), true);
    canvas.drawBitmap(image, 0, 0, null);

    Bitmap over = BitmapFactory.decodeResource(getResources(), R.drawable.overlay);
    image = Bitmap.createScaledBitmap(over, canvas.getWidth(), canvas.getHeight(), true);
    canvas.drawBitmap(image, 0, 0, null);
}

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

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