| Method from com.lowagie.text.pdf.codec.postscript.PAPencil Detail: |
public void arc(double cx,
double cy,
double r,
double ang1,
double ang2) {
Arc2D.Float arc = new Arc2D.Float((float) cx, (float) cy, (float) r, (float) r,
(float) ang1, (float) (ang2 - ang1), Arc2D.OPEN);
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
this.state.path.append(arc, false);
} else {
this.state.path.append(arc, true);
}
}
|
public void arcn(double cx,
double cy,
double r,
double ang1,
double ang2) {
Arc2D.Float arc = new Arc2D.Float((float) cx, (float) cy, (float) r, (float) r,
(float) ang1, (float) (ang1 - ang2), Arc2D.OPEN);
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
this.state.path.append(arc, false);
} else {
this.state.path.append(arc, true);
}
}
|
public void charpath(String aString,
boolean adjustForStroking) {
GlyphVector glyphVector = this.state.font.createGlyphVector(this.graphics.getFontRenderContext(), aString);
Shape glyphShape = glyphVector.getOutline();
this.state.path.append(glyphShape, false);
}
|
public void clippath() {
this.rectpath(0.0d, 0.0d, 800.0d, 800.0d);
}
|
public void closepath() {
this.state.path.closePath();
}
|
public void curveto(double x1,
double y1,
double x2,
double y2,
double x3,
double y3) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
throw new PainterException("no current point");
}
this.state.path.curveTo((float) x1, (float) y1, (float) x2, (float) y2,
(float) x3, (float) y3);
}
|
public void eofill() {
this.state.path.setWindingRule(GeneralPath.WIND_EVEN_ODD);
this.graphics.fill(this.state.path);
this.state.path.setWindingRule(GeneralPath.WIND_NON_ZERO);
this.newpath();
}
|
public void erasepage() {
this.graphics.clearRect(0, 0, 800, 800);
}
|
public void fill() {
this.graphics.fill(this.state.path);
this.newpath();
}
|
public Font findFont(String fontname) {
Font result;
StringBuffer buffer = new StringBuffer(fontname);
int i, n;
n = buffer.length();
for(i = 0; i < n; i++){
if(buffer.charAt(i) == '-"){
buffer.setCharAt(i,' ");
}
}
fontname = buffer.toString();
if(this.fonts == null){
// construct the fonts dictionary
GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fontArray = genv.getAllFonts();
this.fonts = new HashMap();
for(i = 0; i < fontArray.length; i++){
String postscriptName = fontArray[i].getPSName();
this.fonts.put(postscriptName, fontArray[i]);
}
}
result = (Font) this.fonts.get(fontname);
if(result == null){
result = new Font("SansSerif", Font.PLAIN, 12);
}
return result;
}
|
public void grestore() {
if(this.gStack.empty()){
this.initgraphics();
} else {
this.state = (State) this.gStack.pop();
this.state.stampState(this.graphics, this.size);
}
}
|
public void grestoreall() {
this.initgraphics();
}
|
public void gsave() {
this.state.recordState(this.graphics);
State next = (State) this.state.clone();
this.gStack.push(this.state);
this.state = next;
}
|
public void initgraphics() {
// AffineTransform at = new AffineTransform();
// turn anti-aliasing and high-quality rendering on
this.graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
this.graphics.setRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
// initialize to a postscript coordinate system
// at.translate(0, this.size.getHeight());
// at.scale(1, -1);
// this.graphics.setTransform(at);
this.graphics.translate(0, this.size.getHeight());
this.graphics.scale(1, -1);
// state, stack and page
this.state = new State(this.graphics);
this.gStack = new Stack();
this.erasepage();
}
|
public void lineto(Point2D p) throws PainterException {
this.lineto(p.getX(), p.getY());
}
|
public void lineto(double x,
double y) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
throw new PainterException("no current point");
}
this.state.path.lineTo((float) x, (float) y);
}
|
public void moveto(Point2D p) {
this.moveto(p.getX(), p.getY());
}
|
public void moveto(double x,
double y) {
this.state.path.moveTo((float) x, (float) y);
}
|
public void newpath() {
this.state.path.reset();
}
|
public void rcurveto(double dx1,
double dy1,
double dx2,
double dy2,
double dx3,
double dy3) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
throw new PainterException("no current point");
}
double x0 = currentPoint.getX();
double y0 = currentPoint.getY();
this.curveto(x0 + dx1, y0 + dy1, x0 + dx2, y0 + dy2, x0 + dx3,y0 + dy3);
}
|
public void rectfill(Rectangle2D rect) {
this.rectfill(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
}
|
public void rectfill(double x,
double y,
double width,
double height) {
this.gsave();
this.rectpath(x, y, width, height);
this.fill();
this.grestore();
}
|
public void rectpath(double x,
double y,
double width,
double height) {
this.newpath();
this.moveto(x, y);
try {
this.rlineto(width, 0);
this.rlineto(0, height);
this.rlineto(-width, 0);
} catch(PainterException e){
}
this.closepath();
}
|
public void rectstroke(Rectangle2D rect) {
this.rectstroke(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight());
}
|
public void rectstroke(double x,
double y,
double width,
double height) {
this.gsave();
this.rectpath(x, y, width, height);
this.stroke();
this.grestore();
}
|
public void rlineto(double dx,
double dy) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
throw new PainterException("no current point");
}
this.state.path.lineTo((float) (currentPoint.getX() + dx) , (float) (currentPoint.getY() + dy));
}
|
public void rmoveto(double dx,
double dy) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
if(currentPoint == null){
throw new PainterException("no current point");
}
this.state.path.moveTo((float) (currentPoint.getX() + dx) , (float) (currentPoint.getY() + dy));
}
|
public void show(String string) throws PainterException {
Point2D currentPoint = this.state.path.getCurrentPoint();
AffineTransform currentTransform = this.graphics.getTransform();
Point2D tranformedPoint = currentTransform.transform(currentPoint, null);
if(currentPoint == null){
throw new PainterException("no current point");
}
this.graphics.setTransform(new AffineTransform());
this.graphics.drawString(string, (float) tranformedPoint.getX(), (float) tranformedPoint.getY());
this.graphics.setTransform(currentTransform);
}
|
public void showpage() {
}
|
public void stroke() {
this.graphics.draw(this.state.path);
this.newpath();
}
|