private TilingPaintParameter(Matrix matrix, COSDictionary patternDict, PDColorSpace colorSpace, PDColor color, AffineTransform xform) { this.matrix = matrix.clone(); this.patternDict = patternDict; this.colorSpace = colorSpace; this.color = color; this.xform = xform; }
/** * Produces a copy of the first matrix, with the second matrix concatenated. * * @param a The matrix to copy. * @param b The matrix to concatenate. */ public static Matrix concatenate(Matrix a, Matrix b) { Matrix copy = a.clone(); copy.concatenate(b); return copy; }
@Override public PDGraphicsState clone() { try { PDGraphicsState clone = (PDGraphicsState)super.clone(); clone.textState = textState.clone(); clone.currentTransformationMatrix = currentTransformationMatrix.clone(); clone.strokingColor = strokingColor; // immutable clone.nonStrokingColor = nonStrokingColor; // immutable clone.lineDashPattern = lineDashPattern; // immutable clone.clippingPath = clippingPath; // not cloned, see intersectClippingPath clone.isClippingPathDirty = false; return clone; } catch (CloneNotSupportedException e) { // should not happen throw new RuntimeException(e); } }
@Override public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException { if (arguments.size() < 6) { throw new MissingOperandException(operator, arguments); } if (!checkArrayTypesClass(arguments, COSNumber.class)) { return; } COSNumber a = (COSNumber)arguments.get( 0 ); COSNumber b = (COSNumber)arguments.get( 1 ); COSNumber c = (COSNumber)arguments.get( 2 ); COSNumber d = (COSNumber)arguments.get( 3 ); COSNumber e = (COSNumber)arguments.get( 4 ); COSNumber f = (COSNumber)arguments.get( 5 ); Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), c.floatValue(), d.floatValue(), e.floatValue(), f.floatValue()); context.setTextMatrix(matrix); context.setTextLineMatrix(matrix.clone()); }
@Override public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException { if (arguments.size() < 2) { throw new MissingOperandException(operator, arguments); } Matrix textLineMatrix = context.getTextLineMatrix(); if (textLineMatrix == null) { LOG.warn("TextLineMatrix is null, " + getName() + " operator will be ignored"); return; } COSBase base0 = arguments.get(0); COSBase base1 = arguments.get(1); if (!(base0 instanceof COSNumber)) { return; } if (!(base1 instanceof COSNumber)) { return; } COSNumber x = (COSNumber) base0; COSNumber y = (COSNumber) base1; Matrix matrix = new Matrix(1, 0, 0, 1, x.floatValue(), y.floatValue()); textLineMatrix.concatenate(matrix); context.setTextMatrix(textLineMatrix.clone()); }
private TilingPaintParameter(Matrix matrix, COSDictionary patternDict, PDColorSpace colorSpace, PDColor color, AffineTransform xform) { this.matrix = matrix.clone(); this.patternDict = patternDict; this.colorSpace = colorSpace; this.color = color; this.xform = xform; }
private TilingPaintParameter(Matrix matrix, COSDictionary patternDict, PDColorSpace colorSpace, PDColor color, AffineTransform xform) { this.matrix = matrix.clone(); this.patternDict = patternDict; this.colorSpace = colorSpace; this.color = color; this.xform = xform; }
initialMatrix = aa.clone();
/** * Process a content stream. * * @param contentStream the content stream * @throws IOException if there is an exception while processing the stream */ private void processStream(PDContentStream contentStream) throws IOException { PDResources parent = pushResources(contentStream); Stack<PDGraphicsState> savedStack = saveGraphicsStack(); Matrix parentMatrix = initialMatrix; // transform the CTM using the stream's matrix getGraphicsState().getCurrentTransformationMatrix().concatenate(contentStream.getMatrix()); // the stream's initial matrix includes the parent CTM, e.g. this allows a scaled form initialMatrix = getGraphicsState().getCurrentTransformationMatrix().clone(); // clip to bounding box PDRectangle bbox = contentStream.getBBox(); clipToRect(bbox); processStreamOperators(contentStream); initialMatrix = parentMatrix; restoreGraphicsStack(savedStack); popResources(parent); }
/** * Produces a copy of the first matrix, with the second matrix concatenated. * * @param a The matrix to copy. * @param b The matrix to concatenate. */ public static Matrix concatenate(Matrix a, Matrix b) { Matrix copy = a.clone(); copy.concatenate(b); return copy; }
/** * Produces a copy of the first matrix, with the second matrix concatenated. * * @param a The matrix to copy. * @param b The matrix to concatenate. */ public static Matrix concatenate(Matrix a, Matrix b) { Matrix copy = a.clone(); copy.concatenate(b); return copy; }
initialMatrix = getGraphicsState().getCurrentTransformationMatrix().clone();
@Override public PDGraphicsState clone() { try { PDGraphicsState clone = (PDGraphicsState)super.clone(); clone.textState = textState.clone(); clone.currentTransformationMatrix = currentTransformationMatrix.clone(); clone.strokingColor = strokingColor; // immutable clone.nonStrokingColor = nonStrokingColor; // immutable clone.lineDashPattern = lineDashPattern; // immutable clone.clippingPath = clippingPath; // not cloned, see intersectClippingPath clone.isClippingPathDirty = false; return clone; } catch (CloneNotSupportedException e) { // should not happen throw new RuntimeException(e); } }
@Override public PDGraphicsState clone() { try { PDGraphicsState clone = (PDGraphicsState)super.clone(); clone.textState = textState.clone(); clone.currentTransformationMatrix = currentTransformationMatrix.clone(); clone.strokingColor = strokingColor; // immutable clone.nonStrokingColor = nonStrokingColor; // immutable clone.lineDashPattern = lineDashPattern; // immutable clone.clippingPath = clippingPath; // not cloned, see intersectClippingPath clone.isClippingPathDirty = false; return clone; } catch (CloneNotSupportedException e) { // should not happen throw new RuntimeException(e); } }
@Override public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException { if (arguments.size() < 6) { throw new MissingOperandException(operator, arguments); } if (!checkArrayTypesClass(arguments, COSNumber.class)) { return; } COSNumber a = (COSNumber)arguments.get( 0 ); COSNumber b = (COSNumber)arguments.get( 1 ); COSNumber c = (COSNumber)arguments.get( 2 ); COSNumber d = (COSNumber)arguments.get( 3 ); COSNumber e = (COSNumber)arguments.get( 4 ); COSNumber f = (COSNumber)arguments.get( 5 ); Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), c.floatValue(), d.floatValue(), e.floatValue(), f.floatValue()); context.setTextMatrix(matrix); context.setTextLineMatrix(matrix.clone()); }
@Override public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException { if (arguments.size() < 6) { throw new MissingOperandException(operator, arguments); } if (!checkArrayTypesClass(arguments, COSNumber.class)) { return; } COSNumber a = (COSNumber)arguments.get( 0 ); COSNumber b = (COSNumber)arguments.get( 1 ); COSNumber c = (COSNumber)arguments.get( 2 ); COSNumber d = (COSNumber)arguments.get( 3 ); COSNumber e = (COSNumber)arguments.get( 4 ); COSNumber f = (COSNumber)arguments.get( 5 ); Matrix matrix = new Matrix(a.floatValue(), b.floatValue(), c.floatValue(), d.floatValue(), e.floatValue(), f.floatValue()); context.setTextMatrix(matrix); context.setTextLineMatrix(matrix.clone()); }
@Override public void process(Operator operator, List<COSBase> arguments) throws MissingOperandException { if (arguments.size() < 2) { throw new MissingOperandException(operator, arguments); } Matrix textLineMatrix = context.getTextLineMatrix(); if (textLineMatrix == null) { LOG.warn("TextLineMatrix is null, " + getName() + " operator will be ignored"); return; } COSBase base0 = arguments.get(0); COSBase base1 = arguments.get(1); if (!(base0 instanceof COSNumber)) { return; } if (!(base1 instanceof COSNumber)) { return; } COSNumber x = (COSNumber) base0; COSNumber y = (COSNumber) base1; Matrix matrix = new Matrix(1, 0, 0, 1, x.floatValue(), y.floatValue()); textLineMatrix.concatenate(matrix); context.setTextMatrix(textLineMatrix.clone()); }
softmask.setInitialTransformationMatrix(gs.getCurrentTransformationMatrix().clone());
/** * Process a content stream. * * @param contentStream the content stream * @throws IOException if there is an exception while processing the stream * @throws PdfTimeoutException when parging pdf timeout */ private void processStream(PDContentStream contentStream) throws IOException, PdfTimeoutException { PDResources parent = pushResources(contentStream); Stack<PDGraphicsState> savedStack = saveGraphicsStack(); Matrix parentMatrix = initialMatrix; // transform the CTM using the stream's matrix getGraphicsState().getCurrentTransformationMatrix().concatenate(contentStream.getMatrix()); // the stream's initial matrix includes the parent CTM, e.g. this allows a scaled form initialMatrix = getGraphicsState().getCurrentTransformationMatrix().clone(); // clip to bounding box PDRectangle bbox = contentStream.getBBox(); clipToRect(bbox); processStreamOperators(contentStream); initialMatrix = parentMatrix; restoreGraphicsStack(savedStack); popResources(parent); }
/** * Process a content stream. * * @param contentStream the content stream * @throws IOException if there is an exception while processing the stream */ private void processStream(PDContentStream contentStream) throws IOException { PDResources parent = pushResources(contentStream); Stack<PDGraphicsState> savedStack = saveGraphicsStack(); Matrix parentMatrix = initialMatrix; // transform the CTM using the stream's matrix getGraphicsState().getCurrentTransformationMatrix().concatenate(contentStream.getMatrix()); // the stream's initial matrix includes the parent CTM, e.g. this allows a scaled form initialMatrix = getGraphicsState().getCurrentTransformationMatrix().clone(); // clip to bounding box PDRectangle bbox = contentStream.getBBox(); clipToRect(bbox); processStreamOperators(contentStream); initialMatrix = parentMatrix; restoreGraphicsStack(savedStack); popResources(parent); }