src/main/java/ch/wetwer/moviefleur/color/ColorFilter.java
/**
     * @param originalImg img to be filtered
     * @param colorMask   color to be applied
     *
     * @return filtered img with given color
     */
@param originalImg img to be filtered
@param colorMask   color to be applied

@return filtered img with given color
@param originalImg img to be filtered @param colorMask color to be applied @return filtered img with given color
public static BufferedImage filterColor(BufferedImage originalImg, ColorMask colorMask) {
        BufferedImage colorImage = new BufferedImage(originalImg.getWidth(),
                originalImg.getHeight(), originalImg.getType());
        for (int pixelX = 0; pixelX < originalImg.getWidth(); pixelX++) {
            for (int pixelY = 0; pixelY < originalImg.getHeight(); pixelY++) {
                colorImage.setRGB(pixelX, pixelY,
                        originalImg.getRGB(pixelX, pixelY) & colorMask.getMask());
            }
        }
        return colorImage;
    }
public static BufferedImage filterColor ( BufferedImage originalImg , ColorMask colorMask ) { BufferedImage colorImage = new BufferedImage ( originalImg . getWidth ( ) , originalImg . getHeight ( ) , originalImg . getType ( ) ) ; for ( int pixelX = 0 ; pixelX < originalImg . getWidth ( ) ; pixelX ++ ) { for ( int pixelY = 0 ; pixelY < originalImg . getHeight ( ) ; pixelY ++ ) { colorImage . setRGB ( pixelX , pixelY , originalImg . getRGB ( pixelX , pixelY ) & colorMask . getMask ( ) ) ; } } return colorImage ; }
@param originalImg img to be filtered
 @param colorMask   color to be applied
@param originalImg img to be filtered @param colorMask color to be applied