Graphics and paint(Graphics g) 问题???? 把你的程序贴出来看看,一般都是直接在g上绘图,不保存Graphics对象 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我想问的就是: 如何在内存中把一副图片画到另一副图片上。一个是背景图A,一个是前图:BA + B = ???如何着。----------------------------------------------------------------http://java.sun.com/docs/books/tutorial/2d/display/compositing.html有很多java2d的资料,但都是画图形,不是图片。也不是真真的在内存中和并的。而是覆盖的画上去的。不知道有没有人改结。 重载一下update update(Graphics g){paint(Graphics g);}试试 public void paint(Graphics g) { BufferedImage bimg=new BufferedImage(this.getWidth(),this.getHeight(),BufferedImage.TYPE_INT_RGB); Graphics gimg=bimg.getGraphics(); Image foreimg;//initialize your foreimage Image backimg;//initialize your back image gimg.drawImage(foreimg,...); gimg.drawImage(backimg,...);//now bimg=A+B g.drawImage(bimg,0,0,bimg.getWidth(null),bimg.getHeight(null),null); gimg.dispose(); } JAVA小问题求解 System.out.println和printInt这两个打印的有什么不同? java中怎么同时替换多个字符 两种程序写法的区别 请大家帮我看看下面有关字符输入的问题,谢谢! JAVA超基础:Comparator and Comparable 及Collections and Collection 的区别及联系? 编译通过,运行却不行,请帮忙看看。 回答就给分 有没有什么方法或思路把web服务器上的文件上传到另外一个web服务器? 公历和阴历如何转换??????????? ConnecttionPool出现了问题? 欢迎讨论~!
一个是前图:BA + B = ???如何着。
----------------------------------------------------------------
http://java.sun.com/docs/books/tutorial/2d/display/compositing.html
有很多java2d的资料,但都是画图形,不是图片。
也不是真真的在内存中和并的。而是覆盖的画上去的。不知道有没有人改结。
update(Graphics g)
{
paint(Graphics g);
}
试试
{
BufferedImage bimg=new BufferedImage(this.getWidth(),this.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics gimg=bimg.getGraphics();
Image foreimg;//initialize your foreimage
Image backimg;//initialize your back image
gimg.drawImage(foreimg,...);
gimg.drawImage(backimg,...);//now bimg=A+B
g.drawImage(bimg,0,0,bimg.getWidth(null),bimg.getHeight(null),null);
gimg.dispose();
}