Clear a transparent BufferedImage as fast as possible

前端 未结 2 1654
你的背包
你的背包 2021-01-02 05:18

I have a transparent BufferedImage created with the following code(not relevant how it is created, I think):

            GraphicsEnvironment ge = GraphicsEnv         


        
2条回答
  •  北海茫月
    2021-01-02 05:53

    Got it :) used clearRect instead of fill with a transparent color.

                graphics = (Graphics2D) offlineBuffer.getGraphics();
                graphics.setBackground(new Color(255, 255, 255, 0));
                Rectangle screen = transformationContext.getScreen();
                graphics.clearRect(0,0, (int)screen.getWidth(), (int)screen.getHeight());
    

提交回复
热议问题