0001: /*
0002: * Copyright (c) 2007, intarsys consulting GmbH
0003: *
0004: * Redistribution and use in source and binary forms, with or without
0005: * modification, are permitted provided that the following conditions are met:
0006: *
0007: * - Redistributions of source code must retain the above copyright notice,
0008: * this list of conditions and the following disclaimer.
0009: *
0010: * - Redistributions in binary form must reproduce the above copyright notice,
0011: * this list of conditions and the following disclaimer in the documentation
0012: * and/or other materials provided with the distribution.
0013: *
0014: * - Neither the name of intarsys nor the names of its contributors may be used
0015: * to endorse or promote products derived from this software without specific
0016: * prior written permission.
0017: *
0018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0028: * POSSIBILITY OF SUCH DAMAGE.
0029: */
0030: package de.intarsys.pdf.content;
0031:
0032: import de.intarsys.pdf.cos.COSDictionary;
0033: import de.intarsys.pdf.cos.COSName;
0034: import de.intarsys.pdf.font.PDFont;
0035: import de.intarsys.pdf.pd.PDColorSpace;
0036: import de.intarsys.pdf.pd.PDExtGState;
0037: import de.intarsys.pdf.pd.PDImage;
0038: import de.intarsys.pdf.pd.PDPattern;
0039: import de.intarsys.pdf.pd.PDResources;
0040: import de.intarsys.pdf.pd.PDShading;
0041: import de.intarsys.pdf.pd.PDXObject;
0042:
0043: /**
0044: * The abstraction of a device that is manipulated by a PDF content stream
0045: * interpreter ({@link ICSInterpreter}) processing a content stream.
0046: * <p>
0047: * The device lifecycle is framed by open/close, issued by the
0048: * {@link ICSInterpreter}. The behavior of an {@link ICSDevice} that is not
0049: * open is undefined.
0050: *
0051: * <p>
0052: * Any of the {@link ICSDevice} methods may throw a {@link CSException}. When
0053: * the {@link ICSDevice} is used in the context of an {@link ICSInterpreter},
0054: * the exception may be handled by the associated {@link ICSExceptionHandler},
0055: * otherwise you have to be prepared yourself.
0056: *
0057: * Following a list of operator/method relationship. Not all operators may have
0058: * a corresponding method.
0059: *
0060: * <code>
0061: * b | pathCloseFillStrokeNonZero
0062: * B | pathFillStrokeNonZero
0063: * b* | patcCloseFillStrokeEvenOdd
0064: * B* | pathFillStrokeEvenOdd
0065: * BDC | markedContentBeginProperties
0066: * BI | inlineImageBegin
0067: * BMC | markedContentBegin
0068: * BT | textBegin
0069: * BX | compatibilityBegin
0070: * c | penCurveToC
0071: * cm | transform
0072: * CS | setStrokeColorSpace
0073: * cs | setNonStrokeColorSpace
0074: * d | setLineDash
0075: * d0 | textT3SetGlyphWidth
0076: * d1 | textT3SetGlyphWidthBB
0077: * Do | doXObject
0078: * DP | markedContentPointProperties
0079: * EI | inlineImageEnd
0080: * EMC | markedContentEnd
0081: * ET | textEnd
0082: * EX | compatibilityEnd
0083: * f | pathFillNonZero
0084: * f* | pathFillEvenOdd
0085: * G | setStrokeColorGray
0086: * g | setNonStrokeColorGray
0087: * gs | setExtendedState
0088: * h | pathClose
0089: * i | setFlatnessTolerance
0090: * ID | inlineImageBeginData
0091: * j | setLineJoin
0092: * J | setLineCap
0093: * K | setStrokeColorCMYK
0094: * k | setNonStrokeColorCMYK
0095: * l | penLineTo
0096: * m | penMoveTo
0097: * M | setMiterLimit
0098: * MP | markedContentPoint
0099: * n | pathEnd
0100: * q | saveState
0101: * Q | restoreState
0102: * re | penRectangle
0103: * RG | setStrokeColorRGB
0104: * rg | setNonStrokeColorRGB
0105: * ri | setRenderingIntent
0106: * s | pathCloseStroke
0107: * S | pathStroke
0108: * SC | setStrokeColorValues
0109: * sc | setNonStrokeColorValues
0110: * SCN | setStrokeColorValuesSpecial
0111: * scn | setNonStrokeColorValuesSpecial
0112: * sh | paintFill
0113: * T* | textLineNew
0114: * Tc | textSetCharSpacing
0115: * Td | textLineMove
0116: * TD | use primitive methods
0117: * Tf | textSetFont
0118: * Tj | textShow
0119: * TJ | textShow & textMove
0120: * TL | textSetLeading
0121: * Tm | textSetTransform
0122: * Tr | textSetRenderingMode
0123: * Ts | textSetRise
0124: * Tw | textSetWordSpacing
0125: * Tz | textSetHorizontalScaling
0126: * v | penCurveToV
0127: * w | setLineWidth
0128: * W | pathClipNonZero
0129: * W* | pathClipEvenOdd
0130: * y | penCurveToY
0131: * ' | use primitive methods
0132: * " | use primitive methods
0133: * </code>
0134: */
0135: public interface ICSDevice {
0136: /**
0137: * Close the device after use.
0138: */
0139: public void close();
0140:
0141: /**
0142: * Paint shape and color shading according to shading dictionary.
0143: * <p>
0144: * PDF graphics operator "sh"
0145: *
0146: * @param resourceName
0147: * The logical name of the resource in the {@link PDResources}
0148: * @param shading
0149: * The {@link PDShading} to be painted.
0150: */
0151: public void doShading(COSName resourceName, PDShading shading);
0152:
0153: /**
0154: * Stroke a PDXObject. A PDXObject is a self contained graphical
0155: * description, either a form, an image or a postscript program.
0156: *
0157: * <p>
0158: * PDF graphics operator "Do"
0159: *
0160: * @param resourceName
0161: * The logical name of the resource in the {@link PDResources}
0162: * @param xObject
0163: * The {@link PDXObject} to be stroked.
0164: */
0165: public void doXObject(COSName resourceName, PDXObject xObject);
0166:
0167: /**
0168: * Stroke an inlined image.
0169: * <p>
0170: * PDF graphics operators "BI", "ID", "EI"
0171: *
0172: * @param img
0173: * The inlined image. The image may use some special keys instead
0174: * of the standard {@link PDImage} dictionary keys.
0175: */
0176: public void inlineImage(PDImage img);
0177:
0178: /**
0179: * Begin a marked content sequence.
0180: * <p>
0181: * PDF graphics operator "BMC"
0182: *
0183: * @param tag
0184: * The tag indicating the role or significance.
0185: */
0186: public void markedContentBegin(COSName tag);
0187:
0188: /**
0189: * Begin a compatibility section.
0190: * <p>
0191: * PDF graphics operator "BX"
0192: *
0193: */
0194: public void compatibilityBegin();
0195:
0196: /**
0197: * End a compatibility section.
0198: * <p>
0199: * PDF graphics operator "EX"
0200: *
0201: */
0202: public void compatibilityEnd();
0203:
0204: /**
0205: * Begin a marked content sequence with a property list.
0206: * <p>
0207: * PDF graphics operator "BDC"
0208: *
0209: * @param tag
0210: * The tag indicating the role or significance.
0211: * @param resourceName
0212: * The logical name of the resource in the {@link PDResources}
0213: * @param properties
0214: * The properties for the marked content sequence.
0215: */
0216: public void markedContentBeginProperties(COSName tag,
0217: COSName resourceName, COSDictionary properties);
0218:
0219: /**
0220: * End marked content sequence started with "BMC" or "BDC".
0221: * <p>
0222: * PDF graphics operator "EMC"
0223: */
0224: public void markedContentEnd();
0225:
0226: /**
0227: * Set a marked point.
0228: * <p>
0229: * PDF graphics operator "MP"
0230: *
0231: * @param tag
0232: * The tag indicating the role or significance.
0233: */
0234: public void markedContentPoint(COSName tag);
0235:
0236: /**
0237: * Define a marked content point with a property list.
0238: * <p>
0239: * PDF graphics operator "DP"
0240: *
0241: * @param tag
0242: * The tag indicating the role or significance.
0243: * @param resourceName
0244: * The logical name of the resource in the {@link PDResources}
0245: * @param properties
0246: * The properties for the marked content point.
0247: */
0248: public void markedContentPointProperties(COSName tag,
0249: COSName resourceName, COSDictionary properties);
0250:
0251: /**
0252: * Open the device for use by <code>interpreter</code>.
0253: *
0254: * @param interpreter
0255: */
0256: public void open(ICSInterpreter interpreter);
0257:
0258: /**
0259: * Intersect the current clipping path with the current path using the
0260: * even/odd rule.
0261: * <p>
0262: * PDF graphics operator "W*"
0263: */
0264: public void pathClipEvenOdd();
0265:
0266: /**
0267: * Intersect the current clipping path with the current path using the
0268: * nonzero winding rule.
0269: * <p>
0270: * PDF graphics operator "W"
0271: */
0272: public void pathClipNonZero();
0273:
0274: /**
0275: * Close the path and append a line segment from the current coordinate to
0276: * the starting point of the path.
0277: *
0278: * <p>
0279: * PDF graphics operator "h"
0280: * </p>
0281: */
0282: public void pathClose();
0283:
0284: /**
0285: * Close, Fill and then stroke the path using the even/odd rule.
0286: * <p>
0287: * PDF graphics operator "b*"
0288: */
0289: public void pathCloseFillStrokeEvenOdd();
0290:
0291: /**
0292: * Close, Fill and then stroke the path using the non zero winding rule.
0293: * <p>
0294: * PDF graphics operator "b"
0295: */
0296: public void pathCloseFillStrokeNonZero();
0297:
0298: /**
0299: * Close and then stroke the path.
0300: * <p>
0301: * PDF graphics operator "s"
0302: */
0303: public void pathCloseStroke();
0304:
0305: /**
0306: * End the path without filling or stroking.
0307: *
0308: * <p>
0309: * This may for example be used to manipulate the clipping path without a
0310: * painting operation.
0311: * </p>
0312: * <p>
0313: * PDF graphics operator "n"
0314: */
0315: public void pathEnd();
0316:
0317: /**
0318: * Fill the path using the even/odd rule.
0319: * <p>
0320: * PDF graphics operator "f*"
0321: */
0322: public void pathFillEvenOdd();
0323:
0324: /**
0325: * Fill the path using the non-zero winding rule.
0326: *
0327: * <p>
0328: * An open subpath is closed before filling.
0329: * </p>
0330: * <p>
0331: * PDF graphics operator "f"
0332: */
0333: public void pathFillNonZero();
0334:
0335: /**
0336: * Fill and then stroke the path using the even/odd rule.
0337: * <p>
0338: * PDF graphics operator "B*"
0339: */
0340: public void pathFillStrokeEvenOdd();
0341:
0342: /**
0343: * Fill and then stroke the path using the non-zero winding rule.
0344: * <p>
0345: * PDF graphics operator "B"
0346: */
0347: public void pathFillStrokeNonZero();
0348:
0349: /**
0350: * Stroke the current path.
0351: * <p>
0352: * PDF graphics operator "S"
0353: */
0354: public void pathStroke();
0355:
0356: /**
0357: * Append a cubic bezier curve to the path.<br>
0358: * The curve extends from the current point to x3, y3, where x1,y1 and x2,y2
0359: * are the bezier control points.
0360: *
0361: * <code>
0362: *
0363: * current
0364: * +---------* x1/y1
0365: * . _
0366: * -.
0367: * . *x2/y2
0368: * .
0369: * .
0370: * .
0371: * + x3/y3
0372: * </code>
0373: *
0374: * <p>
0375: * PDF graphics operator "c"
0376: * </p>
0377: *
0378: * @param x1
0379: * x coordinate of first control point
0380: * @param y1
0381: * y coordinate of first control point
0382: * @param x2
0383: * x coordinate of second control point
0384: * @param y2
0385: * y coordinate of second control point
0386: * @param x3
0387: * x coordinate of endpoint
0388: * @param y3
0389: * y coordinate of endpoint
0390: */
0391: public void penCurveToC(float x1, float y1, float x2, float y2,
0392: float x3, float y3);
0393:
0394: /**
0395: * Append a cubic bezier curve to the path. The curve extends from the
0396: * current point to x3, y3, where the first control point coincides with the
0397: * current point and x2,y2 is the second bezier control point.
0398: *
0399: * <code>
0400: *
0401: * current
0402: * +
0403: * . _
0404: * -.
0405: * . *x2/y2
0406: * .
0407: * .
0408: * .
0409: * + x3/y3
0410: * </code>
0411: *
0412: * <p>
0413: * PDF graphics operator "v"
0414: * </p>
0415: *
0416: * @param x2
0417: * x coordinate of second control point
0418: * @param y2
0419: * y coordinate of second control point
0420: * @param x3
0421: * x coordinate of endpoint
0422: * @param y3
0423: * y coordinate of endpoint
0424: */
0425: public void penCurveToV(float x2, float y2, float x3, float y3);
0426:
0427: /**
0428: * Append a cubic bezier curve to the path.
0429: * <p>
0430: * The curve extends from the current point to x3, y3, where x1,y1 and x3,y3
0431: * are the bezier control points.
0432: *
0433: * <code>
0434: *
0435: * current
0436: * +---------* x1/y1
0437: * . _
0438: * -.
0439: * .
0440: * .
0441: * .
0442: * .
0443: * + x3/y3
0444: * </code>
0445: *
0446: *
0447: * <p>
0448: * PDF graphics operator "y"
0449: * </p>
0450: *
0451: * @param x1
0452: * x coordinate of first control point
0453: * @param y1
0454: * y coordinate of first control point
0455: * @param x3
0456: * x coordinate of endpoint
0457: * @param y3
0458: * y coordinate of endpoint
0459: */
0460: public void penCurveToY(float x1, float y1, float x3, float y3);
0461:
0462: /**
0463: * Add a line from the current point to <code>x</code>, <code>y</code>.
0464: * The new current point is <code>x</code>, <code>y</code>.
0465: *
0466: * <p>
0467: * PDF graphics operator "l"
0468: * </p>
0469: *
0470: * @param x
0471: * The new current x coordinate
0472: * @param y
0473: * The new current y coordinate
0474: */
0475: public void penLineTo(float x, float y);
0476:
0477: /**
0478: * Move the current point to <code>x</code>, <code>y</code>. No line
0479: * is added to the path, a new subpath is started.
0480: *
0481: * <p>
0482: * PDF graphics operator "m"
0483: * </p>
0484: *
0485: * @param x
0486: * The new current x coordinate
0487: * @param y
0488: * The new current y coordinate
0489: */
0490: public void penMoveTo(float x, float y);
0491:
0492: /**
0493: * Append a complete rectangle to as a subpath.
0494: *
0495: * <p>
0496: * The lower left corner is at <code>x</code>, <code>y</code>, the
0497: * dimensions are <code>width</code> and <code>height</code>. The
0498: * numbers are defined in user space.
0499: * </p>
0500: *
0501: * <p>
0502: * PDF graphics operator "re"
0503: * </p>
0504: *
0505: * @param x
0506: * The x coordinate of the lower left corner in user space
0507: * @param y
0508: * The y coordinate of the lower left corner in user space
0509: * @param w
0510: * The width in user space
0511: * @param h
0512: * The height in user space
0513: */
0514: public void penRectangle(float x, float y, float w, float h);
0515:
0516: /**
0517: * Restore the graphics state from the stack.
0518: * <p>
0519: * PDF graphics operator "Q"
0520: */
0521: public void restoreState();
0522:
0523: /**
0524: * Save the current graphics state on a stack for later use.
0525: * <p>
0526: * PDF graphics operator "q"
0527: */
0528: public void saveState();
0529:
0530: /**
0531: * Set the dictionary as the new graphic state, creating a new
0532: * {@link PDResources} entry if needed.
0533: * <p>
0534: * PDF graphics operator "gs"
0535: *
0536: * @param resourceName
0537: * The logical name of the resource in the {@link PDResources}
0538: * @param gstate
0539: * The new {@link PDExtGState}
0540: */
0541: public void setExtendedState(COSName resourceName,
0542: PDExtGState gstate);
0543:
0544: /**
0545: * Set the flatness tolerance. <code>flatness</code> is a value between 0
0546: * and 100, with 0 defining the device's default flatness tolerance.
0547: * <p>
0548: * PDF graphics operator "i"
0549: *
0550: * @param flatness
0551: * The flatness tolerance between 0 and 100.
0552: */
0553: public void setFlatnessTolerance(float flatness);
0554:
0555: /**
0556: * The line cap specifies the shape to be used at the ends of open subpaths.
0557: *
0558: * <code>
0559: * 0: Butt. The stroke is cut at the endpoint.
0560: * 1: Round. A circle is drawn with the diamter of the line width at the endpoint
0561: * 2: Square. A square is drawn with its center at the endpoint.
0562: * </code>
0563: * <p>
0564: * PDF graphics operator "J"
0565: *
0566: * @param capStyle
0567: * The line cap style to use (0,1 or 2)
0568: */
0569: public void setLineCap(int capStyle);
0570:
0571: /**
0572: * Define the pattern used to stroke paths. <code>unitsOn</code> defines a
0573: * length in user space where the line is drawn, <code>unitsOff</code>
0574: * defines a length in user space wher the line is not drawn.
0575: * <code>phase</code> defines a "offset" in the pattern definition.
0576: *
0577: * <p>
0578: * This is a simplified version that only allows for a two phase pattern.
0579: * </p>
0580: * <p>
0581: * PDF graphics operator "d"
0582: *
0583: * @param pattern
0584: * The pattern array for the dash
0585: * @param phase
0586: * Offset in pattern
0587: */
0588: public void setLineDash(float[] pattern, float phase);
0589:
0590: /**
0591: * The line join specifies the shape to be used at the connection points of
0592: * two adjacent lines in a path.
0593: *
0594: * <code>
0595: * 0: Miter Join, the outer line boreders are extended until they meet.
0596: * 1: Round join. A circle is drawn at the meeting point with its
0597: * diameter the same as the line width.
0598: * 2: Bevel join. The segments are cut at the endpoints as in the line cap
0599: * style "Butt". The empty triangle is filled.
0600: * </code>
0601: * <p>
0602: * PDF graphics operator "j"
0603: *
0604: * @param joinStyle
0605: * The line join style to use (one of 0,1,2)
0606: */
0607: public void setLineJoin(int joinStyle);
0608:
0609: /**
0610: * Set the thickness of the line used to stroke a path. This is a number in
0611: * user space units.
0612: *
0613: * <p>
0614: * A width of zero denotes the thinest line that can be rendered.
0615: * </p>
0616: * <p>
0617: * PDF graphics operator "w"
0618: *
0619: * @param lineWidth
0620: * The line width in user space.
0621: */
0622: public void setLineWidth(float lineWidth);
0623:
0624: /**
0625: * The maximum ratio of MiterLength/LineWidth when connecting two lines with
0626: * miter style.
0627: * <p>
0628: * PDF graphics operator "M"
0629: *
0630: * @param miterLimit
0631: * The maximum ratio of MiterLength/LineWidth when connecting two
0632: * lines with miter style.
0633: */
0634: public void setMiterLimit(float miterLimit);
0635:
0636: /**
0637: * Set the non stroking color space to /DeviceCMYK and set the color values
0638: * <code>c</code>, <code>m</code>, <code>y</code>, <code>K</code>.
0639: *
0640: * @param c
0641: * A number between 0 (minimum) and 1 (maximum)
0642: * @param m
0643: * A number between 0 (minimum) and 1 (maximum)
0644: * @param y
0645: * A number between 0 (minimum) and 1 (maximum)
0646: * @param k
0647: * A number between 0 (minimum) and 1 (maximum)
0648: */
0649: public void setNonStrokeColorCMYK(float c, float m, float y, float k);
0650:
0651: /**
0652: * Set the non stroking color space to /DeviceGray and set the gray level to
0653: * <code>gray</code>.
0654: *
0655: * @param gray
0656: * A number between 0 (black) and 1 (white)
0657: */
0658: public void setNonStrokeColorGray(float gray);
0659:
0660: /**
0661: * Set the non stroking color space to /DeviceRGB and set the color values
0662: * <code>r</code>, <code>g</code>, <code>b</code>.
0663: *
0664: * @param r
0665: * A number between 0 (minimum) and 1 (maximum)
0666: * @param g
0667: * A number between 0 (minimum) and 1 (maximum)
0668: * @param b
0669: * A number between 0 (minimum) and 1 (maximum)
0670: */
0671: public void setNonStrokeColorRGB(float r, float g, float b);
0672:
0673: /**
0674: * Set color space for non-stroking.
0675: * <p>
0676: * PDF graphics operator "cs"
0677: *
0678: * @param resourceName
0679: * The logical name of the resource in the {@link PDResources}
0680: * @param colorSpace
0681: * The new {@link PDColorSpace}
0682: */
0683: public void setNonStrokeColorSpace(COSName resourceName,
0684: PDColorSpace colorSpace);
0685:
0686: /**
0687: * Set the color used for non stroking operations, dependent on the
0688: * currently selected color spaces.
0689: * <p>
0690: * PDF graphics operator "sc" or "scn", dependen on the active color space.
0691: *
0692: * @param values
0693: * The color values
0694: */
0695: public void setNonStrokeColorValues(float[] values);
0696:
0697: /**
0698: * Set the color used for non stroking operations, dependent on the
0699: * currently selected special color spaces.
0700: * <p>
0701: * PDF graphics operator "scn"
0702: *
0703: * @param values
0704: * The color values.
0705: * @param resourceName
0706: * An optional logical name of the resource in the
0707: * {@link PDResources}
0708: * @param pattern
0709: * An optional {@link PDPattern}
0710: */
0711: public void setNonStrokeColorValues(float[] values,
0712: COSName resourceName, PDPattern pattern);
0713:
0714: /**
0715: * Set the color rendering intent.
0716: * <p>
0717: * PDF graphics operator "ri"
0718: *
0719: * @param intent
0720: * The name of the rendering intent.
0721: */
0722: public void setRenderingIntent(COSName intent);
0723:
0724: /**
0725: * Set the stroking color space to /DeviceCMYK and set the color values
0726: * <code>c</code>, <code>m</code>, <code>y</code>, <code>K</code>.
0727: *
0728: * @param c
0729: * A number between 0 (minimum) and 1 (maximum)
0730: * @param m
0731: * A number between 0 (minimum) and 1 (maximum)
0732: * @param y
0733: * A number between 0 (minimum) and 1 (maximum)
0734: * @param k
0735: * A number between 0 (minimum) and 1 (maximum)
0736: */
0737: public void setStrokeColorCMYK(float c, float m, float y, float k);
0738:
0739: /**
0740: * Set the stroking color space to /DeviceGray and set the gray level to
0741: * <code>gray</code>.
0742: *
0743: * @param gray
0744: * A number between 0 (black) and 1 (white)
0745: */
0746: public void setStrokeColorGray(float gray);
0747:
0748: /**
0749: * Set the stroking color space to /DeviceRGB and set the color values
0750: * <code>r</code>, <code>g</code>, <code>b</code>.
0751: *
0752: * @param r
0753: * A number between 0 (minimum) and 1 (maximum)
0754: * @param g
0755: * A number between 0 (minimum) and 1 (maximum)
0756: * @param b
0757: * A number between 0 (minimum) and 1 (maximum)
0758: */
0759: public void setStrokeColorRGB(float r, float g, float b);
0760:
0761: /**
0762: * Set color space for stroking.
0763: * <p>
0764: * PDF graphics operator "CS"
0765: *
0766: * @param resourceName
0767: * The logical name of the resource in the {@link PDResources}
0768: * @param colorSpace
0769: * The new {@link PDColorSpace}
0770: */
0771: public void setStrokeColorSpace(COSName resourceName,
0772: PDColorSpace colorSpace);
0773:
0774: /**
0775: * Set the color used for stroking operations, dependent on the currently
0776: * selected color spaces.
0777: * <p>
0778: * PDF graphics operator "SC" or "SCN", dependen on the active color space.
0779: *
0780: * @param values
0781: * The color values.
0782: */
0783: public void setStrokeColorValues(float[] values);
0784:
0785: /**
0786: * Set the color used for stroking operations, dependent on the currently
0787: * selected special color spaces.
0788: * <p>
0789: * PDF graphics operator "SCN"
0790: *
0791: * @param values
0792: * The color values.
0793: * @param resourceName
0794: * An optional logical name of the resource in the
0795: * {@link PDResources}
0796: * @param pattern
0797: * An optional {@link PDPattern}
0798: */
0799: public void setStrokeColorValues(float[] values,
0800: COSName resourceName, PDPattern pattern);
0801:
0802: /**
0803: * Begin text mode.
0804: * <p>
0805: * PDF graphics operator "BT"
0806: */
0807: public void textBegin();
0808:
0809: /**
0810: * End text mode.
0811: * <p>
0812: * PDF graphics operator "ET"
0813: */
0814: public void textEnd();
0815:
0816: /**
0817: * Move the current lext line by <code>dx</code>, <code>dy</code>.
0818: * <p>
0819: * PDF graphics operator "Td"
0820: *
0821: * @param dx
0822: * The x offset for the new glyph starting point from the last
0823: * text line starting point.
0824: * @param dy
0825: * The y offset for the new glyph starting point from the last
0826: * text line starting point.
0827: */
0828: public void textLineMove(float dx, float dy);
0829:
0830: /**
0831: * Move the current text cursor by <code>dx</code>, <code>dy</code>.
0832: * <p>
0833: * There is no graphics operator for this. It is implemented as a tool for
0834: * the ease of creating a content stream.
0835: *
0836: * @param dx
0837: * The x offset for the new glyph starting point from the current
0838: * text cursor position.
0839: * @param dy
0840: * The x offset for the new glyph starting point from the current
0841: * text cursor position.
0842: */
0843: public void textMove(float dx, float dy);
0844:
0845: /**
0846: * Move the current text cursor to <code>x</code>, <code>y</code>.
0847: * <p>
0848: * There is no graphics operator for this. It is implemented as a tool for
0849: * the ease of creating a content stream.
0850: *
0851: * @param x
0852: * The x coordinate for the next glyph starting point .
0853: * @param y
0854: * The y coordinate for the next glyph starting point .
0855: */
0856: public void textMoveTo(float x, float y);
0857:
0858: /**
0859: * Move the current position to a new line. <code>y</code>.
0860: * <p>
0861: * PDF graphics operator "T*"
0862: */
0863: public void textLineNew();
0864:
0865: /**
0866: * Set the character spacing.
0867: * <p>
0868: * PDF graphics operator "Tc"
0869: *
0870: * @param charSpacing
0871: * The character spacing
0872: */
0873: public void textSetCharSpacing(float charSpacing);
0874:
0875: /**
0876: * Set the current font and size.
0877: * <p>
0878: * PDF graphics operator "Tf"
0879: *
0880: * @param resourceName
0881: * The logical name of the resource in the {@link PDResources}
0882: * @param font
0883: * The new {@link PDFont}
0884: * @param size
0885: * The new font size (scaling)
0886: */
0887: public void textSetFont(COSName resourceName, PDFont font,
0888: float size);
0889:
0890: /**
0891: * Set the horizontal scling factor.
0892: * <p>
0893: * PDF graphics operator "Tz"
0894: *
0895: * @param scale
0896: * The new horizontal scaling factor.
0897: */
0898: public void textSetHorizontalScaling(float scale);
0899:
0900: /**
0901: * Set the text leading.
0902: * <p>
0903: * PDF graphics operator "TL"
0904: *
0905: * @param leading
0906: * The new leading
0907: */
0908: public void textSetLeading(float leading);
0909:
0910: /**
0911: * Set the text rendering mode.
0912: * <p>
0913: * PDF graphics operator "Tr"
0914: *
0915: * @param renderingMode
0916: * The new rendering mode.
0917: */
0918: public void textSetRenderingMode(int renderingMode);
0919:
0920: /**
0921: * Set the text rise.
0922: * <p>
0923: * PDF graphics operator "Ts"
0924: *
0925: * @param rise
0926: * The new text rise (super/subscript) amount
0927: */
0928: public void textSetRise(float rise);
0929:
0930: /**
0931: * Set the text transformation matrix. Both the text matrix anf the text
0932: * line matrix are set to the new values.
0933: * <p>
0934: * PDF graphics operator "Tm"
0935: *
0936: * @param a
0937: * operand 1,1 in the matrix
0938: * @param b
0939: * operand 1,2 in the matrix
0940: * @param c
0941: * operand 2,1 in the matrix
0942: * @param d
0943: * operand 2,2 in the matrix
0944: * @param e
0945: * operand 3,1 in the matrix
0946: * @param f
0947: * operand 3,2 in the matrix
0948: */
0949: public void textSetTransform(float a, float b, float c, float d,
0950: float e, float f);
0951:
0952: /**
0953: * Set the word spacing.
0954: * <p>
0955: * PDF graphics operator "Tw"
0956: *
0957: * @param wordSpacing
0958: * The new word spacing.
0959: */
0960: public void textSetWordSpacing(float wordSpacing);
0961:
0962: /**
0963: * Show a sequence of bytes as text.
0964: * <p>
0965: * PDF graphics operator "Tj"
0966: *
0967: * @param text
0968: * The bytes to be shown.
0969: * @param offset
0970: * @param length
0971: */
0972: public void textShow(byte[] text, int offset, int length);
0973:
0974: /**
0975: * Show a string value as text, using the current font encoding.
0976: * <p>
0977: * This is an optional operation from the viewpoint of an
0978: * {@link ICSInterpreter}. It is called only "manually" in content creation
0979: * devices. This method may throw an {@link UnsupportedOperationException}.
0980: * <p>
0981: * PDF graphics operator "Tj"
0982: *
0983: * @param text
0984: * The text value to be shown using the current fonts encoding.
0985: */
0986: public void textShow(String text);
0987:
0988: /**
0989: * Set the glyph width for a type 3 font.
0990: * <p>
0991: * PDF graphics operator "d0"
0992: *
0993: * @param x
0994: * The glyph width
0995: * @param y
0996: * must be 0
0997: */
0998: public void textT3SetGlyphWidth(float x, float y);
0999:
1000: /**
1001: * Set the glyph width and bounding box for a type 3 font.
1002: * <p>
1003: * PDF graphics operator "d1"
1004: *
1005: * @param x
1006: * The glyph width.
1007: * @param y
1008: * must be 0
1009: * @param llx
1010: * lower left x of bounding box
1011: * @param lly
1012: * lower left y of bounding box
1013: * @param urx
1014: * upper right x of bounding box
1015: * @param ury
1016: * upper right y of bounding box
1017: */
1018: public void textT3SetGlyphWidthBB(float x, float y, float llx,
1019: float lly, float urx, float ury);
1020:
1021: /**
1022: * Modify the current transformation matrix by concatenating the
1023: * transformations.
1024: *
1025: * <p>
1026: * PDF graphics operator "cm"
1027: * </p>
1028: *
1029: * @param a
1030: * operand 1,1 in the matrix
1031: * @param b
1032: * operand 1,2 in the matrix
1033: * @param c
1034: * operand 2,1 in the matrix
1035: * @param d
1036: * operand 2,2 in the matrix
1037: * @param e
1038: * operand 3,1 in the matrix
1039: * @param f
1040: * operand 3,2 in the matrix
1041: */
1042: public void transform(float a, float b, float c, float d, float e,
1043: float f);
1044:
1045: /**
1046: * The {@link ICSInterpreter} associated with this {@link ICSDevice}. The
1047: * interpreter is associated with "open" and should be no longer used after
1048: * "close".
1049: *
1050: * @return The {@link ICSInterpreter} associated with this {@link ICSDevice}.
1051: */
1052: public ICSInterpreter getInterpreter();
1053:
1054: /**
1055: * The current {@link ICSGraphicsState} active.
1056: * <p>
1057: * This is a read only representation of the graphics state used when
1058: * performing rendering operations in the device.
1059: *
1060: * @return The current {@link ICSGraphicsState} active.
1061: */
1062: public ICSGraphicsState getGraphicsState();
1063: }
|