Jak Zmienić kolor tła w BufferedImage?

0

Czy da się zmienić kolor całego BufferedImage za jednym razem czy tylko każdy picel osobno?

Za pomocą np takiej funkcji?

    public static BufferedImage setColor(BufferedImage image, int target) {
        int width = image.getWidth();
        int height = image.getHeight();
        BufferedImage newImage = new BufferedImage(width, height, image.getType());
        for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
                newImage.setRGB(i, j, target);
            }
        }
        return newImage;
    }
0

Jest druga metoda setRGB() gdzie podaje się początkowe X i Y oraz szerokość i wysokość. Tylko ma ona jeszcze inne argumenty.

1 użytkowników online, w tym zalogowanych: 0, gości: 1