Task.Support.GUISupport
Class DrawingUtils

java.lang.Object
  extended by Task.Support.GUISupport.DrawingUtils

public class DrawingUtils
extends java.lang.Object

DrawingUtils is a utility class that helps with drawing operations - reflections and other effects.

Since:
Apr 20, 2007, 2:56:50 PM
Version:
1.0
Author:
Nazmul Idris

Field Summary
static java.awt.Color[] GRAY_4GRAD
           
static java.awt.Color[] REV_GRAY_4GRAD
           
static java.awt.Color[] WHITE_2GRAD
           
 
Constructor Summary
DrawingUtils()
           
 
Method Summary
static java.awt.Graphics2D applyDesktopAASettings(java.awt.Graphics2D g)
          Applies the Desktop Anti Aliasing settings to the given Graphics2D object.
static java.awt.Graphics2D applySmoothDrawingSettings(java.awt.Graphics2D g)
          Applies AA settings to the Graphics2D context for smoothing out drawing.
static void drawBorderedTranslucentImage(java.awt.Graphics g, int width, int height, boolean enabled, java.awt.Color[] fourGradientTheme)
          Given a BufferedImage, this method returns a rounded, gradient, translucency effect on top of it, and retursn it as a new BufferedImage.
static void drawSemiTransparentShade(java.awt.Graphics g, int width, int height, java.awt.Color[] twoGradientTheme)
           
static void drawShade4Stops(java.awt.Graphics g, int width, int height, java.awt.Color[] fourGradientTheme, float alpha)
           
static void drawShadeFast(java.awt.Graphics g, int width, int height, java.awt.Color[] twoGradientTheme, float alpha)
           
static void drawShadeNormal(java.awt.Graphics g, int width, int height, java.awt.Color[] twoGradientTheme, float alpha)
           
static java.awt.image.BufferedImage getBlurredImage(java.awt.image.BufferedImage buf)
          Given a BufferedImage, this method returns a blurred version of the image as a new BufferedImage.
static com.sun.java.swing.Painter getContentPanelBgPainter()
           
static javax.swing.border.Border getDarkBorder()
           
static com.sun.java.swing.Painter getDisabledGlassPaneBgPainter(int width, int height)
           
static com.sun.java.swing.Painter getDropTargetLabelBgPainter()
           
static java.awt.image.BufferedImage getGlossyImage(java.awt.image.BufferedImage image)
           
static java.awt.image.BufferedImage getGlossyImage(java.awt.image.BufferedImage image, java.awt.Color color, org.jdesktop.swingx.painter.GlossPainter.GlossPosition position)
          given a bufferedimage, returns a glossy version of the image, with the given color and gloss position applied
static com.sun.java.swing.Painter getGradientFillBgPainter(int width, int height, java.awt.Color color1, java.awt.Color color2)
           
static com.sun.java.swing.Painter getHeaderPanelBgPainter()
           
static com.sun.java.swing.Painter getInfoLabelBgPainter()
           
static javax.swing.border.Border getLightBorder()
           
static com.sun.java.swing.Painter getPanelBgPainter()
           
static java.awt.image.BufferedImage getReflection(java.awt.image.BufferedImage img, float length, float opacity, boolean blur)
           
static org.jdesktop.swingx.painter.RectanglePainter getRoundedRectanglePainter(java.awt.Color fillColor, java.awt.Color borderColor, int borderWidth, org.jdesktop.swingx.painter.AbstractAreaPainter.Style style, int roundedWidth)
           
static com.sun.java.swing.Painter getStatusUpdaterBgPainter()
           
static java.awt.geom.Rectangle2D getTextBounds(java.awt.Graphics2D g2, java.awt.Font font, java.lang.String str)
           
static java.awt.image.BufferedImage getTranslucentImage(java.awt.image.BufferedImage buf, float translucency)
          Given a BufferedImage, this method returns a translucent version of this image as a new BufferedImage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE_2GRAD

public static java.awt.Color[] WHITE_2GRAD

GRAY_4GRAD

public static java.awt.Color[] GRAY_4GRAD

REV_GRAY_4GRAD

public static java.awt.Color[] REV_GRAY_4GRAD
Constructor Detail

DrawingUtils

public DrawingUtils()
Method Detail

getTextBounds

public static final java.awt.geom.Rectangle2D getTextBounds(java.awt.Graphics2D g2,
                                                            java.awt.Font font,
                                                            java.lang.String str)
                                                     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

applyDesktopAASettings

public static java.awt.Graphics2D applyDesktopAASettings(java.awt.Graphics2D g)
Applies the Desktop Anti Aliasing settings to the given Graphics2D object. If you do not want this setting propagated, be sure to dispose() your graphics context after using it.


applySmoothDrawingSettings

public static java.awt.Graphics2D applySmoothDrawingSettings(java.awt.Graphics2D g)
Applies AA settings to the Graphics2D context for smoothing out drawing. Use this if you do not want jagged edges on things that you draw on the screen. Call dispose() on your Graphics2D object if you do not want these settings to propagate.


getLightBorder

public static javax.swing.border.Border getLightBorder()

getDarkBorder

public static javax.swing.border.Border getDarkBorder()

getReflection

public static java.awt.image.BufferedImage getReflection(java.awt.image.BufferedImage img,
                                                         float length,
                                                         float opacity,
                                                         boolean blur)

getGlossyImage

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

getGlossyImage

public static java.awt.image.BufferedImage getGlossyImage(java.awt.image.BufferedImage image,
                                                          java.awt.Color color,
                                                          org.jdesktop.swingx.painter.GlossPainter.GlossPosition position)
given a bufferedimage, returns a glossy version of the image, with the given color and gloss position applied


getRoundedRectanglePainter

public static org.jdesktop.swingx.painter.RectanglePainter getRoundedRectanglePainter(java.awt.Color fillColor,
                                                                                      java.awt.Color borderColor,
                                                                                      int borderWidth,
                                                                                      org.jdesktop.swingx.painter.AbstractAreaPainter.Style style,
                                                                                      int roundedWidth)

getDropTargetLabelBgPainter

public static com.sun.java.swing.Painter getDropTargetLabelBgPainter()

getPanelBgPainter

public static com.sun.java.swing.Painter getPanelBgPainter()

getStatusUpdaterBgPainter

public static com.sun.java.swing.Painter getStatusUpdaterBgPainter()

getInfoLabelBgPainter

public static com.sun.java.swing.Painter getInfoLabelBgPainter()

getContentPanelBgPainter

public static com.sun.java.swing.Painter getContentPanelBgPainter()

getHeaderPanelBgPainter

public static com.sun.java.swing.Painter getHeaderPanelBgPainter()

getGradientFillBgPainter

public static com.sun.java.swing.Painter getGradientFillBgPainter(int width,
                                                                  int height,
                                                                  java.awt.Color color1,
                                                                  java.awt.Color color2)

getDisabledGlassPaneBgPainter

public static com.sun.java.swing.Painter getDisabledGlassPaneBgPainter(int width,
                                                                       int height)

getBlurredImage

public static java.awt.image.BufferedImage getBlurredImage(java.awt.image.BufferedImage buf)
Given a BufferedImage, this method returns a blurred version of the image as a new BufferedImage.


getTranslucentImage

public static java.awt.image.BufferedImage getTranslucentImage(java.awt.image.BufferedImage buf,
                                                               float translucency)
Given a BufferedImage, this method returns a translucent version of this image as a new BufferedImage.

Parameters:
translucency - between 0f and 1f.

drawBorderedTranslucentImage

public static void drawBorderedTranslucentImage(java.awt.Graphics g,
                                                int width,
                                                int height,
                                                boolean enabled,
                                                java.awt.Color[] fourGradientTheme)
Given a BufferedImage, this method returns a rounded, gradient, translucency effect on top of it, and retursn it as a new BufferedImage.


drawSemiTransparentShade

public static void drawSemiTransparentShade(java.awt.Graphics g,
                                            int width,
                                            int height,
                                            java.awt.Color[] twoGradientTheme)

drawShadeNormal

public static void drawShadeNormal(java.awt.Graphics g,
                                   int width,
                                   int height,
                                   java.awt.Color[] twoGradientTheme,
                                   float alpha)

drawShadeFast

public static void drawShadeFast(java.awt.Graphics g,
                                 int width,
                                 int height,
                                 java.awt.Color[] twoGradientTheme,
                                 float alpha)
Parameters:
alpha - this is ignored... kept to have same method signature as drawShadeNormal(java.awt.Graphics, int, int, java.awt.Color[], float)

drawShade4Stops

public static void drawShade4Stops(java.awt.Graphics g,
                                   int width,
                                   int height,
                                   java.awt.Color[] fourGradientTheme,
                                   float alpha)


Copyright © 2011. All Rights Reserved.