public void sketch(List<Point> pointList) throws FileNotFoundException , IOException{
BufferedImage bi = new BufferedImage
(512,512,BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = (Graphics2D) bi.getGraphics();
g2.setColor(Color.BLACK);
g2.fillRect(0, 0, bi.getWidth(), bi.getHeight());
GeneralPath gp=new GeneralPath();
Point p1=pointList.remove(0);
Point p2=pointList.remove(0);
gp.append(new Line2D.Double(p1.x,p1.y,p2.x,p2.y),true);
for(Point point: pointList){
gp.lineTo(point.x,point.y);
}
gp.closePath();
g2.setColor(Color.WHITE);
g2.fill(gp);
ImageIO.write(bi,"JPEG",new FileOutputStream("G:\\a.jpg"));
}