开发者

How can i have image (takePicture) with text at the bottom of it. Eg. Date time

I would like to add the text to be part of my image. Eg. Date and time, or "You are using the Free version". Is it p开发者_StackOverflow中文版ossible....? Please help me. Thanks in advance.


Use a Canvas and drawText.


Thanks Gabriel for the right direction: Following code helped me.

     public static Bitmap WaterMark(Bitmap src, String watermark,int x, int y,  int size) {
        int w = src.getWidth();
        int h = src.getHeight();
    //  TML_Library.Debug("Image Width = "+w+" Image Height = "+h);
        Bitmap result = Bitmap.createBitmap(w, h, src.getConfig());

        Canvas canvas = new Canvas(result);
        canvas.drawBitmap(src, 0, 0, null);
        Paint paint = new Paint();
        paint.setTextSize(size);

        paint.setColor(Color.rgb(255, 0, 0));

        paint.setAntiAlias(true);

        canvas.drawText(watermark, x, y, paint);

        return result;
    }   
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜