javax.media.j3d
Class J3DGraphics2DImpl

java.lang.Object
  extended by java.awt.Graphics
      extended by java.awt.Graphics2D
          extended by javax.media.j3d.J3DGraphics2D
              extended by javax.media.j3d.J3DGraphics2DImpl

final class J3DGraphics2DImpl
extends J3DGraphics2D

Implementation class for J3DGraphics2D


Field Summary
private  boolean abgr
           
(package private) static java.awt.Color blackTransparent
           
private  Canvas3D canvas3d
           
private  byte[] data
           
private  java.lang.Object extentLock
           
private  java.awt.image.BufferedImage g3dImage
           
private  boolean hasBeenDisposed
           
private  int height
           
private  boolean initCtx
           
private  boolean initTexMap
           
private  boolean isFlushed
           
(package private)  int objectId
           
private  java.awt.Graphics2D offScreenGraphics2D
           
private  java.awt.geom.Point2D.Float ptDst1
           
private  java.awt.geom.Point2D.Float ptDst2
           
private  java.awt.geom.Point2D.Float ptSrc
           
private  boolean strokeSet
           
private  int texHeight
           
private  int texWidth
           
private  boolean threadWaiting
           
private  int width
           
private  int xmax
           
private  int xmin
           
private  java.awt.Color xOrModeColor
           
private  int ymax
           
private  int ymin
           
 
Constructor Summary
J3DGraphics2DImpl(Canvas3D c)
           
 
Method Summary
 void addRenderingHints(java.util.Map hints)
           
(package private)  void clearOffScreen()
           
 void clip(java.awt.Shape s)
           
 void clipRect(int x, int y, int width, int height)
           
 void copyArea(int x, int y, int width, int height, int dx, int dy)
           
(package private)  void copyDataToCanvas(int px, int py, int x1, int y1, int x2, int y2, int w, int h)
           
(package private)  void copyGraphics2D(java.awt.Graphics2D oldg)
           
(package private)  void copyImage(java.awt.image.BufferedImage bi, byte[] image, int width, int height, int x1, int y1, int x2, int y2)
           
 void dispose()
           
 void doDispose()
           
(package private)  void doDrawAndFlushImage(java.awt.image.BufferedImage img, int x, int y, java.awt.image.ImageObserver observer)
           
(package private)  void doFlush()
           
 void draw(java.awt.Shape s)
           
 void draw3DRect(int x, int y, int width, int height, boolean raised)
           
 void drawAndFlushImage(java.awt.image.BufferedImage img, int x, int y, java.awt.image.ImageObserver observer)
          Draws the specified image and flushes the buffer.
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void drawBytes(byte[] data, int offset, int length, int x, int y)
           
 void drawChars(char[] data, int offset, int length, int x, int y)
           
 void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
           
 void drawImage(java.awt.image.BufferedImage img, java.awt.image.BufferedImageOp op, int x, int y)
           
 void drawImage(java.awt.image.BufferedImage img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
           
 boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform, java.awt.image.ImageObserver obs)
           
 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 drawPolygon(java.awt.Polygon p)
           
 void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawRect(int x, int y, int width, int height)
           
 void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
           
 void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
           
 void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)
           
 void drawString(java.text.AttributedCharacterIterator iterator, int x, int y)
           
 void drawString(java.lang.String s, float x, float y)
           
 void drawString(java.lang.String s, int x, int y)
           
 void fill(java.awt.Shape s)
           
 void fill3DRect(int x, int y, int width, int height, boolean raised)
           
 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 fillPolygon(java.awt.Polygon p)
           
 void fillRect(int x, int y, int width, int height)
           
 void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
           
 void flush(boolean waiting)
          Flushes all previously executed rendering operations to the drawing buffer for this 2D graphics object.
 java.awt.Shape getClip()
           
 java.awt.Rectangle getClipBounds()
           
 java.awt.Rectangle getClipBounds(java.awt.Rectangle r)
           
 java.awt.Rectangle getClipRect()
           
 java.awt.Color getColor()
           
 java.awt.Composite getComposite()
           
 java.awt.GraphicsConfiguration getDeviceConfiguration()
           
 java.awt.Font getFont()
           
 java.awt.FontMetrics getFontMetrics()
           
 java.awt.FontMetrics getFontMetrics(java.awt.Font f)
           
 java.awt.font.FontRenderContext getFontRenderContext()
           
(package private) static int getGreaterPowerOf2(int x)
          Return an integer of power 2 greater than x
 java.awt.Paint getPaint()
           
 java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
           
 java.awt.RenderingHints getRenderingHints()
           
 java.awt.Stroke getStroke()
           
 java.awt.geom.AffineTransform getTransform()
           
 boolean hit(java.awt.Rectangle rect, java.awt.Shape s, boolean onStroke)
           
 boolean hitClip(int x, int y, int width, int height)
           
(package private)  void init()
           
 void rotate(double theta)
           
 void rotate(double theta, double x, double y)
           
(package private)  void runMonitor(int action)
          MC may not scheduler Renderer thread or Renderer thread may not process message FLUSH.
 void scale(double sx, double sy)
           
(package private)  void sendRenderMessage(boolean renderRun, int command, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
           
 void setClip(int x, int y, int width, int height)
           
 void setClip(java.awt.Shape clip)
           
 void setColor(java.awt.Color c)
           
 void setComposite(java.awt.Composite comp)
           
 void setFont(java.awt.Font font)
           
 void setPaint(java.awt.Paint paint)
           
 void setPaintMode()
           
 void setRenderingHint(java.awt.RenderingHints.Key hintKey, java.lang.Object hintValue)
           
 void setRenderingHints(java.util.Map hints)
           
 void setStroke(java.awt.Stroke s)
           
 void setTransform(java.awt.geom.AffineTransform Tx)
           
 void setXORMode(java.awt.Color c1)
           
 void shear(double shx, double shy)
           
 java.lang.String toString()
           
 void transform(java.awt.geom.AffineTransform Tx)
           
 void translate(double tx, double ty)
           
 void translate(int x, int y)
           
(package private)  void validate()
           
(package private)  void validate(float x1, float y1, float x2, float y2)
           
(package private)  void validate(float x1, float y1, float x2, float y2, java.awt.geom.AffineTransform xform)
           
 
Methods inherited from class javax.media.j3d.J3DGraphics2D
clearRect, create, create, getBackground, setBackground
 
Methods inherited from class java.awt.Graphics
finalize
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hasBeenDisposed

private boolean hasBeenDisposed

offScreenGraphics2D

private java.awt.Graphics2D offScreenGraphics2D

g3dImage

private java.awt.image.BufferedImage g3dImage

data

private byte[] data

isFlushed

private boolean isFlushed

canvas3d

private Canvas3D canvas3d

width

private int width

height

private int height

texWidth

private int texWidth

texHeight

private int texHeight

xmin

private int xmin

ymin

private int ymin

xmax

private int xmax

ymax

private int ymax

extentLock

private java.lang.Object extentLock

abgr

private boolean abgr

initTexMap

private boolean initTexMap

strokeSet

private boolean strokeSet

ptSrc

private java.awt.geom.Point2D.Float ptSrc

ptDst1

private java.awt.geom.Point2D.Float ptDst1

ptDst2

private java.awt.geom.Point2D.Float ptDst2

xOrModeColor

private java.awt.Color xOrModeColor

initCtx

private volatile boolean initCtx

threadWaiting

private volatile boolean threadWaiting

blackTransparent

static final java.awt.Color blackTransparent

objectId

int objectId
Constructor Detail

J3DGraphics2DImpl

J3DGraphics2DImpl(Canvas3D c)
Method Detail

init

void init()

flush

public void flush(boolean waiting)
Flushes all previously executed rendering operations to the drawing buffer for this 2D graphics object.

Specified by:
flush in class J3DGraphics2D
Parameters:
wait - flag indicating whether or not to wait for the rendering to be complete before returning from this call.

doFlush

void doFlush()

copyImage

final void copyImage(java.awt.image.BufferedImage bi,
                     byte[] image,
                     int width,
                     int height,
                     int x1,
                     int y1,
                     int x2,
                     int y2)

sendRenderMessage

void sendRenderMessage(boolean renderRun,
                       int command,
                       java.lang.Object arg1,
                       java.lang.Object arg2,
                       java.lang.Object arg3)

validate

final void validate()

validate

void validate(float x1,
              float y1,
              float x2,
              float y2,
              java.awt.geom.AffineTransform xform)

validate

void validate(float x1,
              float y1,
              float x2,
              float y2)

copyGraphics2D

void copyGraphics2D(java.awt.Graphics2D oldg)

clip

public final void clip(java.awt.Shape s)
Specified by:
clip in class java.awt.Graphics2D

getFontMetrics

public java.awt.FontMetrics getFontMetrics()
Overrides:
getFontMetrics in class java.awt.Graphics

getClipBounds

public java.awt.Rectangle getClipBounds(java.awt.Rectangle r)
Overrides:
getClipBounds in class java.awt.Graphics

getClipRect

public java.awt.Rectangle getClipRect()
Overrides:
getClipRect in class java.awt.Graphics

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Graphics

getTransform

public final java.awt.geom.AffineTransform getTransform()
Specified by:
getTransform in class java.awt.Graphics2D

getColor

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

getComposite

public final java.awt.Composite getComposite()
Specified by:
getComposite in class java.awt.Graphics2D

getFont

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

getFontMetrics

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

getFontRenderContext

public final java.awt.font.FontRenderContext getFontRenderContext()
Specified by:
getFontRenderContext in class java.awt.Graphics2D

getDeviceConfiguration

public final java.awt.GraphicsConfiguration getDeviceConfiguration()
Specified by:
getDeviceConfiguration in class java.awt.Graphics2D

getRenderingHint

public final java.lang.Object getRenderingHint(java.awt.RenderingHints.Key hintKey)
Specified by:
getRenderingHint in class java.awt.Graphics2D

getPaint

public final java.awt.Paint getPaint()
Specified by:
getPaint in class java.awt.Graphics2D

getClipBounds

public final java.awt.Rectangle getClipBounds()
Specified by:
getClipBounds in class java.awt.Graphics

getRenderingHints

public final java.awt.RenderingHints getRenderingHints()
Specified by:
getRenderingHints in class java.awt.Graphics2D

getClip

public final java.awt.Shape getClip()
Specified by:
getClip in class java.awt.Graphics

getStroke

public final java.awt.Stroke getStroke()
Specified by:
getStroke in class java.awt.Graphics2D

drawImage

public final boolean drawImage(java.awt.Image img,
                               java.awt.geom.AffineTransform xform,
                               java.awt.image.ImageObserver obs)
Specified by:
drawImage in class java.awt.Graphics2D

drawImage

public final void drawImage(java.awt.image.BufferedImage img,
                            java.awt.image.BufferedImageOp op,
                            int x,
                            int y)
Specified by:
drawImage in class java.awt.Graphics2D

drawImage

public final 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 final 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 final 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 final void drawImage(java.awt.image.BufferedImage img,
                            int dx1,
                            int dy1,
                            int dx2,
                            int dy2,
                            int sx1,
                            int sy1,
                            int sx2,
                            int sy2,
                            java.awt.image.ImageObserver observer)

drawImage

public final 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 final 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

drawImage

public final 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

hit

public final boolean hit(java.awt.Rectangle rect,
                         java.awt.Shape s,
                         boolean onStroke)
Specified by:
hit in class java.awt.Graphics2D

addRenderingHints

public final void addRenderingHints(java.util.Map hints)
Specified by:
addRenderingHints in class java.awt.Graphics2D

clipRect

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

copyArea

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

draw

public final void draw(java.awt.Shape s)
Specified by:
draw in class java.awt.Graphics2D

drawArc

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

drawGlyphVector

public final void drawGlyphVector(java.awt.font.GlyphVector g,
                                  float x,
                                  float y)
Specified by:
drawGlyphVector in class java.awt.Graphics2D

drawLine

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

drawOval

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

drawPolygon

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

drawPolyline

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

drawRenderableImage

public final void drawRenderableImage(java.awt.image.renderable.RenderableImage img,
                                      java.awt.geom.AffineTransform xform)
Specified by:
drawRenderableImage in class java.awt.Graphics2D

drawRenderedImage

public final void drawRenderedImage(java.awt.image.RenderedImage img,
                                    java.awt.geom.AffineTransform xform)
Specified by:
drawRenderedImage in class java.awt.Graphics2D

drawRoundRect

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

drawString

public final void drawString(java.text.AttributedCharacterIterator iterator,
                             int x,
                             int y)
Specified by:
drawString in class java.awt.Graphics2D

drawString

public final void drawString(java.text.AttributedCharacterIterator iterator,
                             float x,
                             float y)
Specified by:
drawString in class java.awt.Graphics2D

drawString

public final void drawString(java.lang.String s,
                             float x,
                             float y)
Specified by:
drawString in class java.awt.Graphics2D

drawString

public final void drawString(java.lang.String s,
                             int x,
                             int y)
Specified by:
drawString in class java.awt.Graphics2D

fill

public final void fill(java.awt.Shape s)
Specified by:
fill in class java.awt.Graphics2D

fillArc

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

fillOval

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

fillRoundRect

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

rotate

public final void rotate(double theta)
Specified by:
rotate in class java.awt.Graphics2D

rotate

public final void rotate(double theta,
                         double x,
                         double y)
Specified by:
rotate in class java.awt.Graphics2D

scale

public final void scale(double sx,
                        double sy)
Specified by:
scale in class java.awt.Graphics2D

setClip

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

setClip

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

setColor

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

setComposite

public final void setComposite(java.awt.Composite comp)
Specified by:
setComposite in class java.awt.Graphics2D

setFont

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

setPaint

public final void setPaint(java.awt.Paint paint)
Specified by:
setPaint in class java.awt.Graphics2D

setPaintMode

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

setRenderingHint

public final void setRenderingHint(java.awt.RenderingHints.Key hintKey,
                                   java.lang.Object hintValue)
Specified by:
setRenderingHint in class java.awt.Graphics2D

setRenderingHints

public final void setRenderingHints(java.util.Map hints)
Specified by:
setRenderingHints in class java.awt.Graphics2D

setStroke

public final void setStroke(java.awt.Stroke s)
Specified by:
setStroke in class java.awt.Graphics2D

setTransform

public final void setTransform(java.awt.geom.AffineTransform Tx)
Specified by:
setTransform in class java.awt.Graphics2D

setXORMode

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

shear

public final void shear(double shx,
                        double shy)
Specified by:
shear in class java.awt.Graphics2D

transform

public final void transform(java.awt.geom.AffineTransform Tx)
Specified by:
transform in class java.awt.Graphics2D

translate

public final void translate(double tx,
                            double ty)
Specified by:
translate in class java.awt.Graphics2D

translate

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

hitClip

public boolean hitClip(int x,
                       int y,
                       int width,
                       int height)
Overrides:
hitClip in class java.awt.Graphics

draw3DRect

public void draw3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Overrides:
draw3DRect in class java.awt.Graphics2D

drawBytes

public void drawBytes(byte[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Overrides:
drawBytes in class java.awt.Graphics

drawChars

public void drawChars(char[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Overrides:
drawChars in class java.awt.Graphics

drawPolygon

public void drawPolygon(java.awt.Polygon p)
Overrides:
drawPolygon in class java.awt.Graphics

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
Overrides:
drawRect in class java.awt.Graphics

fill3DRect

public void fill3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Overrides:
fill3DRect in class java.awt.Graphics2D

fillPolygon

public void fillPolygon(java.awt.Polygon p)
Overrides:
fillPolygon in class java.awt.Graphics

fillPolygon

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

fillRect

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

dispose

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

doDispose

public void doDispose()

drawAndFlushImage

public void drawAndFlushImage(java.awt.image.BufferedImage img,
                              int x,
                              int y,
                              java.awt.image.ImageObserver observer)
Description copied from class: J3DGraphics2D
Draws the specified image and flushes the buffer. This is functionally equivalent to calling drawImage(...) followed by flush(false), but can avoid the cost of making an extra copy of the image in some cases. Anything previously drawn to this J3DGraphics2D will be flushed before the image is drawn.

Specified by:
drawAndFlushImage in class J3DGraphics2D
Parameters:
img - The image to draw
x - The x location to draw at
y - The y location to draw at
observer - The ImageObserver

doDrawAndFlushImage

void doDrawAndFlushImage(java.awt.image.BufferedImage img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)

copyDataToCanvas

void copyDataToCanvas(int px,
                      int py,
                      int x1,
                      int y1,
                      int x2,
                      int y2,
                      int w,
                      int h)

clearOffScreen

void clearOffScreen()

getGreaterPowerOf2

static int getGreaterPowerOf2(int x)
Return an integer of power 2 greater than x


runMonitor

void runMonitor(int action)
MC may not scheduler Renderer thread or Renderer thread may not process message FLUSH. This will hang user thread.



Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.