FreeHEP API
Version current

org.freehep.graphics2d
Class PixelGraphics2D

java.lang.Object
  extended byjava.awt.Graphics
      extended byjava.awt.Graphics2D
          extended byorg.freehep.graphics2d.VectorGraphics
              extended byorg.freehep.graphics2d.AbstractVectorGraphics
                  extended byorg.freehep.graphics2d.PixelGraphics2D
All Implemented Interfaces:
VectorGraphicsConstants
Direct Known Subclasses:
ImageGraphics2D

public class PixelGraphics2D
extends AbstractVectorGraphics

Version:
$Id: PixelGraphics2D.java,v 1.35 2005/01/03 21:22:22 duns Exp $
Author:
Charles Loomis, Mark Donszelmann
Source Code:
PixelGraphics2D.java

Field Summary
protected  Graphics2D hostGraphics
           
static RenderingHints.Key KEY_SYMBOL_BLIT
           
protected  double lineWidth
           
protected  int resolution
           
protected  GenericTagHandler tagHandler
           
static Object VALUE_SYMBOL_BLIT_OFF
           
static Object VALUE_SYMBOL_BLIT_ON
           
 
Fields inherited from interface org.freehep.graphics2d.VectorGraphicsConstants
NUMBER_OF_HORIZ_ALIGNMENTS, NUMBER_OF_SYMBOLS, NUMBER_OF_VERTICAL_ALIGNMENTS, SYMBOL_BOX, SYMBOL_CIRCLE, SYMBOL_CROSS, SYMBOL_DIAMOND, SYMBOL_DN_TRIANGLE, SYMBOL_HLINE, SYMBOL_PLUS, SYMBOL_STAR, SYMBOL_UP_TRIANGLE, SYMBOL_VLINE, TEXT_BASELINE, TEXT_BOTTOM, TEXT_CENTER, TEXT_LEFT, TEXT_RIGHT, TEXT_TOP
 
Constructor Summary
protected PixelGraphics2D()
          Constructor for the case that you only know the hostgraphics later on.
  PixelGraphics2D(Graphics graphics)
           
protected PixelGraphics2D(PixelGraphics2D graphics)
           
 
Method Summary
 void addRenderingHints(Map hints)
           
 void clearRect(double x, double y, double width, double height)
           
 void clearRect(int x, int y, int width, int height)
           
 void clip(Shape clip)
           
 void clipRect(double x, double y, double width, double 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)
           
 Graphics create()
           
 Graphics create(double x, double y, double width, double height)
           
protected  Shape createShape(double[] xPoints, double[] yPoints, int nPoints, boolean close)
          Implementation of createShape makes sure that the points are different by at least one pixel.
 void dispose()
           
 void draw(Shape s)
           
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void drawGlyphVector(GlyphVector g, float x, float y)
           
 void drawImage(BufferedImage img, BufferedImageOp op, int x, int y)
           
 boolean drawImage(Image img, AffineTransform xform, ImageObserver obs)
           
 boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
           
 boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
           
 boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, 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(Polygon p)
           
 void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
           
 void drawRect(int x, int y, int width, int height)
           
 void drawRenderableImage(RenderableImage img, AffineTransform xform)
           
 void drawRenderedImage(RenderedImage img, AffineTransform xform)
           
 void drawString(AttributedCharacterIterator iterator, float x, float y)
           
 void drawString(AttributedCharacterIterator iterator, int x, int y)
           
 void drawString(String str, double x, double y)
          Draws a string.
 void drawString(String str, double x, double y, int horizontal, int vertical, boolean framed, Color frameColor, double frameWidth, boolean banner, Color bannerColor)
          Draws a string with a lot of parameters.
 void drawString(String str, float x, float y)
           
 void drawString(String str, int x, int y)
           
 void drawString(TagString str, double x, double y)
           
 void drawString(TagString str, double x, double y, int horizontal, int vertical, boolean framed, Color frameColor, double frameWidth, boolean banner, Color bannerColor)
          Draws a TagString with a lot of parameters.
 void drawSymbol(double x, double y, double size, int symbol)
           
 void endExport()
           
 void fill(Shape s)
           
 void fillAndDrawSymbol(double x, double y, double size, int symbol, Color fillColor)
           
 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(Polygon p)
           
 void fillRect(int x, int y, int width, int height)
           
 void fillSymbol(double x, double y, double size, int symbol)
           
 Shape getClip()
           
 Rectangle getClipBounds()
           
 Rectangle getClipBounds(Rectangle r)
           
 Composite getComposite()
           
 GraphicsConfiguration getDeviceConfiguration()
           
 FontMetrics getFontMetrics(Font f)
           
 FontRenderContext getFontRenderContext()
           
 Object getRenderingHint(RenderingHints.Key hintKey)
           
 RenderingHints getRenderingHints()
           
 Stroke getStroke()
           
 AffineTransform getTransform()
           
 boolean hit(Rectangle rect, Shape s, boolean onStroke)
           
static boolean isDisplayLocal()
           
static boolean isDisplayX11()
           
 void printComment(String comment)
           
 void rotate(double theta)
           
 void rotate(double theta, double x, double y)
           
 void scale(double sx, double sy)
           
 void setBackground(Color color)
          Sets the background color.
 void setClip(double x, double y, double width, double height)
           
 void setClip(int x, int y, int width, int height)
           
 void setClip(Shape clip)
           
 void setColor(Color color)
          Sets the current color and the current paint.
 void setComposite(Composite comp)
           
 void setFont(Font font)
          Sets the current font.
protected  void setHostGraphics(Graphics graphics)
           
 void setLineWidth(double width)
           
 void setPaint(Paint paint)
          Sets the current paint.
 void setPaintMode()
           
 void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
           
 void setRenderingHints(Map hints)
           
 void setStroke(Stroke s)
           
 void setTransform(AffineTransform Tx)
           
 void setXORMode(Color c1)
           
 void shear(double shx, double shy)
           
 void startExport()
           
 String toString()
           
 void transform(AffineTransform Tx)
           
 void translate(double tx, double ty)
           
 void translate(int x, int y)
           
 
Methods inherited from class org.freehep.graphics2d.AbstractVectorGraphics
createShape, drawArc, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawRoundRect, drawString, drawString, drawSymbol, drawSymbol, fillAndDraw, fillAndDrawSymbol, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, fillRoundRect, fillSymbol, fillSymbol, getBackground, getColor, getColorMode, getCreator, getFont, getPaint, getPrintColor, getProperties, getProperty, getPropertyColor, getPropertyDimension, getPropertyDouble, getPropertyInsets, getPropertyInt, getPropertyRectangle, initProperties, isDeviceIndependent, isProperty, setColorMode, setCreator, setDeviceIndependent, setLineWidth, setProperties
 
Methods inherited from class org.freehep.graphics2d.VectorGraphics
create, create, getSymbol, getTextAlignment, getXalignment, getYalignment
 
Methods inherited from class java.awt.Graphics2D
draw3DRect, fill3DRect
 
Methods inherited from class java.awt.Graphics
drawBytes, drawChars, finalize, getClipRect, getFontMetrics, hitClip
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_SYMBOL_BLIT

public static final RenderingHints.Key KEY_SYMBOL_BLIT

VALUE_SYMBOL_BLIT_ON

public static final Object VALUE_SYMBOL_BLIT_ON

VALUE_SYMBOL_BLIT_OFF

public static final Object VALUE_SYMBOL_BLIT_OFF

hostGraphics

protected Graphics2D hostGraphics

lineWidth

protected double lineWidth

resolution

protected int resolution

tagHandler

protected GenericTagHandler tagHandler
Constructor Detail

PixelGraphics2D

public PixelGraphics2D(Graphics graphics)

PixelGraphics2D

protected PixelGraphics2D(PixelGraphics2D graphics)

PixelGraphics2D

protected PixelGraphics2D()
Constructor for the case that you only know the hostgraphics later on. NOTE: make sure you call setHostGraphics afterwards.

Method Detail

setHostGraphics

protected void setHostGraphics(Graphics graphics)

startExport

public void startExport()
Specified by:
startExport in class VectorGraphics

endExport

public void endExport()
Specified by:
endExport in class VectorGraphics

printComment

public void printComment(String comment)
Specified by:
printComment in class VectorGraphics

create

public Graphics create(double x,
                       double y,
                       double width,
                       double height)
Specified by:
create in class VectorGraphics

clearRect

public void clearRect(int x,
                      int y,
                      int width,
                      int height)
Overrides:
clearRect in class AbstractVectorGraphics

clipRect

public void clipRect(int x,
                     int y,
                     int width,
                     int height)
Specified by:
clipRect in class VectorGraphics

copyArea

public void copyArea(int x,
                     int y,
                     int width,
                     int height,
                     int dx,
                     int dy)
Specified by:
copyArea in class VectorGraphics

create

public Graphics create()
Specified by:
create in class VectorGraphics

dispose

public void dispose()
Specified by:
dispose in class VectorGraphics

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Overrides:
drawArc in class AbstractVectorGraphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         Color bgcolor,
                         ImageObserver observer)
Specified by:
drawImage in class VectorGraphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         ImageObserver observer)
Specified by:
drawImage in class VectorGraphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         Color bgcolor,
                         ImageObserver observer)
Specified by:
drawImage in class VectorGraphics

drawImage

public boolean drawImage(Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         ImageObserver observer)
Specified by:
drawImage in class VectorGraphics

drawImage

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

drawImage

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

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Overrides:
drawLine in class AbstractVectorGraphics

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Overrides:
drawOval in class AbstractVectorGraphics

drawPolygon

public void drawPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Overrides:
drawPolygon in class AbstractVectorGraphics

drawPolygon

public void drawPolygon(Polygon p)

drawPolyline

public void drawPolyline(int[] xPoints,
                         int[] yPoints,
                         int nPoints)
Overrides:
drawPolyline in class AbstractVectorGraphics

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
Overrides:
drawRect in class AbstractVectorGraphics

drawString

public void drawString(String str,
                       int x,
                       int y)
Overrides:
drawString in class AbstractVectorGraphics

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Overrides:
fillArc in class AbstractVectorGraphics

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Overrides:
fillOval in class AbstractVectorGraphics

fillPolygon

public void fillPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Overrides:
fillPolygon in class AbstractVectorGraphics

fillPolygon

public void fillPolygon(Polygon p)

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
Overrides:
fillRect in class AbstractVectorGraphics

drawSymbol

public void drawSymbol(double x,
                       double y,
                       double size,
                       int symbol)
Overrides:
drawSymbol in class AbstractVectorGraphics

fillSymbol

public void fillSymbol(double x,
                       double y,
                       double size,
                       int symbol)
Overrides:
fillSymbol in class AbstractVectorGraphics

fillAndDrawSymbol

public void fillAndDrawSymbol(double x,
                              double y,
                              double size,
                              int symbol,
                              Color fillColor)
Overrides:
fillAndDrawSymbol in class AbstractVectorGraphics

setLineWidth

public void setLineWidth(double width)
Overrides:
setLineWidth in class AbstractVectorGraphics

getClip

public Shape getClip()
Specified by:
getClip in class VectorGraphics

getClipBounds

public Rectangle getClipBounds()
Specified by:
getClipBounds in class VectorGraphics

getClipBounds

public Rectangle getClipBounds(Rectangle r)
Specified by:
getClipBounds in class VectorGraphics

getFontMetrics

public FontMetrics getFontMetrics(Font f)
Specified by:
getFontMetrics in class VectorGraphics

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
Specified by:
setClip in class VectorGraphics

setClip

public void setClip(Shape clip)
Specified by:
setClip in class VectorGraphics

setFont

public void setFont(Font font)
Description copied from class: AbstractVectorGraphics
Sets the current font.

Overrides:
setFont in class AbstractVectorGraphics
Parameters:
font - to be set

setColor

public void setColor(Color color)
Description copied from class: AbstractVectorGraphics
Sets the current color and the current paint. Calls writePaint(Color).

Overrides:
setColor in class AbstractVectorGraphics
Parameters:
color - to be set

setPaint

public void setPaint(Paint paint)
Description copied from class: AbstractVectorGraphics
Sets the current paint.

Overrides:
setPaint in class AbstractVectorGraphics
Returns:
current paint

setPaintMode

public void setPaintMode()
Specified by:
setPaintMode in class VectorGraphics

setXORMode

public void setXORMode(Color c1)
Specified by:
setXORMode in class VectorGraphics

translate

public void translate(int x,
                      int y)
Overrides:
translate in class AbstractVectorGraphics

addRenderingHints

public void addRenderingHints(Map hints)
Specified by:
addRenderingHints in class VectorGraphics

clip

public void clip(Shape clip)
Specified by:
clip in class VectorGraphics

draw

public void draw(Shape s)
Specified by:
draw in class VectorGraphics

drawGlyphVector

public void drawGlyphVector(GlyphVector g,
                            float x,
                            float y)
Specified by:
drawGlyphVector in class VectorGraphics

drawImage

public void drawImage(BufferedImage img,
                      BufferedImageOp op,
                      int x,
                      int y)
Specified by:
drawImage in class VectorGraphics

drawImage

public boolean drawImage(Image img,
                         AffineTransform xform,
                         ImageObserver obs)
Specified by:
drawImage in class VectorGraphics

drawRenderableImage

public void drawRenderableImage(RenderableImage img,
                                AffineTransform xform)
Specified by:
drawRenderableImage in class VectorGraphics

drawRenderedImage

public void drawRenderedImage(RenderedImage img,
                              AffineTransform xform)
Specified by:
drawRenderedImage in class VectorGraphics

drawString

public void drawString(AttributedCharacterIterator iterator,
                       float x,
                       float y)
Specified by:
drawString in class VectorGraphics

drawString

public void drawString(AttributedCharacterIterator iterator,
                       int x,
                       int y)
Overrides:
drawString in class AbstractVectorGraphics

drawString

public void drawString(String str,
                       float x,
                       float y)
Overrides:
drawString in class AbstractVectorGraphics

fill

public void fill(Shape s)
Specified by:
fill in class VectorGraphics

getComposite

public Composite getComposite()
Specified by:
getComposite in class VectorGraphics

getDeviceConfiguration

public GraphicsConfiguration getDeviceConfiguration()
Specified by:
getDeviceConfiguration in class VectorGraphics

getFontRenderContext

public FontRenderContext getFontRenderContext()
Specified by:
getFontRenderContext in class VectorGraphics

getRenderingHint

public Object getRenderingHint(RenderingHints.Key hintKey)
Specified by:
getRenderingHint in class VectorGraphics

getRenderingHints

public RenderingHints getRenderingHints()
Specified by:
getRenderingHints in class VectorGraphics

getStroke

public Stroke getStroke()
Specified by:
getStroke in class VectorGraphics

getTransform

public AffineTransform getTransform()
Specified by:
getTransform in class VectorGraphics

hit

public boolean hit(Rectangle rect,
                   Shape s,
                   boolean onStroke)
Specified by:
hit in class VectorGraphics

rotate

public void rotate(double theta)
Specified by:
rotate in class VectorGraphics

rotate

public void rotate(double theta,
                   double x,
                   double y)
Overrides:
rotate in class AbstractVectorGraphics

scale

public void scale(double sx,
                  double sy)
Specified by:
scale in class VectorGraphics

setBackground

public void setBackground(Color color)
Description copied from class: AbstractVectorGraphics
Sets the background color.

Overrides:
setBackground in class AbstractVectorGraphics
Parameters:
color - background color to be set

setComposite

public void setComposite(Composite comp)
Specified by:
setComposite in class VectorGraphics

setRenderingHint

public void setRenderingHint(RenderingHints.Key hintKey,
                             Object hintValue)
Specified by:
setRenderingHint in class VectorGraphics

setRenderingHints

public void setRenderingHints(Map hints)
Specified by:
setRenderingHints in class VectorGraphics

setStroke

public void setStroke(Stroke s)
Specified by:
setStroke in class VectorGraphics

setTransform

public void setTransform(AffineTransform Tx)
Specified by:
setTransform in class VectorGraphics

shear

public void shear(double shx,
                  double shy)
Specified by:
shear in class VectorGraphics

transform

public void transform(AffineTransform Tx)
Specified by:
transform in class VectorGraphics

translate

public void translate(double tx,
                      double ty)
Specified by:
translate in class VectorGraphics

clearRect

public void clearRect(double x,
                      double y,
                      double width,
                      double height)
Specified by:
clearRect in class VectorGraphics

clipRect

public void clipRect(double x,
                     double y,
                     double width,
                     double height)
Specified by:
clipRect in class VectorGraphics

drawString

public void drawString(String str,
                       double x,
                       double y)
Description copied from class: VectorGraphics
Draws a string.

Specified by:
drawString in class VectorGraphics

setClip

public void setClip(double x,
                    double y,
                    double width,
                    double height)
Specified by:
setClip in class VectorGraphics

drawString

public void drawString(TagString str,
                       double x,
                       double y)
Overrides:
drawString in class AbstractVectorGraphics

drawString

public void drawString(String str,
                       double x,
                       double y,
                       int horizontal,
                       int vertical,
                       boolean framed,
                       Color frameColor,
                       double frameWidth,
                       boolean banner,
                       Color bannerColor)
Description copied from class: VectorGraphics
Draws a string with a lot of parameters.

Specified by:
drawString in class VectorGraphics
Parameters:
str - text to be drawn
x - coordinate to draw string
y - coordinate to draw string
horizontal - alignment of the text
vertical - alignment of the text
framed - true if text is surrounded by a frame
frameColor - color of the frame
frameWidth - witdh of the frame
banner - true if the frame is filled by a banner
bannerColor - color of the banner

drawString

public void drawString(TagString str,
                       double x,
                       double y,
                       int horizontal,
                       int vertical,
                       boolean framed,
                       Color frameColor,
                       double frameWidth,
                       boolean banner,
                       Color bannerColor)
Description copied from class: VectorGraphics
Draws a TagString with a lot of parameters.

Specified by:
drawString in class VectorGraphics
Parameters:
str - Tagged text to be drawn
x - coordinate to draw string
y - coordinate to draw string
horizontal - alignment of the text
vertical - alignment of the text
framed - true if text is surrounded by a frame
frameColor - color of the frame
frameWidth - witdh of the frame
banner - true if the frame is filled by a banner
bannerColor - color of the banner

toString

public String toString()
Specified by:
toString in class VectorGraphics

isDisplayX11

public static boolean isDisplayX11()

isDisplayLocal

public static boolean isDisplayLocal()

createShape

protected Shape createShape(double[] xPoints,
                            double[] yPoints,
                            int nPoints,
                            boolean close)
Implementation of createShape makes sure that the points are different by at least one pixel.

Specified by:
createShape in class AbstractVectorGraphics
Parameters:
xPoints - X coordinates of the polyline.
yPoints - Y coordinates of the polyline.
nPoints - number of points of the polyline.
close - is shape closed

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.