我知道一个是创建 Graphics2D对象,一个是获取一个 Graphics2D对象。
那两个有什么区别?
我看代码里都有
public void init(){
int width=480,hight=720;
image = new BufferedImage(width,hight,BufferedImage.TYPE_INT_RGB);
//获取图形上下文
graphics = (Graphics2D)image.getGraphics();
}
(1):创建一个Graphics2D,可以画到BufferedImage中。
BufferedImage buf=new
BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_ARGB);创建一个临时Graphics2D对象。
Graphics tmpG=buf.createGraphics();
将图像画入临时缓冲中:
tmpG.drawImage(img,10,10,this);
、
看起来都是初始化阶段使用的,之间也没什么区别麻
谢谢。