org.formaria.batik.ext.awt.image
Class GraphicsUtil

java.lang.Object
  extended by org.formaria.batik.ext.awt.image.GraphicsUtil

public class GraphicsUtil
extends java.lang.Object

Set of utility methods for Graphics. These generally bypass broken methods in Java2D or provide tweaked implementations.


Field Summary
static java.awt.geom.AffineTransform IDENTITY
           
 
Constructor Summary
GraphicsUtil()
           
 
Method Summary
static java.awt.image.ColorModel coerceColorModel(java.awt.image.ColorModel cm, boolean newAlphaPreMult)
          Create a new ColorModel with it's alpha premultiplied state matching newAlphaPreMult.
static java.awt.image.ColorModel coerceData(java.awt.image.WritableRaster wr, java.awt.image.ColorModel cm, boolean newAlphaPreMult)
          Coerces data within a bufferedImage to match newAlphaPreMult, Note that this can not change the colormodel of bi so you
protected static void divide_BYTE_COMP_Data(java.awt.image.WritableRaster wr)
           
protected static void divide_INT_PACK_Data(java.awt.image.WritableRaster wr)
           
static void divideAlpha(java.awt.image.WritableRaster wr)
           
static boolean is_BYTE_COMP_Data(java.awt.image.SampleModel sm)
           
static boolean is_INT_PACK_Data(java.awt.image.SampleModel sm, boolean requireAlpha)
           
protected static void mult_BYTE_COMP_Data(java.awt.image.WritableRaster wr)
           
protected static void mult_INT_PACK_Data(java.awt.image.WritableRaster wr)
           
static void multiplyAlpha(java.awt.image.WritableRaster wr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY

public static java.awt.geom.AffineTransform IDENTITY
Constructor Detail

GraphicsUtil

public GraphicsUtil()
Method Detail

coerceColorModel

public static java.awt.image.ColorModel coerceColorModel(java.awt.image.ColorModel cm,
                                                         boolean newAlphaPreMult)
Create a new ColorModel with it's alpha premultiplied state matching newAlphaPreMult.

Parameters:
cm - The ColorModel to change the alpha premult state of.
newAlphaPreMult - The new state of alpha premult.
Returns:
A new colorModel that has isAlphaPremultiplied() equal to newAlphaPreMult.

coerceData

public static java.awt.image.ColorModel coerceData(java.awt.image.WritableRaster wr,
                                                   java.awt.image.ColorModel cm,
                                                   boolean newAlphaPreMult)
Coerces data within a bufferedImage to match newAlphaPreMult, Note that this can not change the colormodel of bi so you

Parameters:
wr - The raster to change the state of.
cm - The colormodel currently associated with data in wr.
newAlphaPreMult - The desired state of alpha Premult for raster.
Returns:
A new colormodel that matches newAlphaPreMult.

multiplyAlpha

public static void multiplyAlpha(java.awt.image.WritableRaster wr)

divideAlpha

public static void divideAlpha(java.awt.image.WritableRaster wr)

is_INT_PACK_Data

public static boolean is_INT_PACK_Data(java.awt.image.SampleModel sm,
                                       boolean requireAlpha)

is_BYTE_COMP_Data

public static boolean is_BYTE_COMP_Data(java.awt.image.SampleModel sm)

divide_INT_PACK_Data

protected static void divide_INT_PACK_Data(java.awt.image.WritableRaster wr)

mult_INT_PACK_Data

protected static void mult_INT_PACK_Data(java.awt.image.WritableRaster wr)

divide_BYTE_COMP_Data

protected static void divide_BYTE_COMP_Data(java.awt.image.WritableRaster wr)

mult_BYTE_COMP_Data

protected static void mult_BYTE_COMP_Data(java.awt.image.WritableRaster wr)