Applying a tint to an image in java

前端 未结 7 774
太阳男子
太阳男子 2020-12-09 16:25

I am trying to create several similar visual styles for my programs, each with a different color theme. To do this, I have implemented the use of icons to represent the diff

相关标签:
7条回答
  • 2020-12-09 16:53

    This isn't exactly tinting, its more like applying another layer on it but it works for me:

    public static BufferedImage colorImage(BufferedImage loadImg, int red, int green, int blue, int alpha /*Also the intesity*/) {
        Graphics g = loadImg.getGraphics();
        g.setColor(new Color(red, green, blue, alpha));
        g.fillRect(0, 0, loadImg.getWidth(), loadImg.getHeight());
        g.dispose();
        return loadImg;
    }
    
    0 讨论(0)
提交回复
热议问题