org.rosuda.pograss
Class PoGraSSgraphics

java.lang.Object
  extended by org.rosuda.pograss.PoGraSS
      extended by org.rosuda.pograss.PoGraSSgraphics

public class PoGraSSgraphics
extends PoGraSS

Portable Graphics SubSystem - Graphics implementation

Version:
$Id: PoGraSSgraphics.java 3472 2013-05-22 14:14:30Z urbanek $

Field Summary
 java.awt.Graphics2D g
          associated graphics context
 
Fields inherited from class org.rosuda.pograss.PoGraSS
FA_Bold, FA_Ital, FA_MASK_Type, FA_Normal, FF_Mono, FF_SansSerif, FF_Serif, localLayerCache, TA_Center, TA_Left, TA_MASK_Or, TA_Right, version, versionString
 
Constructor Summary
PoGraSSgraphics(java.awt.Graphics2D G)
          construct an instance of PoGraSS associated with a Graphics, paint all layers
PoGraSSgraphics(java.awt.Graphics2D G, int layer)
          construct an instance of PoGraSS associated with a Graphics.
 
Method Summary
 void begin()
           
 void defineColor(java.lang.String nam, float r, float g, float b, float a)
           
 void defineColor(java.lang.String nam, int R, int G, int B)
          In this defineColor implementation we're bad, because we ignore any colors that exceed our initial 128 colors limit. it would be fairly easy to use Vector for storage instead of fixed arrays, but well, there was no need for bigger color tables (yet).
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void drawImage(PoGraSSimage img, int x1, int y1, int x2, int y2)
           
 void drawLine(int x1, int y1, int x2, int y2)
           
 void drawOval(int x, int y, int rx, int ry)
           
 void drawPolygon(int[] x, int[] y, int pts, boolean closed)
           
 void drawRect(int x1, int y1, int x2, int y2)
           
 void drawRoundRect(int x1, int y1, int x2, int y2, int dx, int dy)
           
 void drawString(java.lang.String txt, int x, int y)
           
 void drawString(java.lang.String txt, int x, int y, double ax, double ay)
          draw string with anchor point x,y where ax and ay translate the anchor relative to text extension.
 void drawString(java.lang.String txt, int x, int y, double ax, double ay, double rot)
          addition: rot specifies rotation angle around the anchor. negative values additionally flip the text on the horizontal axis of the text.
 void drawString(java.lang.String txt, int x, int y, int a)
          draw string with special attributes set (e.g. alignment etc.)
 void end()
           
 void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
           
 void fillOval(int x, int y, int rx, int ry)
           
 void fillPolygon(int[] x, int[] y, int pts)
           
 void fillRect(int x1, int y1, int x2, int y2)
           
 void fillRoundRect(int x1, int y1, int x2, int y2, int dx, int dy)
           
 int getHeightEstimate(java.lang.String s)
           
 int getWidthEstimate(java.lang.String s)
           
 void lineTo(int x, int y)
           
 void moveTo(int x, int y)
           
 void nextLayer()
           
 void resetClip()
           
 void resetGlobalAlpha()
           
 void setClip(int x, int y, int width, int height)
           
 void setColor(float r, float gr, float b, float a)
           
 void setColor(int R, int G, int B)
           
 void setColor(java.lang.String nam)
           
 void setColor(java.lang.String nam, float alpha)
           
 void setFontFace(int face)
          set font face by style
 void setFontSize(double pt)
           
 void setFontStyle(int attr)
           
 void setGlobalAlpha(float alpha)
           
 void setLineWidth(float w)
           
 void setOptionalFace(java.lang.String name)
          set optional font face. the underlying system will use the face only if it's available.
 
Methods inherited from class org.rosuda.pograss.PoGraSS
addComment, beginAlphaBlock, drawPolygon, drawPolyline, endAlphaBlock, fallbackAlpha, getBounds, internalSupportsAlpha, nextObject, nextObject, oval, passVersionInfo, polygon, rect, roundRect, setBounds, setBounds, setBrushColor, setBrushColor, setBrushColor, setBrushColor, setColor, setFillStyle, setFontFace, setOutPrintStream, setPenColor, setPenColor, setPenColor, setPenColor, setTitle, useJointColors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

g

public java.awt.Graphics2D g
associated graphics context

Constructor Detail

PoGraSSgraphics

public PoGraSSgraphics(java.awt.Graphics2D G,
                       int layer)
construct an instance of PoGraSS associated with a Graphics.

Parameters:
G - associated Graphics
layer - layer to paint or -1 if all

PoGraSSgraphics

public PoGraSSgraphics(java.awt.Graphics2D G)
construct an instance of PoGraSS associated with a Graphics, paint all layers

Parameters:
G - associated Graphics
Method Detail

defineColor

public void defineColor(java.lang.String nam,
                        int R,
                        int G,
                        int B)
In this defineColor implementation we're bad, because we ignore any colors that exceed our initial 128 colors limit. it would be fairly easy to use Vector for storage instead of fixed arrays, but well, there was no need for bigger color tables (yet).

Keep in mind, that the user can use any number of colors by using setColor(int,int,int). the defineColor principle is meant just to define a fixed set of few colors used frequently throughout the application.

Overrides:
defineColor in class PoGraSS

defineColor

public void defineColor(java.lang.String nam,
                        float r,
                        float g,
                        float b,
                        float a)
Overrides:
defineColor in class PoGraSS

setColor

public void setColor(java.lang.String nam,
                     float alpha)
Overrides:
setColor in class PoGraSS

setColor

public void setColor(float r,
                     float gr,
                     float b,
                     float a)
Overrides:
setColor in class PoGraSS

setColor

public void setColor(int R,
                     int G,
                     int B)
Overrides:
setColor in class PoGraSS

setColor

public void setColor(java.lang.String nam)
Overrides:
setColor in class PoGraSS

drawLine

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

moveTo

public void moveTo(int x,
                   int y)
Overrides:
moveTo in class PoGraSS

lineTo

public void lineTo(int x,
                   int y)
Overrides:
lineTo in class PoGraSS

drawRect

public void drawRect(int x1,
                     int y1,
                     int x2,
                     int y2)
Overrides:
drawRect in class PoGraSS

fillRect

public void fillRect(int x1,
                     int y1,
                     int x2,
                     int y2)
Overrides:
fillRect in class PoGraSS

drawImage

public void drawImage(PoGraSSimage img,
                      int x1,
                      int y1,
                      int x2,
                      int y2)
Overrides:
drawImage in class PoGraSS

drawRoundRect

public void drawRoundRect(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int dx,
                          int dy)
Overrides:
drawRoundRect in class PoGraSS

fillRoundRect

public void fillRoundRect(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int dx,
                          int dy)
Overrides:
fillRoundRect in class PoGraSS

drawOval

public void drawOval(int x,
                     int y,
                     int rx,
                     int ry)
Overrides:
drawOval in class PoGraSS

fillOval

public void fillOval(int x,
                     int y,
                     int rx,
                     int ry)
Overrides:
fillOval in class PoGraSS

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y)
Overrides:
drawString in class PoGraSS

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y,
                       int a)
Description copied from class: PoGraSS
draw string with special attributes set (e.g. alignment etc.) default is left alignment, horizontal

Overrides:
drawString in class PoGraSS

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y,
                       double ax,
                       double ay)
Description copied from class: PoGraSS
draw string with anchor point x,y where ax and ay translate the anchor relative to text extension. For example ax=0.5, ay=0.5 center the text in both directions relative to the anchor point.

Overrides:
drawString in class PoGraSS

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y,
                       double ax,
                       double ay,
                       double rot)
Description copied from class: PoGraSS
addition: rot specifies rotation angle around the anchor. negative values additionally flip the text on the horizontal axis of the text.

Overrides:
drawString in class PoGraSS

drawPolygon

public void drawPolygon(int[] x,
                        int[] y,
                        int pts,
                        boolean closed)
Overrides:
drawPolygon in class PoGraSS

fillPolygon

public void fillPolygon(int[] x,
                        int[] y,
                        int pts)
Overrides:
fillPolygon in class PoGraSS

setFontFace

public void setFontFace(int face)
Description copied from class: PoGraSS
set font face by style

Overrides:
setFontFace in class PoGraSS

setOptionalFace

public void setOptionalFace(java.lang.String name)
Description copied from class: PoGraSS
set optional font face. the underlying system will use the face only if it's available. you should specify the desired font type by PoGraSS.setFontFace(int) and refine this selection by setting optional face. It is not guaranteed that this face will be used, keep it in mind. example: setFontFace(FF_SansSerif); setOptionalFont("Helvetica"); setOptionalFont("Myriad");

Overrides:
setOptionalFace in class PoGraSS

setFontSize

public void setFontSize(double pt)
Overrides:
setFontSize in class PoGraSS

setFontStyle

public void setFontStyle(int attr)
Overrides:
setFontStyle in class PoGraSS

nextLayer

public void nextLayer()
Overrides:
nextLayer in class PoGraSS

begin

public void begin()
Overrides:
begin in class PoGraSS

end

public void end()
Overrides:
end in class PoGraSS

getWidthEstimate

public int getWidthEstimate(java.lang.String s)
Overrides:
getWidthEstimate in class PoGraSS

getHeightEstimate

public int getHeightEstimate(java.lang.String s)
Overrides:
getHeightEstimate in class PoGraSS

setGlobalAlpha

public void setGlobalAlpha(float alpha)
Overrides:
setGlobalAlpha in class PoGraSS

resetGlobalAlpha

public void resetGlobalAlpha()
Overrides:
resetGlobalAlpha in class PoGraSS

setLineWidth

public void setLineWidth(float w)
Overrides:
setLineWidth in class PoGraSS

resetClip

public void resetClip()
Overrides:
resetClip in class PoGraSS

setClip

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

drawArc

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

fillArc

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