我试图绘制附在盒子上的图像,但是:
Graphics2D surf = (Graphics2D) surface.create(x, y, width, height);
image.draw(surf, width, height);
surface.setColor(Color.BLUE);
surface.fillRect(-5, -5, 10, 10);
surf.dispose();
不会从surface.create区域
渲染该方框#creates a new Graphics object based on this Graphics object, but with a new translation and clip area.
如何忽略剪辑区域?
答案 0 :(得分:0)
嗯..创建确实剪切了区域,我做的唯一简单的解决方案是:
Graphics2D surf = (Graphics2D) surface.create();
surf.translate(x,y);
image.draw(surf, width, height);
surface.setColor(Color.BLUE);
surface.fillRect(-5, -5, 10, 10);
surf.dispose();
这确实是按预期绘制的。