1

嗨,每个人都是这个 android 开发的新手。

目前正在开发绘图应用程序,为绘制的图像添加图章/标签。所以我已经完成了绘图部分,所以现在我必须实现为该绘制的图像添加图章/标签。

所以请帮我解决这个..

4

4 回答 4

4
Bitmap Rbitmap = Bitmap.createBitmap(bitmap).copy(Config.ARGB_4444, true);
Canvas canvas = new Canvas(Rbitmap);            
canvas.drawBitmap(label, -9, Rbitmap.getHeight()-label.getHeight()-10, null);
canvas.save();
return Rbitmap;

Making your question little more specific will help you more.If I understood is correct this piece of code will help you out to draw a bitmap to a drawn canvas.

于 2012-04-23T09:17:53.363 回答
0

你可以更具体一点,即发布一些代码来显示你必须得到更具体的答案。无论如何,您可以使用以下方法在另一个位图上绘制位图:

//You will have a Bitmap bottomBmp, a Bitmap topBmp and a Canvas canvas.
//If you are inside an onDraw() method the canvas will be provided to you, otherwise you will have to create it yourself, use a mutable bitmap of the same size as the bottomBmp.

canvas.drawBitmap(bottomBmp, 0, 0, null); //Draw the bottom bitmap in the upper left corner of the canvas without any special paint effects.
canvas.drawBitmap(topBmp, 0, 0, null); //Draw the top bitmap over the bottom bitmap, change the zeroes to offset this bitmap.
于 2012-04-23T08:46:35.690 回答
0

私人油漆绿色=新油漆();

private int greenx , greeny;

green.setColor(Color.GREEN);

    green.setAntiAlias(false);

    canvas.drawCircle(greenx,greeny,20,green);

如何在此代码中添加图像将 drawcircle 替换为图像如何?

于 2020-01-03T06:56:39.030 回答
-1

试试这个代码:

private Bitmap background;

public birdClass(Context context) {
    super(context);
    background = BitmapFactory.decodeResource(getResources(),R.drawable.splash );
}
于 2020-01-02T16:34:47.287 回答