Copyright 2011-09-18 Werner Randelshofer

ch.randelshofer.awt.graphics
Class AbstractPipe

java.lang.Object
  extended by java.awt.Graphics
      extended by java.awt.Graphics2D
          extended by ch.randelshofer.awt.graphics.Pipe
              extended by ch.randelshofer.awt.graphics.AbstractPipe
Direct Known Subclasses:
ConcurrentOpaquePipe, ConcurrentTranslucentPipe, OpaquePaintPipe, OpaquePipe, TranslucentPipe

public abstract class AbstractPipe
extends Pipe

AbstractPipe is used as an abstract super class for Pipes with basic capabilities.

Version:
1.0 April 5, 2006 Created.
Author:
Werner Randelshofer.

Field Summary
protected  int background
          The background color used for clearRect.
protected static double flatness
          Flatness is used for flattening general paths.
protected  java.awt.image.BufferedImage mis
          The buffered image which holds the pixel data.
protected  int[] pixels
          The pixel data array.
protected  java.awt.Shape previousClip
          This is used to quickly test, if the same clip is set again.
protected  java.awt.geom.AffineTransform previousTransform
          This is used to quickly test, if the same Transform is set again.
protected  java.awt.image.WritableRaster ras
          The raster holding the pixels of the image data.
protected  int tx
          Translation on X- and Y-axis.
protected  int ty
          Translation on X- and Y-axis.
protected  float u1
          LiangBarsky clip test variables.
protected  float u2
          LiangBarsky clip test variables.
 
Fields inherited from class ch.randelshofer.awt.graphics.Pipe
cx1, cx2, cy1, cy2, gh, gw
 
Constructor Summary
AbstractPipe(java.awt.image.BufferedImage image)
          Creates a new instance.
 
Method Summary
protected static void arrayfill(int[] array, int from, int to, int value)
          A faster array fill implementation than the one found in java.util.Arrays.
 void clearRect(int x, int y, int width, int height)
           
 void clipRect(int x, int y, int width, int height)
           
protected  boolean clipTest(float p, float q)
          LiangBarsky clip test.
protected  boolean clipTest(int p, float q)
          LiangBarsky clip test.
 void flush()
          Flushes all pending graphics operations of the rendering pipe into its underlying image.
 java.awt.Color getBackground()
           
 void setBackground(java.awt.Color c)
           
 void setClip(int x, int y, int width, int height)
           
 void setClip(java.awt.Shape clip)
           
 void setComposite(java.awt.Composite comp)
           
 void setTransform(java.awt.geom.AffineTransform Tx)
           
 void transform(java.awt.geom.AffineTransform Tx)
           
 void translate(double tx, double ty)
           
 void translate(int tx, int ty)
           
 
Methods inherited from class ch.randelshofer.awt.graphics.Pipe
addRenderingHints, clip, copyArea, create, dispose, draw, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawOval, drawPolygon, drawPolyline, drawRenderableImage, drawRenderedImage, drawRoundRect, drawString, drawString, drawString, drawString, fill, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getClip, getClipBounds, getColor, getComposite, getDeviceConfiguration, getFont, getFontMetrics, getFontRenderContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setColor, setFont, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setXORMode, shear, toString
 
Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRect
 
Methods inherited from class java.awt.Graphics
create, drawBytes, drawChars, drawLine, drawPolygon, drawRect, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tx

protected int tx
Translation on X- and Y-axis.


ty

protected int ty
Translation on X- and Y-axis.


previousClip

protected java.awt.Shape previousClip
This is used to quickly test, if the same clip is set again.


previousTransform

protected java.awt.geom.AffineTransform previousTransform
This is used to quickly test, if the same Transform is set again.


mis

protected java.awt.image.BufferedImage mis
The buffered image which holds the pixel data.


ras

protected java.awt.image.WritableRaster ras
The raster holding the pixels of the image data.


pixels

protected int[] pixels
The pixel data array.


background

protected int background
The background color used for clearRect.


flatness

protected static final double flatness
Flatness is used for flattening general paths.

See Also:
Constant Field Values

u1

protected float u1
LiangBarsky clip test variables.


u2

protected float u2
LiangBarsky clip test variables.

Constructor Detail

AbstractPipe

public AbstractPipe(java.awt.image.BufferedImage image)
Creates a new instance.

Method Detail

flush

public void flush()
Description copied from class: Pipe
Flushes all pending graphics operations of the rendering pipe into its underlying image.

Specified by:
flush in class Pipe

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)
Overrides:
clipRect in class Pipe

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
Overrides:
setClip in class Pipe

setClip

public void setClip(java.awt.Shape clip)
Overrides:
setClip in class Pipe

clipTest

protected final boolean clipTest(int p,
                                 float q)
LiangBarsky clip test. u1 and u2 are var parameters of this function. u1 must be set to 0, and u2 must be set to 1 before doing the first clip test.


clipTest

protected final boolean clipTest(float p,
                                 float q)
LiangBarsky clip test. u1 and u2 are var parameters of this function. u1 must be set to 0, and u2 must be set to 1 before doing the first clip test.


setBackground

public void setBackground(java.awt.Color c)
Overrides:
setBackground in class Pipe

getBackground

public java.awt.Color getBackground()
Overrides:
getBackground in class Pipe

setComposite

public void setComposite(java.awt.Composite comp)
Overrides:
setComposite in class Pipe

transform

public void transform(java.awt.geom.AffineTransform Tx)
Overrides:
transform in class Pipe

translate

public void translate(double tx,
                      double ty)
Overrides:
translate in class Pipe

translate

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

setTransform

public void setTransform(java.awt.geom.AffineTransform Tx)
Overrides:
setTransform in class Pipe

arrayfill

protected static final void arrayfill(int[] array,
                                      int from,
                                      int to,
                                      int value)
A faster array fill implementation than the one found in java.util.Arrays.


Copyright 2011-09-18 Werner Randelshofer