Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.util
Class GraphicUtils

java.lang.Object
  extended by net.java.sip.communicator.util.GraphicUtils

public class GraphicUtils
extends Object

The GraphicUtils is an utility class that gives access to some simple graphics operations, like an easy creating of a clipped shape or image, or painting of a border glow. Most of the code in this class is based on advices and examples in the "Java 2D Trickery: Soft Clipping".

Author:
Yana Stamcheva

Constructor Summary
GraphicUtils()
           
 
Method Summary
static BufferedImage createClipImage(Graphics2D g, Shape shape)
          Creates a clipped image from the given shape.
static Shape createRoundedClipShape(int shapeWidth, int shapeHeight, int arcW, int arcH)
          Creates a rounded clipped shape with the given shapeWidth, shapeHeight, arc width and arc height.
static void paintBorderGlow(Graphics2D g2, int glowWidth, Shape clipShape, Color glowOuterHigh, Color glowOuterLow)
          Paints border glow over the given clipShape with the given glow high and low colors and the given glowWidth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicUtils

public GraphicUtils()
Method Detail

createRoundedClipShape

public static Shape createRoundedClipShape(int shapeWidth,
                                           int shapeHeight,
                                           int arcW,
                                           int arcH)
Creates a rounded clipped shape with the given shapeWidth, shapeHeight, arc width and arc height.

Parameters:
shapeWidth - the width of the shape to create
shapeHeight - the height of the shape to create
arcW - the width of the arc to use to round the corners of the newly created shape
arcH - the height of the arc to use to round the corners of the newly created shape
Returns:
the created shape

createClipImage

public static BufferedImage createClipImage(Graphics2D g,
                                            Shape shape)
Creates a clipped image from the given shape.

Parameters:
shape - the shape from which to create the image
g - the Graphics object giving access to the graphics device configuration
Returns:
the created BufferedImage

paintBorderGlow

public static void paintBorderGlow(Graphics2D g2,
                                   int glowWidth,
                                   Shape clipShape,
                                   Color glowOuterHigh,
                                   Color glowOuterLow)
Paints border glow over the given clipShape with the given glow high and low colors and the given glowWidth.

Parameters:
g2 - the Graphics object to use for painting
glowWidth - the width of the glow
clipShape - the shape where to paint the glow
glowOuterHigh - the color which will paint the higher glow
glowOuterLow - the color which will paint the lower glow

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.