Groovy Documentation

eu.hansolo.custom
[Java] Enum Shadow

java.lang.Object
  java.lang.Enum
      eu.hansolo.custom.Shadow

public enum Shadow
extends Enum

Authors:
hansolo


Enum Constant Summary
INSTANCE

 
Method Summary
BufferedImage createDropShadow(BufferedImage SRC_IMAGE, int DISTANCE, float ALPHA, int SOFTNESS, int ANGLE, Color SHADOW_COLOR)

BufferedImage createDropShadow(Shape SHAPE, Paint PAINT, Color COLOR, boolean FILLED, Stroke STROKE, Color STROKE_COLOR, int DISTANCE, float ALPHA, int SOFTNESS, int ANGLE, Color SHADOW_COLOR)

BufferedImage createImageFromShape(Shape SHAPE, Paint PAINT, Color COLOR, boolean FILLED, Stroke STROKE, Color STROKE_COLOR)

@author hansolo

BufferedImage createInnerShadow(BufferedImage SOFT_CLIP_IMAGE, Shape SHAPE, int DISTANCE, float ALPHA, Color SHADOW_COLOR, int SOFTNESS, int ANGLE)

BufferedImage createInnerShadow(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR, int DISTANCE, float ALPHA, Color SHADOW_COLOR, int SOFTNESS, int ANGLE)

BufferedImage createSoftClipImage(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR)

Method that creates a intermediate image to enable soft clipping functionality This code was taken from Chris Campbells blog http://weblogs.java.net/blog/campbell/archive/2006/07/java_2d_tricker.html

BufferedImage createSoftClipImage(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR, int SOFTNESS, int TRANSLATE_X, int TRANSLATE_Y)

int[] getPixels(BufferedImage IMAGE, int X, int Y, int W, int H, int[] pixels)

BufferedImage renderDropShadow(BufferedImage IMAGE, int SOFTNESS, float ALPHA, Color SHADOW_COLOR)

void setPixels(BufferedImage IMAGE, int X, int Y, int W, int H, int[] pixels)

Shadow valueOf(String name)

Returns the enum constant of this type with the specified name.

Shadow[] values()

Returns an array containing the constants of this enum type, in the order they are declared.

 
Methods inherited from class Enum
name, equals, toString, hashCode, compareTo, compareTo, valueOf, getDeclaringClass, ordinal, wait, wait, wait, getClass, notify, notifyAll
 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Enum Constant Detail

INSTANCE

Shadow INSTANCE


 
Method Detail

createDropShadow

public BufferedImage createDropShadow(BufferedImage SRC_IMAGE, int DISTANCE, float ALPHA, int SOFTNESS, int ANGLE, Color SHADOW_COLOR)


createDropShadow

public BufferedImage createDropShadow(Shape SHAPE, Paint PAINT, Color COLOR, boolean FILLED, Stroke STROKE, Color STROKE_COLOR, int DISTANCE, float ALPHA, int SOFTNESS, int ANGLE, Color SHADOW_COLOR)


createImageFromShape

public BufferedImage createImageFromShape(Shape SHAPE, Paint PAINT, Color COLOR, boolean FILLED, Stroke STROKE, Color STROKE_COLOR)
Authors:
hansolo


createInnerShadow

public BufferedImage createInnerShadow(BufferedImage SOFT_CLIP_IMAGE, Shape SHAPE, int DISTANCE, float ALPHA, Color SHADOW_COLOR, int SOFTNESS, int ANGLE)

Method to create a inner shadow on a given shape

Parameters:
SOFT_CLIP_IMAGE - softclipimage create by method createSoftClipImage()
SHAPE - shape that should get the inner shadow
DISTANCE - distance of the shadow
ALPHA - alpha value of the shadow
SHADOW_COLOR - color of the shadow
SOFTNESS - softness/fuzzyness of the shadow
ANGLE - angle under which the shadow should appear
Returns:
IMAGE buffered image that contains the shape including the inner shadow


createInnerShadow

public BufferedImage createInnerShadow(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR, int DISTANCE, float ALPHA, Color SHADOW_COLOR, int SOFTNESS, int ANGLE)

Method to create a inner shadow on a given shape

Parameters:
SHAPE - shape that should get the inner shadow
SHAPE_PAINT - paint of the given shape
SHAPE_COLOR - color of the given shape
DISTANCE - distance of the shadow
ALPHA - alpha value of the shadow
SHADOW_COLOR - color of the shadow
SOFTNESS - softness/fuzzyness of the shadow
ANGLE - angle under which the shadow should appear
Returns:
IMAGE buffered image that contains the shape including the inner shadow


createSoftClipImage

public BufferedImage createSoftClipImage(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR)
Method that creates a intermediate image to enable soft clipping functionality This code was taken from Chris Campbells blog http://weblogs.java.net/blog/campbell/archive/2006/07/java_2d_tricker.html
Parameters:
SHAPE
SHAPE_PAINT
SHAPE_COLOR
Returns:


createSoftClipImage

public BufferedImage createSoftClipImage(Shape SHAPE, Paint SHAPE_PAINT, Color SHAPE_COLOR, int SOFTNESS, int TRANSLATE_X, int TRANSLATE_Y)

Method that creates a intermediate image to enable soft clipping functionality This code was taken from Chris Campbells blog http://weblogs.java.net/blog/campbell/archive/2006/07/java_2d_tricker.html

Parameters:
SHAPE
SHAPE_PAINT
SHAPE_COLOR
SOFTNESS
TRANSLATE_X
TRANSLATE_Y
Returns:
buffered image needed for soft clipping


getPixels

public int[] getPixels(BufferedImage IMAGE, int X, int Y, int W, int H, int[] pixels)

Returns an array of pixels, stored as integers, from a BufferedImage. The pixels are grabbed from a rectangular area defined by a location and two dimensions. Calling this method on an image of type different from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB will unmanage the image.

throws:
IllegalArgumentException is pixels is non-null and of length < w*h
Parameters:
IMAGE - the source image
X - the x location at which to start grabbing pixels
Y - the y location at which to start grabbing pixels
W - the width of the rectangle of pixels to grab
H - the height of the rectangle of pixels to grab
pixels - a pre-allocated array of pixels of size w*h; can be null
Returns:
pixels if non-null, a new array of integers otherwise


renderDropShadow

public BufferedImage renderDropShadow(BufferedImage IMAGE, int SOFTNESS, float ALPHA, Color SHADOW_COLOR)

Generates the shadow for a given picture and the current properties of the renderer.

The generated image dimensions are computed as following

 width  = imageWidth  + 2 * shadowSize
 height = imageHeight + 2 * shadowSize
 
Parameters:
IMAGE - the picture from which the shadow must be cast
SOFTNESS
ALPHA
SHADOW_COLOR
Returns:
the picture containing the shadow of image


setPixels

public void setPixels(BufferedImage IMAGE, int X, int Y, int W, int H, int[] pixels)

Writes a rectangular area of pixels in the destination BufferedImage. Calling this method on an image of type different from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB will unmanage the image.

throws:
IllegalArgumentException is pixels is non-null and of length < w*h
Parameters:
IMAGE - the destination image
X - the x location at which to start storing pixels
Y - the y location at which to start storing pixels
W - the width of the rectangle of pixels to store
H - the height of the rectangle of pixels to store
pixels - an array of pixels, stored as integers


valueOf

Shadow valueOf(String name)
Returns the enum constant of this type with the specified name.


values

Shadow[] values()
Returns an array containing the constants of this enum type, in the order they are declared.


 

Groovy Documentation