Here you can find the source of horizontalFilter(BufferedImage bufImg, int startX, int stopX, int start, int stop, int y, double[] pContrib)
private static int horizontalFilter(BufferedImage bufImg, int startX, int stopX, int start, int stop, int y, double[] pContrib)
//package com.java2s; import java.awt.image.BufferedImage; public class Main { private static int horizontalFilter(BufferedImage bufImg, int startX, int stopX, int start, int stop, int y, double[] pContrib) { double valueRed = 0.0; double valueGreen = 0.0; double valueBlue = 0.0; int valueRGB = 0; int i, j; for (i = startX, j = start; i <= stopX; i++, j++) { valueRGB = bufImg.getRGB(i, y); valueRed += getRedValue(valueRGB) * pContrib[j]; valueGreen += getGreenValue(valueRGB) * pContrib[j]; valueBlue += getBlueValue(valueRGB) * pContrib[j]; }//from w w w . j a v a 2 s.c o m return comRGB(clip((int) valueRed), clip((int) valueGreen), clip((int) valueBlue)); } private static int getRedValue(int rgbValue) { int temp = rgbValue & 0x00ff0000; return temp >> 16; } private static int getGreenValue(int rgbValue) { int temp = rgbValue & 0x0000ff00; return temp >> 8; } private static int getBlueValue(int rgbValue) { return rgbValue & 0x000000ff; } private static int comRGB(int redValue, int greenValue, int blueValue) { return (redValue << 16) + (greenValue << 8) + blueValue; } private static int clip(int x) { if (x < 0) return 0; if (x > 255) return 255; return x; } }