Android: Create an image from template + form data -


in project i'm using simple form fields such image,name,company,venue,datetime being entered user. before entering details provide template choice section user contains 3 predefined invitation card templates(image). want details of user filled, embed invitation card template(image) selected , lastly show final image containing details entered , on invitation card template.

//template card template, strings details, x , y locations of strings. //the top left corner of image (0, 0), , bottom right (template.width, template.height) private static bitmap makedetailedbitmap(final bitmap template, final string[] strings, final float[] x, final float[] y) {     bitmap result = bitmap.createbitmap(template.getwidth(), template.getheight(), template.getconfig());   //create base image     canvas canvas = new canvas(result);   //create canvas can draw onto base image     canvas.drawbitmap(template, 0, 0, null);   //draw template      //edit: forgot set text paint     paint p = new paint();     //p.settextalign(paint.align.center);   //uncomment if want centered text     p.settextsize(12);   //change please     p.setcolor(color.black);   //change please      final int len = strings.length; //assumes length of x , y >= length of strings     (int = 0; < len; i++)     {         canvas.drawtext(strings[i], x[i], y[i], p);  //draws text onto image     }     return result;   //returns image modified using canvas (aka image details) } 

so call each template want.


Comments