如何将贴纸(图像)添加到位图

时间:2012-04-09 11:50:49

标签: android bitmapimage

您正在开发绘图Android应用程序。因为我想在贴图上添加贴纸(图像)然后我可以保存图像..

请有人知道这个请ping我。提前谢谢..

1 个答案:

答案 0 :(得分:2)

有什么想法吗?将位图绘制到画布并绘制文本然后保存?

drawingCache = Bitmap.createBitmap(300, 400, Bitmap.Config.ARGB_8888);

Canvas canvas = new Canvas(drawingCache);
Paint paint = new Paint();

// Draw your bitmap to the canvas
canvas.drawBitmap(bitmap, 0, 0, paint);

Paint watermarkPaint = new Paint();
watermarkPaint.setColor(Color.WHITE);
watermarkPaint.setAlpha(150);
watermarkPaint.setTextSize(30);
watermarkPaint.setTextAlign(Paint.Align.LEFT);
watermarkPaint.setFlags(Paint.ANTI_ALIAS_FLAG);

canvas.drawText("Watermark", 100, 100, watermarkPaint);