/** * 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)); }
/** * 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)); }