我已经检查了类似命名的问题,但他们没有回答这个用例.
基本上,我是在一个给定的坐标(x,y)上叠加一些文本(文本)我在包中有以下功能;
protected BufferedImage Process2(BufferedImage image){
Graphics2D gO = image.createGraphics();
gO.setColor(Color.red);
gO.setFont(new Font( "SansSerif", Font.BOLD, 12 ));
gO.drawString(this.text, this.x, this.y);
System.err.println(this.text+this.x+this.y);
return image;
}
Run Code Online (Sandbox Code Playgroud)
我觉得我错过了一些显而易见的东西; 我可以找到的每一个对Graphics2D的引用都是处理游戏或直接写入文件,但我只想要返回一个BufferedImage.覆盖'渲染'
在当前代码中,图像显示为未更改.
谢谢!