org.tbray.framer
Class Framer

java.lang.Object
  extended by org.tbray.framer.Framer

public class Framer
extends java.lang.Object

Decorates an image with a border, a drop-shadow, or both.


Constructor Summary
Framer(java.awt.image.BufferedImage in)
          Make a new Framer, to operate on the provided image.
 
Method Summary
 java.awt.image.BufferedImage frame()
          Frame an image.
 int getBorderColor()
          Get the border color
 int getBorderWidth()
          Get the border width.
 int getShadowColor()
          Get the shadow color.
 int getShadowDepth()
          Get the shadow depth.
static void main(java.lang.String[] args)
          Command-line access.
 void setBorderColor(int color)
          Set the border color.
 void setBorderWidth(int width)
          Set the border width.
 void setShadowColor(int color)
          Set the shadow color.
 void setShadowDepth(int depth)
          Set the shadow depth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Framer

public Framer(java.awt.image.BufferedImage in)
Make a new Framer, to operate on the provided image.

Method Detail

main

public static void main(java.lang.String[] args)
Command-line access. Arguments may be provided in any order and are sticky. That is to say, you could say -bordercolor ff0000 p1.jpg p1.png -bordercolor 00ff00 p2.jpg p2.png The output is always a PNG, because the drop shadow is done with an alpha channel for transparency. Arguments are:
 -borderColor [hex color] (default a9a9a9)
 -borderWidth [int] (default 0)
 -shadowColor [hex color] (default 000000)
 -shadowDepth [int]  (default 9)
 


setBorderWidth

public void setBorderWidth(int width)
Set the border width.

Parameters:
width - the border width in pixels.
Throws:
e - RuntimeException if the width is negative.

getBorderWidth

public int getBorderWidth()
Get the border width.

Returns:
the border width, in pixels.

setBorderColor

public void setBorderColor(int color)
Set the border color.

Parameters:
color - the border color, in ARGB format; If the first byte (alpha) is zero, you won't see anything.

getBorderColor

public int getBorderColor()
Get the border color

Returns:
the border color, in ARGB format.

setShadowDepth

public void setShadowDepth(int depth)
Set the shadow depth.

Parameters:
depth - the depth, in pixels, on the sides where the shadow is wide.
Throws:
e - a RuntimeException if the depth is negative.

getShadowDepth

public int getShadowDepth()
Get the shadow depth.

Returns:
the shadow depth, in pixels.

setShadowColor

public void setShadowColor(int color)
Set the shadow color.

Parameters:
color - the color, in RGB format; not RGB because the software will change the values of the alpha byte.

getShadowColor

public int getShadowColor()
Get the shadow color.

Returns:
the shadow color, in RGB format.

frame

public java.awt.image.BufferedImage frame()
Frame an image.

Returns:
the image, of type BufferedImage.TYPE_INT_ARGB