java - Array of points to image -
i'm stuck trying convert array of points represent drawing(simple 2d black lines) taken mobile phone. pass array of points server emails drawing person.
i can't find way convert array of points image, png, or else. , upload static server can insert in email , send other person.
i'm looking canvas on android on serverside can output image. preferably java, @ point take anything.
an ex of array of points:
{ "drawing_objects": [ [ { "x": 177, "y": 246 }, { "x": 177, "y": 246 }, { "x": 177, "y": 246 } ], [ { "x": 870, "y": 298 }, { "x": 866.5316, "y": 302.62445 } ] ] }
these 2 lines, in drawing, first 3 point, second 1 2.
if using java based server, create graphics2d, draw points , export png or whatever want.
import javax.imageio.imageio; import java.awt.graphics2d; import java.awt.image.bufferedimage; //… bufferedimage bi = new bufferedimage(width, height, bufferedimage.type_int_argb); graphics2d ig2 = bi.creategraphics(); //draw lines graphic ig2.drawline(x1,y1,x2,y2); ig2.drawline(x2,y2,x3,y3); //... //export result file imageio.write(bi, "png", new file(“c:\\name.png”));
Comments
Post a Comment