Class GpadFilter

java.lang.Object
  |
  +--GpadFilter

public final class GpadFilter
extends java.lang.Object

The GpadFilter class represents a filter operation applied to the Paintlet canvas by a GraphicPad component. Filter types are defined as static integer constants. The region to filter can be specified. The GpadFilter object is passed as an argument to the gpApplyFilter method of the GpadComponent class.

Version:
1.19.1
Author:
Joseph E. Dever
See Also:
GpadComponent

Field Summary
static int BLEACH
          Bleach filter type.
static int BLUE
          Blue filter type.
static int BLUR
          Blur filter type.
static int BW
          Black and white filter type.
static int COLORWEAVE
          Color weave filter type.
static int EMBOSS
          Emboss filter type.
static int FLAKE
          Flake filter type.
static int FRAME
          Frame filter type.
static int GRAY
          Gray filter type.
static int GREEN
          Green filter type.
static int HAZE
          Haze filter type.
static int HEIGHT
          The Paintlet canvas height
static int IDENTITY
          Identity filter type.
static int NEGATIVE
          Negative filter type.
static int RED
          Red filter type.
static int REFLECT
          Reflect filter type.
static int RGB
          Red, green and blue filter type.
static int RGB2
          Red, green and blue filter type.
static int ROTATE
          Rotate filter type.
static int SCALEDOWN
          Scale filter type.
static int SHARPEN
          Sharpen filter type.
static int SINEWAVE
          Sine wave filter type.
static int SINEWAVE2
          Sine wave filter type.
static int SPOTLIGHT
          Spotlight filter type.
static int SPOTLIGHT2
          Spotlight filter type.
static int SPOTLIGHT3
          Spotlight filter type.
static int WIDTH
          The Paintlet canvas width
 
Constructor Summary
GpadFilter()
          Creates a new GpadFilter object.
 
Method Summary
 int getFilterHeight()
          Gets the filter height.
 int getFilterType()
          Gets the filter type.
 int getFilterVal()
          Gets the filter value.
 int getFilterWidth()
          Gets the filter width.
 int getFilterX()
          Gets the x coordinate of the filter area's anchor point.
 int getFilterY()
          Gets the y coordinate of the filter area's anchor point.
 void setFilterHeight(int h)
          Sets the height of the filter area to the specified value.
 void setFilterRegion(int x, int y, int w, int h)
          Sets the region to filter.
 void setFilterType(int filter)
          Sets the filter type.
 void setFilterVal(int v)
          Sets the filter strength value.
 void setFilterWidth(int w)
          Sets the width of the filter area to the specified value.
 void setFilterX(int x)
          Sets the x coordinate of the filter area's anchor point to the specified value.
 void setFilterY(int y)
          Sets the y coordinate of the filter area's anchor point to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLEACH

public static final int BLEACH
Bleach filter type. Allows variable filter strength.

HAZE

public static final int HAZE
Haze filter type. Allows variable filter strength.

GRAY

public static final int GRAY
Gray filter type. Allows variable filter strength.

BLUR

public static final int BLUR
Blur filter type.

NEGATIVE

public static final int NEGATIVE
Negative filter type.

SHARPEN

public static final int SHARPEN
Sharpen filter type.

RED

public static final int RED
Red filter type. Allows variable filter strength. Filters out red.

ROTATE

public static final int ROTATE
Rotate filter type. Rotates 90 degrees clockwise.

BLUE

public static final int BLUE
Blue filter type. Allows variable filter strength. Filters out blue.

REFLECT

public static final int REFLECT
Reflect filter type.

GREEN

public static final int GREEN
Green filter type. Allows variable filter strength. Filters out green.

EMBOSS

public static final int EMBOSS
Emboss filter type.

COLORWEAVE

public static final int COLORWEAVE
Color weave filter type. Weaves current Paintlet color into the canvas.

FLAKE

public static final int FLAKE
Flake filter type. Produces a flaked texture on the canvas.

BW

public static final int BW
Black and white filter type. Allows variable filter strength. Maps RGB pixel color values to black, gray and white color values. The distribution of these black, gray and white colors is affected by the filter strength.

SINEWAVE

public static final int SINEWAVE
Sine wave filter type. Allows variable filter strength. Filter strength alters the magnitude of the wave.

RGB

public static final int RGB
Red, green and blue filter type. Allows variable filter strength. Maps RGB pixel color values to black, red, green blue and white color values. The distribution of the red, green and blue colors is affected by the filter strength.

SINEWAVE2

public static final int SINEWAVE2
Sine wave filter type. Allows variable filter strength. Filter strength alters the magnitude of the wave.

RGB2

public static final int RGB2
Red, green and blue filter type. Allows variable filter strength. Maps RGB pixel color values to black, white and three pre-defined color values. The distribution of these pre-defined colors is affected by the filter strength.

SCALEDOWN

public static final int SCALEDOWN
Scale filter type. Allows variable filter strength. Scales down the canvas as a percent of the original canvas. The percent value is equal to the filter strength, with a minimum value of 10.

FRAME

public static final int FRAME
Frame filter type. Allows variable filter strength. Draws a frame the width of the filter strength value in the current Paintlet color around the canvas or rectangular region. The frame is drawn in a transparency gradient from fully opaque at the exterior to fully transparent at the interior.

SPOTLIGHT

public static final int SPOTLIGHT
Spotlight filter type. Applies three spotlights to the canvas in preset colors and intensities.

SPOTLIGHT2

public static final int SPOTLIGHT2
Spotlight filter type. Allows variable filter strength. Applies a single spotlight in the current color which varies in intensity with the filter strength.

SPOTLIGHT3

public static final int SPOTLIGHT3
Spotlight filter type. Allows variable filter strength. Applies a spotlight to the left, right or both sides of the canvas, depending on the filter strength.

IDENTITY

public static final int IDENTITY
Identity filter type. Does nothing.

WIDTH

public static final int WIDTH
The Paintlet canvas width

HEIGHT

public static final int HEIGHT
The Paintlet canvas height
Constructor Detail

GpadFilter

public GpadFilter()
Creates a new GpadFilter object. The default filter type is identity. Default filter strength is 50.
Method Detail

setFilterWidth

public void setFilterWidth(int w)
Sets the width of the filter area to the specified value. If the value is less than or equal to 0, or exceeds the canvas width, the filter width defaults to the canvas width.
Parameters:
w - the filter width
See Also:
WIDTH, getFilterWidth()

getFilterWidth

public int getFilterWidth()
Gets the filter width.
Returns:
the filter width
See Also:
getFilterWidth()

setFilterHeight

public void setFilterHeight(int h)
Sets the height of the filter area to the specified value. If the value is less than or equal to 0, or exceeds the canvas height, the filter width defaults to the canvas height.
Parameters:
h - the filter height
See Also:
HEIGHT, getFilterHeight()

getFilterHeight

public int getFilterHeight()
Gets the filter height.
Returns:
the filter height
See Also:
setFilterHeight(int)

setFilterX

public void setFilterX(int x)
Sets the x coordinate of the filter area's anchor point to the specified value. If the value is less than 0, or exceeds the canvas width, the default is 0. The anchor point is the upper-left corner of the rectangular filter area.
Parameters:
x - the x coordinate of the anchor point
See Also:
getFilterX()

getFilterX

public int getFilterX()
Gets the x coordinate of the filter area's anchor point.
Returns:
the x coordinate of the anchor point
See Also:
setFilterX(int)

setFilterY

public void setFilterY(int y)
Sets the y coordinate of the filter area's anchor point to the specified value. If the value is less than 0, or exceeds the canvas height, the default is 0. The anchor point is the upper-left corner of the rectangular filter area.
Parameters:
y - the y coordinate of the anchor point
See Also:
getFilterY()

getFilterY

public int getFilterY()
Gets the y coordinate of the filter area's anchor point.
Returns:
the y coordinate of the anchor point
See Also:
setFilterY(int)

setFilterRegion

public void setFilterRegion(int x,
                            int y,
                            int w,
                            int h)
Sets the region to filter. The anchor point (x,y) is the upper-left corner of the filter region.
Parameters:
x - the x coordinate of the anchor point
y - the y coordinate of the anchor point
w - the width of the filter region
h - the height of the filter region
See Also:
setFilterX(int), setFilterY(int), setFilterWidth(int), setFilterHeight(int)

setFilterVal

public void setFilterVal(int v)
Sets the filter strength value. The minimum value is 0 and maximum is 100. If the specified parameter value is out of range, the filter value defaults to 50.
Parameters:
v - the filter value

getFilterVal

public int getFilterVal()
Gets the filter value.
Returns:
the filter value
See Also:
setFilterVal(int)

setFilterType

public void setFilterType(int filter)
Sets the filter type. Filters are defined by static integer fields.
Parameters:
filter - the filter type
See Also:
getFilterType()

getFilterType

public int getFilterType()
Gets the filter type.
Returns:
int the filter type