com.miginfocom.util.gfx
Class SliceSpec

java.lang.Object
  extended by com.miginfocom.util.gfx.SliceSpec
All Implemented Interfaces:
java.io.Serializable

public class SliceSpec
extends java.lang.Object
implements java.io.Serializable

A specification on how an image should be sliced into 3x3 slices. Just an info-holder, like a struct.

See Also:
Serialized Form

Field Summary
static boolean[] OPT_ALL
          Paints all slices.
static boolean[] OPT_BORDER
          Paints all 8 edge slices.
static boolean[] OPT_BOTTOM_LEFT
          Paints 5 lower left edge slices.
static boolean[] OPT_BOTTOM_RIGHT
          Paints 5 lower right edge slices.
static boolean[] OPT_TOP_LEFT
          Paints 5 top left edge slices.
static boolean[] OPT_TOP_RIGHT
          Paints 5 top right edge slices.
static int TYPE_STRETCH
          Stretches the slice to fit
static int TYPE_TILE_CUT
          Tiles the slice to fit a larger size and cuts it to fit a smaller size.
static int TYPE_TILE_SHRINK
          Tiles the slice to fit a larger size and shrinks by compressing (scale) to fit a smaller size.
 
Constructor Summary
SliceSpec(java.awt.Insets sliceCuts, int paintType)
          Constructor.
SliceSpec(java.awt.Insets sliceCuts, int paintType, boolean[] pntSlices)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 boolean[] getPaintedSlices()
          Returns the paint optimization.
 int getPaintType()
          How to paint the side slices (not corners).
 java.awt.Insets getSliceCuts()
          Returns how to slice the image, normally into nine parts.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPT_ALL

public static final boolean[] OPT_ALL
Paints all slices. (No optimization). Value actually null.


OPT_BOTTOM_RIGHT

public static final boolean[] OPT_BOTTOM_RIGHT
Paints 5 lower right edge slices.


OPT_BOTTOM_LEFT

public static final boolean[] OPT_BOTTOM_LEFT
Paints 5 lower left edge slices.


OPT_TOP_RIGHT

public static final boolean[] OPT_TOP_RIGHT
Paints 5 top right edge slices.


OPT_TOP_LEFT

public static final boolean[] OPT_TOP_LEFT
Paints 5 top left edge slices.


OPT_BORDER

public static final boolean[] OPT_BORDER
Paints all 8 edge slices.


TYPE_TILE_SHRINK

public static final int TYPE_TILE_SHRINK
Tiles the slice to fit a larger size and shrinks by compressing (scale) to fit a smaller size.

See Also:
Constant Field Values

TYPE_TILE_CUT

public static final int TYPE_TILE_CUT
Tiles the slice to fit a larger size and cuts it to fit a smaller size.

See Also:
Constant Field Values

TYPE_STRETCH

public static final int TYPE_STRETCH
Stretches the slice to fit

See Also:
Constant Field Values
Constructor Detail

SliceSpec

public SliceSpec(java.awt.Insets sliceCuts,
                 int paintType)
Constructor. Throws IllegalArgumentException if erratic input.

Parameters:
sliceCuts - How to slice the image. Not null.
paintType - How to paint the slices (not corners). E.g. TYPE_TILE_SHRINK

SliceSpec

public SliceSpec(java.awt.Insets sliceCuts,
                 int paintType,
                 boolean[] pntSlices)
Constructor. Throws IllegalArgumentException if erratic input.

Parameters:
sliceCuts - How to slice the image. Not null.
paintType - How to paint the slices (not corners). E.g. TYPE_TILE_SHRINK
pntSlices - Which slices to paint. Can be used for instance to paint only the botton and right slices for a shadow.
The order is topLeft, topMiddle, topRight, middleLeft, middleMiddle etc. Length should always be 9 or the array can be null which means paint all slices. E.g. OPT_ALL or OPT_BOTTOM_RIGHT.
This optimization is currently turned off if the center slice is very small to avoid artifacts.
Method Detail

getPaintedSlices

public boolean[] getPaintedSlices()
Returns the paint optimization. I.e. which slices to actually paint/draw

Returns:
The paint optimization. E.g. OPT_TOP_LEFT. Can be null, otherwise always of length 9.

getSliceCuts

public java.awt.Insets getSliceCuts()
Returns how to slice the image, normally into nine parts.

Returns:
How to slice the image. The returned object is NOT cloned and must not be changed. Never null.

getPaintType

public int getPaintType()
How to paint the side slices (not corners).

Returns:
How to paint the side slices. E.g. TYPE_STRETCH

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.