public void scale(double d1, double d2) {
   m_localGraphicsState.setXScale(d1);
   m_localGraphicsState.setYScale(d2);
   if (DEBUG)
     System.err.println(
         Messages.getInstance().getString("PostscriptGraphics_Scale_Error_Text_First")
             + d1
             + Messages.getInstance().getString("PostscriptGraphics_Scale_Error_Text_Second")
             + d2);
 }
 public void setStroke(Stroke s) {
   if (s != null) {
     m_localGraphicsState.setStroke(s);
     if (s.equals(m_psGraphicsState.getStroke())) {
       return;
     }
     m_psGraphicsState.setStroke(s);
   } else {
     m_localGraphicsState.setStroke(new BasicStroke());
     m_psGraphicsState.setStroke(getStroke());
   }
   // ouput postscript here to set stroke.
 }
 /**
  * Set current pen color. Default to black if null.
  *
  * @param c new pen color.
  */
 public void setColor(Color c) {
   if (c != null) {
     m_localGraphicsState.setColor(c);
     if (m_psGraphicsState.getColor().equals(c)) {
       return;
     }
     m_psGraphicsState.setColor(c);
   } else {
     m_localGraphicsState.setColor(Color.black);
     m_psGraphicsState.setColor(getColor());
   }
   m_printstream.print(getColor().getRed() / 255.0);
   m_printstream.print(" ");
   m_printstream.print(getColor().getGreen() / 255.0);
   m_printstream.print(" ");
   m_printstream.print(getColor().getBlue() / 255.0);
   m_printstream.println(" setrgbcolor");
 }
 /**
  * Translates the origin of the graphics context to the point (x, y) in the current coordinate
  * system. Modifies this graphics context so that its new origin corresponds to the point (x, y)
  * in this graphics context's original coordinate system. All coordinates used in subsequent
  * rendering operations on this graphics context will be relative to this new origin.
  *
  * @param x the x coordinate.
  * @param y the y coordinate.
  */
 public void translate(int x, int y) {
   if (DEBUG)
     System.out.println(
         Messages.getInstance().getString("PostscriptGraphics_Translate_Text_First")
             + x
             + Messages.getInstance().getString("PostscriptGraphics_Translate_Text_Second")
             + y);
   m_localGraphicsState.setXOffset(m_localGraphicsState.getXOffset() + xScale(x));
   m_localGraphicsState.setYOffset(m_localGraphicsState.getYOffset() + yScale(y));
   m_psGraphicsState.setXOffset(m_psGraphicsState.getXOffset() + xScale(x));
   m_psGraphicsState.setYOffset(m_psGraphicsState.getYOffset() + yScale(y));
 }
  /**
   * Set current font. Default to Plain Courier 11 if null.
   *
   * @param font new font.
   */
  public void setFont(Font font) {

    if (font != null) {
      m_localGraphicsState.setFont(font);
      if (font.getName().equals(m_psGraphicsState.getFont().getName())
          && (m_psGraphicsState.getFont().getStyle() == font.getStyle())
          && (m_psGraphicsState.getFont().getSize() == yScale(font.getSize()))) return;
      m_psGraphicsState.setFont(
          new Font(font.getName(), font.getStyle(), yScale(getFont().getSize())));
    } else {
      m_localGraphicsState.setFont(new Font("Courier", Font.PLAIN, 11));
      m_psGraphicsState.setFont(getFont());
    }

    m_printstream.println("/(" + replacePSFont(getFont().getPSName()) + ")" + " findfont");
    m_printstream.println(yScale(getFont().getSize()) + " scalefont setfont");
  }
 public Stroke getStroke() {
   return (m_localGraphicsState.getStroke());
 }
 /**
  * Get current font.
  *
  * @return current font.
  */
 public Font getFont() {
   return (m_localGraphicsState.getFont());
 }
 /**
  * Get current pen color.
  *
  * @return current pen color.
  */
 public Color getColor() {
   return (m_localGraphicsState.getColor());
 }
 /** scales the given y value with current y scale factor */
 private int yScale(int y) {
   return doScale(y, m_localGraphicsState.getYScale());
 }
 /** scales the given x value with current x scale factor */
 private int xScale(int x) {
   return doScale(x, m_localGraphicsState.getXScale());
 }
 /**
  * Apply current X Translation
  *
  * @param x Java X coordinate
  * @return translated X to postscript
  */
 private int xTransform(int x) {
   return (m_localGraphicsState.getXOffset() + x);
 }
 /**
  * Convert Java Y coordinate (0 = top) to PostScript (0 = bottom) Also apply current Translation
  *
  * @param y Java Y coordinate
  * @return translated Y to postscript
  */
 private int yTransform(int y) {
   return (m_extent.height - (m_localGraphicsState.getYOffset() + y));
 }