📄 pdfpage.java
字号:
* @param x1 the X co-ordinate of the first corner of the rectangle * @param y1 the Y co-ordinate of the first corner of the rectangle * @param x2 the X co-ordinate of the second corner of the rectangle * @param y2 the Y co-ordinate of the second corner of the rectangle * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void drawEllipse(float x1, float y1, float x2, float y2) { page.drawEllipse(cx(x1), cy(y1), cx(x2), cy(y2)); } /** * Draw a circle centered on <code>x</code>, <code>y</code> * with a radius of <code>r</code>. A more convenient way to * draw circles than with <code>drawEllipse</code>. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x the X co-ordinate of the center of the circle * @param y the Y co-ordinate of the center of the circle * @param r the radius of the circle * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> * @since 1.1 */ public void drawCircle(float x, float y, float r) { page.drawEllipse(cx(x-r), cy(y-r), cx(x+r), cy(y+r)); } /** * <p> * Draw an arc inside the specified rectangle. The same as * <code>drawEllipse</code>, but allows you to specify a start * and end angle, and the line is always drawn as an outline. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x1 the X co-ordinate of the first corner of the rectangle * @param y1 the Y co-ordinate of the first corner of the rectangle * @param x2 the X co-ordinate of the second corner of the rectangle * @param y2 the Y co-ordinate of the second corner of the rectangle * @param start the angle to start the arc, in degrees clockwise * (with zero at 12 o'clock) * @param end the angle to end the arc, in degrees * @since 1.1 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void drawEllipseArc(float x1, float y1, float x2, float y2, float start, float end) { page.drawEllipseArc(cx(x1),cy(y1),cx(x2),cy(y2),start,end); } /** * Draw an arc of the circle centered on * <code>x</code>, <code>y</code> with a radius * of <code>r</code>. A more convenient way to * draw circular arcs than <code>drawEllipseArc</code>. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x the X co-ordinate of the center of the circle * @param y the Y co-ordinate of the center of the circle * @param start the angle to start the arc, in degrees clockwise * (with zero at 12 o'clock) * @param end the angle to end the arc, in degrees * @since 1.1 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void drawCircleArc(float x, float y, float r, float start, float end) { page.drawEllipseArc(cx(x-r),cy(y-r),cx(x+r),cy(y+r),start,end); } /** * Start a new path at the specified position. If a path has * already been started, move the cursor without drawing a line. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x the X co-ordinate to move to * @param y the Y co-ordinate to move to * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathMove(float x, float y) { page.pathMove(cx(x),cy(y)); } /** * Continue the path in a straight line to the specified point * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x the X co-ordinate to move to * @param y the Y co-ordinate to move to * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathLine(float x, float y) { page.pathLine(cx(x),cy(y)); } /** * Continue the path in a bezier curve to the specified point. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param cx1 the X co-ordinate of the first control point for the curve * @param cy1 the Y co-ordinate of the first control point for the curve * @param cx2 the X co-ordinate of the second control point for the curve * @param cy2 the Y co-ordinate of the second control point for the curve * @param x the X co-ordinate to move to * @param y the Y co-ordinate to move to * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathBezier(float cx1, float cy1, float cx2, float cy2, float x, float y) { page.pathBezier(cx(cx1),cy(cy1),cx(cx2),cy(cy2),cx(x),cy(y)); } /** * Continue the path in an arc * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param width the width of the ellipse to take the arc from * @param height the height of the ellipse to take the arc from * @param start the angle to start the arc from, in degrees clockwise * @param end the angle to finish the arc on, in degrees clockwise * @since 1.1 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathArc(float width, float height, float start, float end) { page.pathArc(width,height,start,end); } /** * Close the path by drawing a straight line back to its beginning. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathClose() { page.pathClose(); } /** * Cancel the current path. * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathCancel() { page.pathCancel(); } /** * Paint the path. What this actually does depends on the currently * applied <code>PDFStyle</code>. * <ul> * <li>If the style has a LineColor specified but no FillColor, "stroke" * the path by drawing it as an outline in the current line color</li> * <li>If the style has a FillColor specified but no LineColor, call * {@link #pathClose} and "fill" the path with the current fill color</li> * <li>If the style has both a FillColor and a LineColor, call {@link * #pathClose}, "fill" the path with the current fill color then "stroke" * the path with the current line color.</li> * </ul> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @throws IllegalStateException if neither a fill color or a line color * is specified. * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathPaint() { page.pathPaint(); } /** * Allows the path to be painted and used to set the clipping area * in one operation. See the {@link #pathPaint} and {@link #pathClip} * methods for more information * @since 1.1.10 */ public void pathClipAndPaint() { page.pathClipAndPaint(); } /** * <p> * Set the "clipping area" of the page to be the intersection of * the current clipping area and the shape defined by this path. * Any future graphics or text operations on the page are only * applied within this area. * </p><p> * There is no way to enlarge the current clipping area, or to set * a new clipping area without reference to the current one. However, * as the current clipping area is part of the graphics state, it * can and should be nested inside calls to {@link #save} and * {@link #restore} to limit its effect. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @since 1.1.5 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void pathClip() { page.pathClip(); } /** * <p> * Identical to {@link #drawRectangle}, but instead of drawing this * method sets the clipping area to the specified rectangle * </p><p> * There is no way to enlarge the current clipping area, or to set * a new clipping area without reference to the current one. However, * as the current clipping area is part of the graphics state, it * can and should be nested inside calls to {@link #save} and * {@link #restore} to limit its effect. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x1 the X co-ordinate of the first corner of the rectangle * @param y1 the Y co-ordinate of the first corner of the rectangle * @param x2 the X co-ordinate of the second corner of the rectangle * @param y2 the Y co-ordinate of the second corner of the rectangle * @since 1.1.5 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void clipRectangle(float x1, float y1, float x2, float y2) { page.clipRectangle(cx(x1),cy(y1),cx(x2),cy(y2)); } /** * <p> * Identical to {@link #drawRoundedRectangle}, but instead of drawing this * method sets the clipping area to the specified shape * </p><p> * There is no way to enlarge the current clipping area, or to set * a new clipping area without reference to the current one. However, * as the current clipping area is part of the graphics state, it * can and should be nested inside calls to {@link #save} and * {@link #restore} to limit its effect. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x1 the X co-ordinate of the first corner of the rectangle * @param y1 the Y co-ordinate of the first corner of the rectangle * @param x2 the X co-ordinate of the second corner of the rectangle * @param y2 the Y co-ordinate of the second corner of the rectangle * @param r The radius of the circle used to round the corners. A value * of zero produces an identical result to <code>clipRectangle</code>. * @since 1.1.5 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void clipRoundedRectangle(float x1, float y1, float x2, float y2, float r) { page.clipRoundedRectangle(cx(x1),cy(y1),cx(x2),cy(y2),r); } /** * <p> * Identical to {@link #drawPolygon}, but instead of drawing this * method sets the clipping area to the specified shape. * </p><p> * There is no way to enlarge the current clipping area, or to set * a new clipping area without reference to the current one. However, * as the current clipping area is part of the graphics state, it * can and should be nested inside calls to {@link #save} and * {@link #restore} to limit its effect. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * </p> * @param x the X co-ordinates of the vertices * @param y the Y co-ordinates of the vertices * @since 1.1.5 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void clipPolygon(float[] x, float[] y) { float[] x2 = new float[x.length]; float[] y2 = new float[y.length]; for (int i=0;i<x.length;i++) x2[i]=cx(x[i]); for (int i=0;i<y.length;i++) y2[i]=cy(y[i]); page.clipPolygon(x2,y2); } /** * <p> * Identical to {@link #drawEllipse}, but instead of drawing this * method sets the clipping area to the specified shape * </p><p> * There is no way to enlarge the current clipping area, or to set * a new clipping area without reference to the current one. However, * as the current clipping area is part of the graphics state, it * can and should be nested inside calls to {@link #save} and * {@link #restore} to limit its effect. * </p> * <p>Calls to this method can't be made between calls to <tt>beginText</tt> and <tt>endText</tt>, as this violates the PDF specification. Since 1.1.6 An <tt>IllegalStateException</tt> will be thrown. * @param x1 the X co-ordinate of the first corner of the rectangle * @param y1 the Y co-ordinate of the first corner of the rectangle * @param x2 the X co-ordinate of the second corner of the rectangle * @param y2 the Y co-ordinate of the second corner of the rectangle * @since 1.1.5 * @throws IllegalStateException if the call is nested between a call to <tt>beginText</tt> and <tt>endText</tt> */ public void clipEllipse(float x1, float y1, float x2, float y2) { page.clipEllipse(cx(x1),cy(y1),cx(x2),cy(y2)); } /** * <p> * Identical to {@link #drawCircle}, but instead of drawing this * method sets the clipping area to the specified shape * </p><p> * There is no way to enlarge the current clipping area, or to set
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -