问题
TexturePaint Problems
I am currently making a 2D game using texturepaints. One significant problem I encountered was the fact that filling rectangles with the graphics2D setPaint method set to a texture paint is extremely slower than filling a rectangle with a base color. Is there possibly any other way to speed up painting by creating a custom class similar to Texturepaint that paints much faster? At this point I really don't know what to do because my fps is stuck at around 18-23fps.
EDIT :
g2d.setPaint(new TexturePaint(current_paint.getImage(), new Rectangle(CamX, CamY, current_paint.getImage().getWidth(), current_paint.getImage().getHeight())));
g2d.setClip(AffineTransform.getTranslateInstance(CamX, CamY).createTransformedShape(paint_regions.get(current_paint)));
g2d.fillRect(0, 0, host_frame.getWidth(), host_frame.getHeight());
System.setProperty("sun.java2d.opengl","true");//True or false makes almost no difference.
*Note : When commented out fillRectangle() is noticeably expensive.
来源:https://stackoverflow.com/questions/23118515/java-fillrect-with-texturepaint-is-slow