使用zxing生成嵌图片的二维码(二)

2014-11-24 08:49:19 · 作者: · 浏览: 4
hic = image.createGraphics(); graphic.setColor(Color.white); graphic.fillRect(0, 0, width, height); if (width == destImage.getWidth(null)) graphic.drawImage(destImage, 0, (height - destImage.getHeight(null)) / 2, destImage.getWidth(null), destImage.getHeight(null), Color.white, null); else graphic.drawImage(destImage, (width - destImage.getWidth(null)) / 2, 0, destImage.getWidth(null), destImage.getHeight(null), Color.white, null); graphic.dispose(); destImage = image; } return (BufferedImage) destImage; } public static void main(String[] args) { BarcodeFactory .encode("http://coolshell.cn/articles/10590.html", 300, 300, "F:\\2013.jpg", "F:\\2013-01.jpg"); } }