org.zilonis.tool.ext.aerith.g2d
Class GraphicsUtil

java.lang.Object
  extended by org.zilonis.tool.ext.aerith.g2d.GraphicsUtil

public class GraphicsUtil
extends java.lang.Object


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
static java.awt.image.BufferedImage createCompatibleImage(int width, int height)
           
static java.awt.image.BufferedImage createThumbnail(java.awt.image.BufferedImage image, int requestedThumbSize)
           
static java.awt.image.BufferedImage createThumbnail(java.awt.image.BufferedImage image, int newWidth, int newHeight)
           
static java.awt.image.BufferedImage createTranslucentCompatibleImage(int width, int height)
           
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 java.lang.String getColorHexString(java.awt.Color c)
           
static boolean is_BYTE_COMP_Data(java.awt.image.SampleModel sm)
           
static boolean is_INT_PACK_Data(java.awt.image.SampleModel sm, boolean requireAlpha)
           
static java.awt.image.BufferedImage loadCompatibleImage(java.net.URL resource)
           
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)
           
static void tileStretchPaint(java.awt.Graphics g, javax.swing.JComponent comp, java.awt.image.BufferedImage img, java.awt.Insets ins)
          Draws an image on top of a component by doing a 3x3 grid stretch of the image using the specified insets.
static java.awt.image.BufferedImage toCompatibleImage(java.awt.image.BufferedImage image)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createCompatibleImage

public static java.awt.image.BufferedImage createCompatibleImage(int width,
                                                                 int height)

createTranslucentCompatibleImage

public static java.awt.image.BufferedImage createTranslucentCompatibleImage(int width,
                                                                            int height)

loadCompatibleImage

public static java.awt.image.BufferedImage loadCompatibleImage(java.net.URL resource)
                                                        throws java.io.IOException
Throws:
java.io.IOException

toCompatibleImage

public static java.awt.image.BufferedImage toCompatibleImage(java.awt.image.BufferedImage image)

createThumbnail

public static java.awt.image.BufferedImage createThumbnail(java.awt.image.BufferedImage image,
                                                           int requestedThumbSize)

createThumbnail

public static java.awt.image.BufferedImage createThumbnail(java.awt.image.BufferedImage image,
                                                           int newWidth,
                                                           int newHeight)

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)

getColorHexString

public static java.lang.String getColorHexString(java.awt.Color c)

tileStretchPaint

public static void tileStretchPaint(java.awt.Graphics g,
                                    javax.swing.JComponent comp,
                                    java.awt.image.BufferedImage img,
                                    java.awt.Insets ins)
Draws an image on top of a component by doing a 3x3 grid stretch of the image using the specified insets.