本文整理了Java中org.apache.pdfbox.util.Matrix.clone()
方法的一些代码示例,展示了Matrix.clone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.clone()
方法的具体详情如下:
包路径:org.apache.pdfbox.util.Matrix
类名称:Matrix
方法名:clone
[英]Clones this object.
[中]克隆此对象。
代码示例来源:origin: apache/pdfbox
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;
}
代码示例来源:origin: apache/pdfbox
/**
* 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;
}
代码示例来源:origin: apache/pdfbox
@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);
}
}
代码示例来源:origin: apache/pdfbox
@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());
}
代码示例来源:origin: apache/pdfbox
@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());
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
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;
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
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;
}
代码示例来源:origin: apache/pdfbox
initialMatrix = aa.clone();
代码示例来源:origin: apache/pdfbox
/**
* 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);
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
/**
* 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;
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
/**
* 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;
}
代码示例来源:origin: apache/pdfbox
initialMatrix = getGraphicsState().getCurrentTransformationMatrix().clone();
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
@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);
}
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
@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);
}
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
@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());
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
@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());
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
@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());
}
代码示例来源:origin: apache/pdfbox
softmask.setInitialTransformationMatrix(gs.getCurrentTransformationMatrix().clone());
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
/**
* 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);
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
/**
* 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);
}
内容来源于网络,如有侵权,请联系作者删除!