Java BufferedImage Operation applyMaskImage(BufferedImage src, int x, int y, int w, int h)

Here you can find the source of applyMaskImage(BufferedImage src, int x, int y, int w, int h)

Description

apply Mask Image

License

Open Source License

Declaration

public static void applyMaskImage(BufferedImage src, int x, int y,
            int w, int h) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.image.BufferedImage;

public class Main {
    public static void applyMaskImage(BufferedImage src, int x, int y,
            int w, int h) {

        if (x < 0) {
            x = 0;/*www  .j  ava 2  s  . c o m*/
        }

        if (y < 0) {
            y = 0;
        }

        int maxOffsetX = x + w;
        int maxOffsetY = y + h;

        for (int xCounter = x; xCounter < maxOffsetX; xCounter++) {
            for (int yCoutner = y; yCoutner < maxOffsetY; yCoutner++) {

                if (yCoutner > src.getHeight() || xCounter > src.getWidth()) {
                    break;
                }

                src.setRGB(xCounter, yCoutner, 0);
            }
        }
    }
}

Related

  1. applyAlphaMask(BufferedImage buffer, BufferedImage alphaMask, int imgHeight)
  2. applyExplicitSMask(BufferedImage baseImage, BufferedImage sMaskImage)
  3. applyGrayDecode(BufferedImage rgbImage, int bitsPerComponent, float[] decode)
  4. applyGrayscaleMaskToAlpha(BufferedImage image, BufferedImage mask)
  5. applyMask(BufferedImage img, Color keyColor)
  6. applyShadow(BufferedImage image)
  7. areBufferedImagesEqual(BufferedImage img1, BufferedImage img2)
  8. autoPanImage(BufferedImage img, Color bgcolor)
  9. binarize(BufferedImage image)