SciLib.SP.IP
Class Filter

java.lang.Object
  extended by SciLib.SP.IP.Filter

public final class Filter
extends java.lang.Object

This class contains some useful methods used in image processing.


Constructor Summary
Filter()
           
 
Method Summary
static java.awt.Image bwFilter(java.awt.Image img, java.awt.Component c)
          black and white filter an image with a media tracker in a component c
static java.awt.Image crop(int x, int y, int w, int h, java.awt.Image img, java.awt.Component c)
          crop an image with a specific rectangle
static java.awt.Image crop(java.awt.Rectangle rect, java.awt.Image img, java.awt.Component c)
          crop an image with a specific rectangle
static java.awt.Image dissolve(int alpha, java.awt.Image img, java.awt.Component c)
          rgb filter an image with a media tracker in a component c
static java.awt.Image load(java.awt.Image img, java.awt.Component c)
          load an image with a media tracker in a component c
static java.awt.Image load(java.lang.String fileName, java.awt.Component c)
          load an image from a file with a media tracker in a component c
static java.awt.Image negativeFilter(java.awt.Image img, java.awt.Component c)
          negative filter an image with a media tracker in a component c
static java.awt.Image scale(double ws, double hs, java.awt.Image img, java.awt.Component c)
          scale an image with with a media tracker in a component c
static java.awt.Image scaleColor(int r, int g, int b, java.awt.Image img, java.awt.Component c)
          scale all colors in an image with a media tracker in a component c
static java.awt.Image scaleColor(int p, java.lang.String color, java.awt.Image img, java.awt.Component c)
          scale one or all color components in the picture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
Method Detail

load

public static java.awt.Image load(java.lang.String fileName,
                                  java.awt.Component c)
load an image from a file with a media tracker in a component c

Parameters:
fileName - A String
c - A Component
Returns:
An image object

load

public static java.awt.Image load(java.awt.Image img,
                                  java.awt.Component c)
load an image with a media tracker in a component c

Parameters:
img - An image
c - A Component
Returns:
An image object

crop

public static java.awt.Image crop(int x,
                                  int y,
                                  int w,
                                  int h,
                                  java.awt.Image img,
                                  java.awt.Component c)
crop an image with a specific rectangle

Parameters:
x - An integer, x position
y - An integer, y position
w - An integer, the width of the rectangle
h - An integer, the height of the rectangle
img - An image
c - A Component
Returns:
An image object

crop

public static java.awt.Image crop(java.awt.Rectangle rect,
                                  java.awt.Image img,
                                  java.awt.Component c)
crop an image with a specific rectangle

Parameters:
rect - A Rectangle
img - An Image
c - A Component
Returns:
An image object

scale

public static java.awt.Image scale(double ws,
                                   double hs,
                                   java.awt.Image img,
                                   java.awt.Component c)
scale an image with with a media tracker in a component c

Parameters:
ws - A double value, the horizontal scale factor
hs - A double value, the vertical scale factor
img - An image
c - A Component
Returns:
An image object

dissolve

public static java.awt.Image dissolve(int alpha,
                                      java.awt.Image img,
                                      java.awt.Component c)
rgb filter an image with a media tracker in a component c

Parameters:
alpha - An integer value, the alpha value between 0 and 255
img - An image
c - A Component
Returns:
An image object

bwFilter

public static java.awt.Image bwFilter(java.awt.Image img,
                                      java.awt.Component c)
black and white filter an image with a media tracker in a component c

Parameters:
img - An image
c - A Component
Returns:
An image object

negativeFilter

public static java.awt.Image negativeFilter(java.awt.Image img,
                                            java.awt.Component c)
negative filter an image with a media tracker in a component c

Parameters:
img - An image
c - A Component
Returns:
An image object

scaleColor

public static java.awt.Image scaleColor(int r,
                                        int g,
                                        int b,
                                        java.awt.Image img,
                                        java.awt.Component c)
scale all colors in an image with a media tracker in a component c

Parameters:
r - An integer value, a red percentage between -100 and 100
g - An integer value, a green percentage between -100 and 100
b - An integer value, a blue percentage between -100 and 100
img - An image
c - A Component
Returns:
An image object

scaleColor

public static java.awt.Image scaleColor(int p,
                                        java.lang.String color,
                                        java.awt.Image img,
                                        java.awt.Component c)
scale one or all color components in the picture

Parameters:
p - An integer value, the percentage of the color component
color - A String, the color component, "red", "green", "blue" or "all"
img - An image
c - A Component
Returns:
An image object