Example #1
0
 /**
  * Creates a new TextRenderInfo object
  * @param text the text that should be displayed
  * @param gs the graphics state (note: at this time, this is not immutable, so don't cache it)
  * @param textMatrix the text matrix at the time of the render operation
  * @param markedContentInfo the marked content sequence, if available
  */
 internal TextRenderInfo(String text, GraphicsState gs, Matrix textMatrix, ICollection markedContentInfo) {
     this.text = text;
     this.textToUserSpaceTransformMatrix = textMatrix.Multiply(gs.ctm);
     this.gs = gs;
     this.markedContentInfos = new List<MarkedContentInfo>();
     foreach (MarkedContentInfo m in markedContentInfo) {
         this.markedContentInfos.Add(m);
     }
 }
 public void Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List<PdfObject> operands) {
     GraphicsState gs = processor.gsStack.Peek();
     GraphicsState copy = new GraphicsState(gs);
     processor.gsStack.Push(copy);
 }
Example #3
0
 /**
  * Copy constructor.
  * @param source    another GraphicsState object
  */
 public GraphicsState(GraphicsState source){
     // note: all of the following are immutable, with the possible exception of font
     // so it is safe to copy them as-is
     ctm = source.ctm;
     characterSpacing = source.characterSpacing;
     wordSpacing = source.wordSpacing;
     horizontalScaling = source.horizontalScaling;
     leading = source.leading;
     font = source.font;
     fontSize = source.fontSize;
     renderMode = source.renderMode;
     rise = source.rise;
     knockout = source.knockout;
     colorSpaceFill = source.colorSpaceFill;
     colorSpaceStroke = source.colorSpaceStroke;
     fillColor = source.fillColor;
     strokeColor = source.strokeColor;
 }
 /**
  * If the operation is {@link #NO_OP} then the rule is ignored,
  * otherwise {@link #NONZERO_WINDING_RULE} is used by default.
  *
  * See {@link #PathPaintingRenderInfo(int, int, GraphicsState)}
  */
 public PathPaintingRenderInfo(int operation, GraphicsState gs) : this(operation, NONZERO_WINDING_RULE, gs) {
 }
 /**
  * @param operation One of the possible combinations of {@link #STROKE} and {@link #FILL} values or {@link #NO_OP}
  * @param rule      Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}.
  * @param gs        The graphics state.
  */
 public PathPaintingRenderInfo(int operation, int rule, GraphicsState gs) {
     this.operation = operation;
     this.rule = rule;
     this.gs = gs;
 }
 /**
  * Creates a new TextRenderInfo object
  * @param string the PDF string that should be displayed
  * @param gs the graphics state (note: at this time, this is not immutable, so don't cache it)
  * @param textMatrix the text matrix at the time of the render operation
  * @param markedContentInfo the marked content sequence, if available
  */
 internal TextRenderInfo(PdfString @string, GraphicsState gs, Matrix textMatrix, ICollection markedContentInfo) {
     this.@string = @string;
     this.textToUserSpaceTransformMatrix = textMatrix.Multiply(gs.ctm);
     this.gs = gs;
     this.markedContentInfos = new List<MarkedContentInfo>();
     if (markedContentInfo.Count > 0) { // check for performance purposes, as markedContentInfo.GetEnumerator is a costly operation for some reason
         foreach (MarkedContentInfo m in markedContentInfo) {
             this.markedContentInfos.Add(m);
         }
     }
     this.fontMatrix = gs.font.GetFontMatrix();
 }
 /**
  * Used for creating sub-TextRenderInfos for each individual character
  * @param parent the parent TextRenderInfo
  * @param string the content of a TextRenderInfo
  * @param horizontalOffset the unscaled horizontal offset of the character that this TextRenderInfo represents
  * @since 5.3.3
  */
 private TextRenderInfo(TextRenderInfo parent, PdfString @string, float horizontalOffset) {
     this.@string = @string;
     this.textToUserSpaceTransformMatrix = new Matrix(horizontalOffset, 0).Multiply(parent.textToUserSpaceTransformMatrix);
     this.gs = parent.gs;
     this.markedContentInfos = parent.markedContentInfos;
     this.fontMatrix = gs.font.GetFontMatrix();
 }
Example #8
0
 /**
  * Used for creating sub-TextRenderInfos for each individual character
  * @param parent the parent TextRenderInfo
  * @param charIndex the index of the character that this TextRenderInfo will represent
  * @param horizontalOffset the unscaled horizontal offset of the character that this TextRenderInfo represents
  * @since 5.3.3
  */
 private TextRenderInfo(TextRenderInfo parent, int charIndex, float horizontalOffset)
 {
     this.text = parent.text.Substring(charIndex, 1);
     this.textToUserSpaceTransformMatrix = new Matrix(horizontalOffset, 0).Multiply(parent.textToUserSpaceTransformMatrix);
     this.gs = parent.gs;
     this.markedContentInfos = parent.markedContentInfos;
 }
        /**
         * Create an ImageRenderInfo object based on inline image data.  This is nowhere near completely thought through
         * and really just acts as a placeholder.
         * @param ctm the coordinate transformation matrix at the time the image is rendered
         * @param imageObject the image object representing the inline image
         * @return the ImageRenderInfo representing the rendered embedded image
         * @since 5.0.1
         */
        protected internal static ImageRenderInfo CreateForEmbeddedImage(GraphicsState gs, InlineImageInfo inlineImageInfo, PdfDictionary colorSpaceDictionary, ICollection markedContentInfos)
        {
            ImageRenderInfo renderInfo = new ImageRenderInfo(gs, inlineImageInfo, colorSpaceDictionary, markedContentInfos);

            return(renderInfo);
        }
 /**
  * Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
  * @param ctm the coordinate transformation matrix at the time the image is rendered
  * @param ref a reference to the image XObject
  * @return the ImageRenderInfo representing the rendered XObject
  * @since 5.0.1
  */
 public static ImageRenderInfo CreateForXObject(GraphicsState gs, PdfIndirectReference refi, PdfDictionary colorSpaceDictionary, ICollection markedContentInfos)
 {
     return(new ImageRenderInfo(gs, refi, colorSpaceDictionary, markedContentInfos));
 }
 /**
  * Create an ImageRenderInfo object based on an XObject (this is the most common way of including an image in PDF)
  * @param ctm the coordinate transformation matrix at the time the image is rendered
  * @param ref a reference to the image XObject
  * @return the ImageRenderInfo representing the rendered XObject
  * @since 5.0.1
  */
 public static ImageRenderInfo CreateForXObject(GraphicsState gs, PdfIndirectReference refi, PdfDictionary colorSpaceDictionary)
 {
     return(new ImageRenderInfo(gs, refi, colorSpaceDictionary, null));
 }
 /**
  * If the operation is {@link #NO_OP} then the rule is ignored,
  * otherwise {@link #NONZERO_WINDING_RULE} is used by default.
  *
  * See {@link #PathPaintingRenderInfo(int, int, GraphicsState)}
  */
 public PathPaintingRenderInfo(int operation, GraphicsState gs) : this(operation, NONZERO_WINDING_RULE, gs)
 {
 }
 /**
  * @param operation One of the possible combinations of {@link #STROKE} and {@link #FILL} values or {@link #NO_OP}
  * @param rule      Either {@link #NONZERO_WINDING_RULE} or {@link #EVEN_ODD_RULE}.
  * @param gs        The graphics state.
  */
 public PathPaintingRenderInfo(int operation, int rule, GraphicsState gs)
 {
     this.operation = operation;
     this.rule      = rule;
     this.gs        = gs;
 }