com.wirefusion.player
Class WfGraphics

java.lang.Object
  extended by java.awt.Graphics
      extended by com.wirefusion.player.WfGraphics

public final class WfGraphics
extends java.awt.Graphics

This object contains methods for painting. The graphics objects sent to Wob.paint(Graphics g) are of this type.

WfGraphics is a subclass of java.awt.Graphics, and has support for most of the methods in Graphics. In addition to these standard Graphics methods, a range of WireFusion specific methods have been added to WfGraphics; the drawWfImage methods and drawTiledWfImage. These methods draws WfImage images and are very fast, regardless of the Java version.

If you use the standard Graphics methods for drawing and the graphics often changes (i.e. new graphics in each frame), then you may get bad performance under Java 1.1. If you on the other hand perform the same graphics operations several times in a row (int "paint"), only the first time you draw the operations will be slow.

Important: It is currently not recommended that you combine the use of drawWfImage methods and the other drawing methods in a WfGraphics object, since the result may be unexpected.

The following Graphics methods are currently not implemented/has no effect:
create(), create(int, int, int, int), dispose(), draw3DRect(int, int, int, int, boolean), drawBytes(byte[], int, int, int, int), drawChars(char[], int, int, int, int), drawString(AttributedCharacterIterator iterator, int x, int y), fill3DRect(int x, int y, int width, int height, boolean raised), drawPolygon(Polygon p), fillPolygon(Polygon p), finalize(), getClip(), getClipBounds(), getClipBounds(Rectangle r), getClipRect(), getFontMetrics(),


Method Summary
 void clearRect(int x, int y, int width, int height)
           
 void clipRect(int x, int y, int width, int height)
           
 void copyArea(int x, int y, int width, int height, int dx, int dy)
           
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
           
 void drawLine(int x1, int y1, int x2, int y2)
           
 void drawOval(int x, int y, int width, int height)
           
 void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
          This method is not implemented.
 void drawString(java.lang.String str, int x, int y)
           
 void drawTiledWfImage(WfImage img, double x, double y, double width, double height, double opacity)
          Tiles an image within the specified rectangular area.
 void drawWfImage(WfImage img, double x, double y)
          The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space.
 void drawWfImage(WfImage img, double x, double y, double width, double height)
          The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary.
 void drawWfImage(WfImage img, double dx1, double dy1, double dx2, double dy2, double sx1, double sy1, double sx2, double sy2, double opacity)
          Draws the specified area of the image inside the specified area of the destination drawable surface.
 void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void fillOval(int x, int y, int width, int height)
           
 void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
           
 void fillRect(int x, int y, int width, int height)
           
 void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 java.awt.Color getColor()
           
 java.awt.Font getFont()
           
 java.awt.FontMetrics getFontMetrics(java.awt.Font f)
           
 void setAntiAliasing(boolean antiAliasing)
           
 void setClip(int x, int y, int width, int height)
           
 void setClip(java.awt.Shape clip)
           
 void setColor(java.awt.Color c)
           
 void setFont(java.awt.Font font)
           
 void setPaintMode()
           
 void setXORMode(java.awt.Color c1)
           
 void translate(int x, int y)
           
 
Methods inherited from class java.awt.Graphics
create, create, dispose, draw3DRect, drawBytes, drawChars, drawPolygon, drawRect, fill3DRect, fillPolygon, finalize, getClip, getClipBounds, getClipBounds, getClipRect, getFontMetrics, hitClip, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setAntiAliasing

public void setAntiAliasing(boolean antiAliasing)
Parameters:
antiAliasing - if true, anti aliasing is enabled, otherwise disabled Note: Anti aliasing is disabled by default (faster drawing). Anti aliasing will only be used if the presentation is running in Java 2.

clearRect

public void clearRect(int x,
                      int y,
                      int width,
                      int height)
Specified by:
clearRect in class java.awt.Graphics

clipRect

public void clipRect(int x,
                     int y,
                     int width,
                     int height)
Specified by:
clipRect in class java.awt.Graphics

copyArea

public void copyArea(int x,
                     int y,
                     int width,
                     int height,
                     int dx,
                     int dy)
Specified by:
copyArea in class java.awt.Graphics

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Specified by:
drawArc in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawImage

public boolean drawImage(java.awt.Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         java.awt.Color bgcolor,
                         java.awt.image.ImageObserver observer)
Specified by:
drawImage in class java.awt.Graphics

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Specified by:
drawLine in class java.awt.Graphics

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Specified by:
drawOval in class java.awt.Graphics

drawPolygon

public void drawPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Specified by:
drawPolygon in class java.awt.Graphics

drawPolyline

public void drawPolyline(int[] xPoints,
                         int[] yPoints,
                         int nPoints)
Specified by:
drawPolyline in class java.awt.Graphics

drawRoundRect

public void drawRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Specified by:
drawRoundRect in class java.awt.Graphics

drawString

public void drawString(java.lang.String str,
                       int x,
                       int y)
Specified by:
drawString in class java.awt.Graphics

drawString

public void drawString(java.text.AttributedCharacterIterator iterator,
                       int x,
                       int y)
This method is not implemented. Calling it has no effect.

Specified by:
drawString in class java.awt.Graphics

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Specified by:
fillArc in class java.awt.Graphics

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Specified by:
fillOval in class java.awt.Graphics

fillPolygon

public void fillPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Specified by:
fillPolygon in class java.awt.Graphics

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
Specified by:
fillRect in class java.awt.Graphics

fillRoundRect

public void fillRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Specified by:
fillRoundRect in class java.awt.Graphics

getColor

public java.awt.Color getColor()
Specified by:
getColor in class java.awt.Graphics

getFont

public java.awt.Font getFont()
Specified by:
getFont in class java.awt.Graphics

getFontMetrics

public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
Specified by:
getFontMetrics in class java.awt.Graphics

setClip

public void setClip(java.awt.Shape clip)
Specified by:
setClip in class java.awt.Graphics

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
Specified by:
setClip in class java.awt.Graphics

setColor

public void setColor(java.awt.Color c)
Specified by:
setColor in class java.awt.Graphics

setFont

public void setFont(java.awt.Font font)
Specified by:
setFont in class java.awt.Graphics

setPaintMode

public void setPaintMode()
Specified by:
setPaintMode in class java.awt.Graphics

setXORMode

public void setXORMode(java.awt.Color c1)
Specified by:
setXORMode in class java.awt.Graphics

translate

public void translate(int x,
                      int y)
Specified by:
translate in class java.awt.Graphics

drawTiledWfImage

public void drawTiledWfImage(WfImage img,
                             double x,
                             double y,
                             double width,
                             double height,
                             double opacity)
Tiles an image within the specified rectangular area. The original size of the image will be drawn. The upper left corner of the image will be displayed at the upper left corner of the specified area.

Parameters:
img - the image to be tiled
x -
y -
width -
height -
opacity - the image opacity (a value between 0 and 100).

drawWfImage

public void drawWfImage(WfImage img,
                        double dx1,
                        double dy1,
                        double dx2,
                        double dy2,
                        double sx1,
                        double sy1,
                        double sx2,
                        double sy2,
                        double opacity)
Draws the specified area of the image inside the specified area of the destination drawable surface. Transparent pixels do not affect whatever pixels are already there. The drawWfImage methods are often faster than their drawImage counterparts.

Parameters:
img - the specified image to be drawn
dx1 - the x coordinate of the first corner of the destination rectangle.
dy1 - the y coordinate of the first corner of the destination rectangle.
dx2 - the x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - the x coordinate of the first corner of the source rectangle.
sy1 - the y coordinate of the first corner of the source rectangle.
sx2 - the x coordinate of the second corner of the source rectangle.
sy2 - the y coordinate of the second corner of the source rectangle.
opacity - the image opacity (a value between 0 and 100).

drawWfImage

public void drawWfImage(WfImage img,
                        double x,
                        double y)
The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. Transparent pixels in the image do not affect whatever pixels are already there. The drawWfImage methods are often faster than their drawImage counterparts.

Parameters:
img - img the specified image to be drawn.
x - the x coordinate.
y - the y coordinate.

drawWfImage

public void drawWfImage(WfImage img,
                        double x,
                        double y,
                        double width,
                        double height)
The image is drawn inside the specified rectangle of this graphics context's coordinate space, and is scaled if necessary. Transparent pixels do not affect whatever pixels are already there. The drawWfImage methods are often faster than their drawImage counterparts.

Parameters:
img - the specified image to be drawn.
x - the x coordinate.
y - the y coordinate.
width - the width of the rectangle.
height - the height of the rectangle.