/** * 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)); }
/** * Apply current X Translation * * @param x Java X coordinate * @return translated X to postscript */ private int xTransform(int x) { return (m_localGraphicsState.getXOffset() + x); }