Package com.twelvemonkeys.image
Class GraphicsUtil
- java.lang.Object
-
- com.twelvemonkeys.image.GraphicsUtil
-
public final class GraphicsUtil extends java.lang.ObjectGraphicsUtil- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/GraphicsUtil.java#1 $
-
-
Constructor Summary
Constructors Constructor Description GraphicsUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidenableAA(java.awt.Graphics pGraphics)Enables anti-aliasing in theGraphicsobject.static voidsetAlpha(java.awt.Graphics pGraphics, float pAlpha)Sets the alpha in theGraphicsobject.
-
-
-
Method Detail
-
enableAA
public static void enableAA(java.awt.Graphics pGraphics)
Enables anti-aliasing in theGraphicsobject.Anti-aliasing is enabled by casting to
Graphics2Dand setting the rendering hintRenderingHints.KEY_ANTIALIASINGtoRenderingHints.VALUE_ANTIALIAS_ON.- Parameters:
pGraphics- the graphics object- Throws:
java.lang.ClassCastException- ifpGraphicsis not an instance ofGraphics2D.- See Also:
RenderingHints.KEY_ANTIALIASING
-
setAlpha
public static void setAlpha(java.awt.Graphics pGraphics, float pAlpha)Sets the alpha in theGraphicsobject.Alpha is set by casting to
Graphics2Dand setting the composite to the ruleAlphaComposite.SRC_OVERmultiplied by the given alpha.- Parameters:
pGraphics- the graphics objectpAlpha- the alpha level,alphamust be a floating point number in the inclusive range [0.0, 1.0].- Throws:
java.lang.ClassCastException- ifpGraphicsis not an instance ofGraphics2D.- See Also:
AlphaComposite.SRC_OVER,AlphaComposite.getInstance(int, float)
-
-