org.rosuda.pograss
Class PoGraSS

java.lang.Object
  extended by org.rosuda.pograss.PoGraSS
Direct Known Subclasses:
PoGraSSgraphics, PoGraSSmeta, PoGraSSPDF, PoGraSSPS

public class PoGraSS
extends java.lang.Object

Portable Graphics SubSystem - first draft of the abstract interface definition. May change (or be extended) in the future. 0.90: initial release 0.91: (CVS 1.1) addComment, setTitle 0.92: (CVS 1.2) support for layers (nextLayer) 0.93: (CVS 1.3) support for version information (in the API; versionString, version and passVersionInfo) 0.94: (CVS 1.5) support for extended drawString and font handling 0.95: (CVS 1.6) support for polygons 0.96: (CVS 1.7) support for separate fill/pen colors and regular commands (rect, oval,...) backwards compatibility is provided by the jointColors flag. b added setColor(Color) for compatibility with Graphics 0.97: (1.12) added nextObject(...) - allows creation of structures in the plot 1.13 switched font size from int to double; added font defaults

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

Field Summary
static int FA_Bold
           
static int FA_Ital
           
static int FA_MASK_Type
           
static int FA_Normal
           
static int FF_Mono
           
static int FF_SansSerif
           
static int FF_Serif
           
 int localLayerCache
          this variable is used only by PoGraSS implementations which support layer caching.
static int TA_Center
           
static int TA_Left
           
static int TA_MASK_Or
           
static int TA_Right
           
 int version
           
 java.lang.String versionString
           
 
Constructor Summary
PoGraSS()
           
 
Method Summary
 void addComment(java.lang.String c)
           
 void begin()
           
 void beginAlphaBlock()
           
 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)
           
 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)
           
 void drawPolygon(int[] x, int[] y, int pts, boolean closed)
           
 void drawPolyline(int[] x, int[] y, int pts)
           
 void drawRect(int x1, int y1, int w, int h)
           
 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 attr)
          draw string with special attributes set (e.g. alignment etc.)
 void end()
           
 void endAlphaBlock()
           
 void fallbackAlpha()
           
 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 w, int h)
           
 void fillRoundRect(int x1, int y1, int x2, int y2, int dx, int dy)
           
 java.awt.Rectangle getBounds()
           
 int getHeightEstimate(java.lang.String s)
           
 int getWidthEstimate(java.lang.String s)
           
 boolean internalSupportsAlpha()
           
 void lineTo(int x, int y)
           
 void moveTo(int x, int y)
           
 void nextLayer()
           
 void nextObject()
           
 void nextObject(java.lang.String name)
           
 void oval(int x, int y, int rx, int ry)
           
 void passVersionInfo(int ver, java.lang.String verString)
           
 void polygon(int[] x, int[] y, int pts, boolean close)
           
 void rect(int x1, int y1, int x2, int y2)
           
 void resetClip()
           
 void resetGlobalAlpha()
           
 void roundRect(int x1, int y1, int x2, int y2, int dx, int dy)
           
 void setBounds(int w, int h)
           
 void setBounds(int x, int y, int w, int h)
           
 void setBrushColor(float r, float g, float b)
           
 void setBrushColor(float r, float g, float b, float a)
           
 void setBrushColor(java.lang.String nam)
           
 void setBrushColor(java.lang.String nam, float alpha)
           
 void setClip(int x, int y, int width, int height)
           
 void setColor(java.awt.Color c)
           
 void setColor(float r, float g, 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 setFillStyle(int s)
           
 void setFontFace(int face)
          set font face by style
 void setFontFace(int face, java.lang.String name)
          just a shortcut for a sequence of setFontFace(face); setOptionalFace(name);
 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.
 void setOutPrintStream(java.io.PrintStream pstr)
           
 void setPenColor(float r, float g, float b)
           
 void setPenColor(float r, float g, float b, float a)
           
 void setPenColor(java.lang.String nam)
           
 void setPenColor(java.lang.String nam, float alpha)
           
 void setTitle(java.lang.String t)
           
 void useJointColors(boolean jc)
          sets the jointColors flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TA_Left

public static final int TA_Left
See Also:
Constant Field Values

TA_Right

public static final int TA_Right
See Also:
Constant Field Values

TA_Center

public static final int TA_Center
See Also:
Constant Field Values

TA_MASK_Or

public static final int TA_MASK_Or
See Also:
Constant Field Values

FA_Normal

public static final int FA_Normal
See Also:
Constant Field Values

FA_Ital

public static final int FA_Ital
See Also:
Constant Field Values

FA_Bold

public static final int FA_Bold
See Also:
Constant Field Values

FA_MASK_Type

public static final int FA_MASK_Type
See Also:
Constant Field Values

FF_SansSerif

public static final int FF_SansSerif
See Also:
Constant Field Values

FF_Serif

public static final int FF_Serif
See Also:
Constant Field Values

FF_Mono

public static final int FF_Mono
See Also:
Constant Field Values

versionString

public java.lang.String versionString

version

public int version

localLayerCache

public int localLayerCache
this variable is used only by PoGraSS implementations which support layer caching. the program using such PoGraSS can check this value to perform some speed optimizations and skip steps that are not necessary for the specified layer. If this value is -1 then no caching is used and all layers are to be fully painted (which is the default) [since 0.97beta]

Constructor Detail

PoGraSS

public PoGraSS()
Method Detail

setOutPrintStream

public void setOutPrintStream(java.io.PrintStream pstr)

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)

setBounds

public void setBounds(int w,
                      int h)

getBounds

public java.awt.Rectangle getBounds()

useJointColors

public void useJointColors(boolean jc)
sets the jointColors flag. Should be used after begin but before the first graphical command. The behavior is undefined if used elsewhere.


passVersionInfo

public void passVersionInfo(int ver,
                            java.lang.String verString)

addComment

public void addComment(java.lang.String c)

setTitle

public void setTitle(java.lang.String t)

defineColor

public void defineColor(java.lang.String nam,
                        int R,
                        int G,
                        int B)

setColor

public void setColor(int R,
                     int G,
                     int B)

setColor

public void setColor(java.lang.String nam)

setColor

public void setColor(java.awt.Color c)

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)

moveTo

public void moveTo(int x,
                   int y)

lineTo

public void lineTo(int x,
                   int y)

rect

public void rect(int x1,
                 int y1,
                 int x2,
                 int y2)

drawRect

public void drawRect(int x1,
                     int y1,
                     int w,
                     int h)

fillRect

public void fillRect(int x1,
                     int y1,
                     int w,
                     int h)

drawImage

public void drawImage(PoGraSSimage img,
                      int x1,
                      int y1,
                      int x2,
                      int y2)

roundRect

public void roundRect(int x1,
                      int y1,
                      int x2,
                      int y2,
                      int dx,
                      int dy)

drawRoundRect

public void drawRoundRect(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int dx,
                          int dy)

fillRoundRect

public void fillRoundRect(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int dx,
                          int dy)

polygon

public void polygon(int[] x,
                    int[] y,
                    int pts,
                    boolean close)

drawPolygon

public void drawPolygon(int[] x,
                        int[] y,
                        int pts)

drawPolyline

public void drawPolyline(int[] x,
                         int[] y,
                         int pts)

drawPolygon

public void drawPolygon(int[] x,
                        int[] y,
                        int pts,
                        boolean closed)

fillPolygon

public void fillPolygon(int[] x,
                        int[] y,
                        int pts)

drawOval

public void drawOval(int x,
                     int y,
                     int rx,
                     int ry)

oval

public void oval(int x,
                 int y,
                 int rx,
                 int ry)

fillOval

public void fillOval(int x,
                     int y,
                     int rx,
                     int ry)

setLineWidth

public void setLineWidth(float w)

setFillStyle

public void setFillStyle(int s)

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y)

nextLayer

public void nextLayer()

begin

public void begin()

end

public void end()

drawString

public void drawString(java.lang.String txt,
                       int x,
                       int y,
                       int attr)
draw string with special attributes set (e.g. alignment etc.) default is left alignment, horizontal


drawString

public 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. For example ax=0.5, ay=0.5 center the text in both directions relative to the anchor point.


drawString

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


setFontFace

public void setFontFace(int face)
set font face by style


setOptionalFace

public void setOptionalFace(java.lang.String name)
set optional font face. the underlying system will use the face only if it's available. you should specify the desired font type by 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");


setFontFace

public void setFontFace(int face,
                        java.lang.String name)
just a shortcut for a sequence of setFontFace(face); setOptionalFace(name);


setFontSize

public void setFontSize(double pt)

setFontStyle

public void setFontStyle(int attr)

getWidthEstimate

public int getWidthEstimate(java.lang.String s)

getHeightEstimate

public int getHeightEstimate(java.lang.String s)

defineColor

public void defineColor(java.lang.String nam,
                        float r,
                        float g,
                        float b,
                        float a)

setColor

public void setColor(java.lang.String nam,
                     float alpha)

setColor

public void setColor(float r,
                     float g,
                     float b,
                     float a)

internalSupportsAlpha

public boolean internalSupportsAlpha()

beginAlphaBlock

public void beginAlphaBlock()

fallbackAlpha

public void fallbackAlpha()

endAlphaBlock

public void endAlphaBlock()

setBrushColor

public void setBrushColor(java.lang.String nam)

setBrushColor

public void setBrushColor(float r,
                          float g,
                          float b)

setBrushColor

public void setBrushColor(java.lang.String nam,
                          float alpha)

setBrushColor

public void setBrushColor(float r,
                          float g,
                          float b,
                          float a)

setPenColor

public void setPenColor(java.lang.String nam)

setPenColor

public void setPenColor(float r,
                        float g,
                        float b)

setPenColor

public void setPenColor(java.lang.String nam,
                        float alpha)

setPenColor

public void setPenColor(float r,
                        float g,
                        float b,
                        float a)

nextObject

public void nextObject()

nextObject

public void nextObject(java.lang.String name)

setGlobalAlpha

public void setGlobalAlpha(float alpha)

resetGlobalAlpha

public void resetGlobalAlpha()

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)

resetClip

public void resetClip()

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)