JAVA 关于BufferedImage类绘制图片的问题。

2025-03-07 15:42:26
推荐回答(3个)
回答1:

BufferedImage bim=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
bim= ImageIO.read(new URL("001.bmp"));
Graphics g=bim.getGraphics();
g.drawImage(bim, 0, 0, null);
或者
ImageIcon p=new ImageIcon(this.getClass()
.getResource("title.png"));
int i=p.getIconHeight();
int j=p.getIconWidth();
p.setDescription("");
具体里面的方法去api 看看 有画笔和设置尺寸的,获取尺寸的

回答2:

我觉得应该声明一个Graphics2D对象,然后用getGraphics()来实例化。再转换成Graphics2D类的

Graphics2D g = (Graphics2D) getGraphics();

回答3:

bim.getGraphices()呗