com.iproject.wbmpcreator
Class WBMPFilter

java.lang.Object
  |
  +--com.iproject.wbmpcreator.WBMPFilter

public class WBMPFilter
extends java.lang.Object


Field Summary
static int CHANNEL_BLUE
          A constant representing blue channel
static int CHANNEL_GREEN
          A constant representing green channel
static int CHANNEL_RED
          A constant representing red channel
static int FILTER_DITHER_BURKE
          Filter converting images to monochrome mode by using Burke method
static int FILTER_DITHER_FLOYD_STEINBERG
          Filter converting images to monochrome mode by using Floyd Steinberg method
static int FILTER_DITHER_JARVIS
          Filter converting images to monochrome mode by using Jarvis method
static int FILTER_DITHER_ORDER_3X3
          Filter converting images to monochrome mode by using ordered dithered method with 3x3 conversion array
static int FILTER_DITHER_ORDER_4X4
          Filter converting images to monochrome mode by using ordered dithered method with 4x4 conversion array
static int FILTER_DITHER_STUCKI
          Filter converting images to monochrome mode by using Stucki method
static int FILTER_MONOCHROME
          Filter converting images to monochrome mode by using average threshold
 
Constructor Summary
WBMPFilter()
          Empty constructor.
 
Method Summary
 WBMPfile complexImageFilter(int[][] image, int length, int width, int filter_type)
          This method is used for converting complicated images into WBMP.
 int getBlueThreshold()
          Method to get the red threshold
 int getGreenThreshold()
          Method to get the red threshold
 int getRedThreshold()
          Method to get the red threshold
 void setBlueThreshold(int newBlueThreshold)
          Method to set the blue threshold
 void setGreenThreshold(int newGreenThreshold)
          Method to set the green threshold
 void setRedThreshold(int newRedThreshold)
          Method to set the red threshold
 void setThreshold(int newThreshold)
          Method to set threshold.
 int[][] simpleImageFilter(int[][] image, int length, int width, int filter_type)
          Method to perform filtering.
 int[][] simpleImageFilter(int[][] image, int length, int width, int filter_type, int threshold)
          Method to perform filtering.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER_MONOCHROME

public static final int FILTER_MONOCHROME
Filter converting images to monochrome mode by using average threshold

FILTER_DITHER_ORDER_4X4

public static final int FILTER_DITHER_ORDER_4X4
Filter converting images to monochrome mode by using ordered dithered method with 4x4 conversion array

FILTER_DITHER_ORDER_3X3

public static final int FILTER_DITHER_ORDER_3X3
Filter converting images to monochrome mode by using ordered dithered method with 3x3 conversion array

FILTER_DITHER_BURKE

public static final int FILTER_DITHER_BURKE
Filter converting images to monochrome mode by using Burke method

FILTER_DITHER_FLOYD_STEINBERG

public static final int FILTER_DITHER_FLOYD_STEINBERG
Filter converting images to monochrome mode by using Floyd Steinberg method

FILTER_DITHER_JARVIS

public static final int FILTER_DITHER_JARVIS
Filter converting images to monochrome mode by using Jarvis method

FILTER_DITHER_STUCKI

public static final int FILTER_DITHER_STUCKI
Filter converting images to monochrome mode by using Stucki method

CHANNEL_RED

public static final int CHANNEL_RED
A constant representing red channel

CHANNEL_GREEN

public static final int CHANNEL_GREEN
A constant representing green channel

CHANNEL_BLUE

public static final int CHANNEL_BLUE
A constant representing blue channel
Constructor Detail

WBMPFilter

public WBMPFilter()
Empty constructor.
Method Detail

simpleImageFilter

public int[][] simpleImageFilter(int[][] image,
                                 int length,
                                 int width,
                                 int filter_type)
Method to perform filtering.
Parameters:
image - the int[][] array of points representing image
length - length of the image
width - width of the image
filter_type - type of filter

complexImageFilter

public WBMPfile complexImageFilter(int[][] image,
                                   int length,
                                   int width,
                                   int filter_type)
This method is used for converting complicated images into WBMP. It uses the special dithering methods for creating suitable view.
The following dithering methods are supported: You can use this method by the following way:
 // open image from URL
   URL url = new URL(_your_URL_for_the_image_);
   SimpleImageFile x = new SimpleImageFile(url);
 // imstantiate the filter
   WBMPFilter wf=new WBMPFilter();
 // apply the dithering method with 4x4 array (you may substitute it with 3x3 array)
   WBMPfile y=wf.complexImageFilter(x.getPointArray(),x.getLength(),
x.getWidth(),wf.FILTER_DITHER_ORDER_4X4);
 // save image (you may put it to the stream or
 // save in the other graphical format)                                     
   y.saveWBMP2File(_your_filename_for_WBMP_image_);
 
Since:
1.50

simpleImageFilter

public int[][] simpleImageFilter(int[][] image,
                                 int length,
                                 int width,
                                 int filter_type,
                                 int threshold)
Method to perform filtering. It differs from the other method with ability of counting the average threshold for each color channel. This feature helps to perform color->monochrome conversion MUCH more precizely.
Parameters:
image - the int[][] array of points representing image
length - length of the image
width - width of the image
filter_type - type of filter
threshold - type of threshold to be automatically set. Can be combined like the following: CHANNEL_RED+CHANNEL_BLUE - thus the thresholds for RED and BLUE will be counted, and for GREEN channel it will be set to 128. The old values of thresholds will be lost.
Since:
1.41

setThreshold

public void setThreshold(int newThreshold)
Method to set threshold. The threshold can be set individually for each color channel and for all channels at once. In most cases it is more preferrable to adjust threshold for each channel individually but it's rather hard to guess where the threshold for one image fits another.
Parameters:
newThreshold - the new threshold value for all color channels

setRedThreshold

public void setRedThreshold(int newRedThreshold)
Method to set the red threshold
Parameters:
newRedThreshold - the new red threshold value for the red channel

getRedThreshold

public int getRedThreshold()
Method to get the red threshold

setGreenThreshold

public void setGreenThreshold(int newGreenThreshold)
Method to set the green threshold
Parameters:
newGreenThreshold - the new green threshold value for the green channel

getGreenThreshold

public int getGreenThreshold()
Method to get the red threshold

setBlueThreshold

public void setBlueThreshold(int newBlueThreshold)
Method to set the blue threshold
Parameters:
newBlueThreshold - the new blue threshold value for the blue channel

getBlueThreshold

public int getBlueThreshold()
Method to get the red threshold