生成Shape区域之后,根据小方格Shape区域,根据原图创建出方格,根据凹槽Shape创建一个灰化的凹槽区域。
对小方格进行边缘亮化、阴影处理。 在处理阴影时,需要注意:因为阴影生成在Shape外部,我们还需要使用一个图层用来绘制阴影。然后将小方格绘制到这个图层上
//处理小图的边缘灯光及其阴影效果
private BufferedImage dealLightAndShadow(BufferedImage bfm, Shape shape) throws IOException { //创建新的透明图层,该图层用于边缘化阴影, 将生成的小图合并到该图上
BufferedImage buffimg = ((Graphics2D) bfm.getGraphics()).getDeviceConfiguration().createCompatibleImage(50, 50, Transparency.TRANSLUCENT);
Graphics2D graphics2D = buffimg.createGraphics();
Graphics2D g2 = (Graphics2D) bfm.getGraphics(); //原有小图,边缘亮色处理
paintBorderGlow(g2, lightHeightWidth, shape); //新图层添加阴影
paintBorderShadow(graphics2D, shadowWidth, shape);
graphics2D.drawImage(bfm, 0, 0, null); return buffimg;
} /**
* 处理阴影
* @param g2
* @param shado