通过原图,在随机位置生成小方格,并根据小方格生成底图,底图由小方格的灰度化之后,绘制到原图上。
private Map createImg(File file, String filename) throws IOException {
BufferedImage sourceBuff = ImageIO.read(file);
int width = sourceBuff.getWidth();
int height = sourceBuff.getHeight(); //生成随机x,y
Random random = new Random(); //X轴距离右端tailoring_w 以上) Y轴距离底部tailoring_y以上
this.location_x = random.nextInt(width - tailoring_w * 2) + tailoring_w; this.location_y = random.nextInt(height - tailoring_h); //裁剪小图
BufferedImage sourceSmall = cutImg(file, location_x, location_y, tailoring_w, tailoring_h); //创建shape区域
List shapes = createSmallShape();
Shape area = shapes.get(0);
Shape bigarea = shapes.get(1); //创建图层用于处理小图的阴影
BufferedImage bfm1 = new BufferedImage(tailoring_w, tailoring