org.xith3d.utility.image
Class DrawingTools

java.lang.Object
  extended by org.xith3d.utility.image.DrawingTools

public class DrawingTools
extends java.lang.Object

A bunch of static functions meant to be used as helpers in the various control paint functions.


Constructor Summary
DrawingTools()
           
 
Method Summary
static void adjustAlpha(java.awt.image.BufferedImage image, float alpha)
           
static void centerShadowedText(java.awt.Component c, java.awt.Graphics g, java.lang.String text)
           
static void centerText(java.awt.Component c, java.awt.Graphics g, java.lang.String text)
           
static void centerText(java.awt.Rectangle r, java.awt.Graphics g, java.lang.String text)
           
static void drawBorderedBox(java.awt.Graphics g, java.awt.Rectangle r, java.awt.image.BufferedImage back, java.awt.image.BufferedImage front)
           
static void drawBox(java.awt.Graphics g, java.awt.Rectangle r, java.awt.Color highlight, java.awt.Color shadow)
           
static void drawImageOnCanvas(java.awt.Graphics g, java.awt.image.BufferedImage back, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
           
static void drawImageOnCanvas(java.awt.Graphics g, int x, int y, java.awt.Rectangle r, java.awt.image.BufferedImage back)
           
static void drawSegmentedImage(java.awt.Graphics g, java.awt.image.BufferedImage image, int height, int width, int topWidth, int bottomWidth, int leftWidth, int rightWidth)
           
static void drawShadowedBox(java.awt.Graphics g, java.awt.Rectangle r, java.awt.Color highlight, java.awt.Color shadow, java.awt.Color internal)
          Draws a shadowed rectagle on the supplied graphics context.
static void drawShadowedBox(java.awt.Graphics g, java.awt.Rectangle r, float alpha)
           
static void drawShadowedBox(java.awt.Graphics g, java.awt.Rectangle r, float highlightAlpha, float shadowAlpha, float insideAlpha)
           
static void drawText(java.awt.Rectangle r, java.awt.Graphics g, java.lang.String text)
           
static void fillWithBackground(java.awt.Graphics g, java.awt.Rectangle r, java.awt.image.BufferedImage back)
           
static void tileSegmentsHorizontally(java.awt.Graphics g, java.awt.image.BufferedImage image, int leftWidth, int rightWidth, int dy, int sy, int width, int height)
          tiles an image horizonatally in 3 segments, the first segment is the left side, the second segment (repeated) is the middle segment and the final segment is the right hand side.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawingTools

public DrawingTools()
Method Detail

centerText

public static void centerText(java.awt.Component c,
                              java.awt.Graphics g,
                              java.lang.String text)

centerText

public static void centerText(java.awt.Rectangle r,
                              java.awt.Graphics g,
                              java.lang.String text)

drawText

public static void drawText(java.awt.Rectangle r,
                            java.awt.Graphics g,
                            java.lang.String text)

centerShadowedText

public static void centerShadowedText(java.awt.Component c,
                                      java.awt.Graphics g,
                                      java.lang.String text)

drawImageOnCanvas

public static void drawImageOnCanvas(java.awt.Graphics g,
                                     java.awt.image.BufferedImage back,
                                     int dx1,
                                     int dy1,
                                     int dx2,
                                     int dy2,
                                     int sx1,
                                     int sy1,
                                     int sx2,
                                     int sy2)

tileSegmentsHorizontally

public static void tileSegmentsHorizontally(java.awt.Graphics g,
                                            java.awt.image.BufferedImage image,
                                            int leftWidth,
                                            int rightWidth,
                                            int dy,
                                            int sy,
                                            int width,
                                            int height)
tiles an image horizonatally in 3 segments, the first segment is the left side, the second segment (repeated) is the middle segment and the final segment is the right hand side.

Parameters:
g -
image - Image containing the segment to be tiled
leftWidth - The width of the first segment
rightWidth - The width of the thrid segment
dy - The destination Y value
sy - The source Y value
width - The width of the target area
height - The height of the target area

drawSegmentedImage

public static void drawSegmentedImage(java.awt.Graphics g,
                                      java.awt.image.BufferedImage image,
                                      int height,
                                      int width,
                                      int topWidth,
                                      int bottomWidth,
                                      int leftWidth,
                                      int rightWidth)

drawImageOnCanvas

public static void drawImageOnCanvas(java.awt.Graphics g,
                                     int x,
                                     int y,
                                     java.awt.Rectangle r,
                                     java.awt.image.BufferedImage back)

fillWithBackground

public static void fillWithBackground(java.awt.Graphics g,
                                      java.awt.Rectangle r,
                                      java.awt.image.BufferedImage back)

drawBorderedBox

public static void drawBorderedBox(java.awt.Graphics g,
                                   java.awt.Rectangle r,
                                   java.awt.image.BufferedImage back,
                                   java.awt.image.BufferedImage front)

drawShadowedBox

public static void drawShadowedBox(java.awt.Graphics g,
                                   java.awt.Rectangle r,
                                   java.awt.Color highlight,
                                   java.awt.Color shadow,
                                   java.awt.Color internal)
Draws a shadowed rectagle on the supplied graphics context. This is a utility function to be used in drawing panels and windows.


drawBox

public static void drawBox(java.awt.Graphics g,
                           java.awt.Rectangle r,
                           java.awt.Color highlight,
                           java.awt.Color shadow)

drawShadowedBox

public static void drawShadowedBox(java.awt.Graphics g,
                                   java.awt.Rectangle r,
                                   float alpha)

drawShadowedBox

public static void drawShadowedBox(java.awt.Graphics g,
                                   java.awt.Rectangle r,
                                   float highlightAlpha,
                                   float shadowAlpha,
                                   float insideAlpha)

adjustAlpha

public static void adjustAlpha(java.awt.image.BufferedImage image,
                               float alpha)