81,092
社区成员
发帖
与我相关
我的任务
分享
BufferedImage pic = new BufferedImage(trueWidth, trueHeigth,
image.getType());
Graphics2D g = pic.createGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, trueWidth, trueHeigth);
g.drawImage(image, (trueWidth - srcWidth) / 2,
(trueHeigth - srcHeigth) / 2, srcWidth, srcHeigth,
Color.white, null);
g.dispose();