本文整理了Java中org.apache.pdfbox.util.Matrix.getRotateInstance()
方法的一些代码示例,展示了Matrix.getRotateInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getRotateInstance()
方法的具体详情如下:
包路径:org.apache.pdfbox.util.Matrix
类名称:Matrix
方法名:getRotateInstance
[英]Convenience method to create a rotated instance.
[中]创建旋转实例的便捷方法。
代码示例来源:origin: apache/pdfbox
/**
* Rotares this matrix by the given factors.
*
* @param theta The angle of rotation measured in radians
*/
public void rotate(double theta)
{
Matrix m = Matrix.getRotateInstance(theta, 0, 0);
concatenate(m);
}
代码示例来源:origin: apache/pdfbox
/**
* The Tm operator. Sets the text matrix to the given rotation and translation values.
* A current text matrix will be replaced with the new one.
* @param angle The angle used for the counterclockwise rotation in radians.
* @param tx The translation value in x-direction.
* @param ty The translation value in y-direction.
* @throws IOException If there is an error writing to the stream.
* @deprecated Use {@link #setTextMatrix(Matrix)} instead.
*/
@Deprecated
public void setTextRotation(double angle, double tx, double ty) throws IOException
{
setTextMatrix(Matrix.getRotateInstance(angle, (float) tx, (float) ty));
}
代码示例来源:origin: apache/pdfbox
private AffineTransform calculateMatrix(PDRectangle bbox, int rotation)
{
if (rotation == 0)
{
return new AffineTransform();
}
float tx = 0, ty = 0;
switch (rotation)
{
case 90:
tx = bbox.getUpperRightY();
break;
case 180:
tx = bbox.getUpperRightY();
ty = bbox.getUpperRightX();
break;
case 270:
ty = bbox.getUpperRightX();
break;
default:
break;
}
Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), tx, ty);
return matrix.createAffineTransform();
}
代码示例来源:origin: apache/pdfbox
cs.transform(Matrix.getRotateInstance(angle, x1, y1));
cs.transform(Matrix.getRotateInstance(angle, x2, y2));
代码示例来源:origin: apache/pdfbox
private void drawUpLeftArrow(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
adjustRectAndBBox(annotation, 17, 17);
contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(1);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.59f); // value from Adobe
contentStream.transform(Matrix.getRotateInstance(Math.toRadians(45), 8, -4));
contentStream.moveTo(1, 7);
contentStream.lineTo(5, 7);
contentStream.lineTo(5, 1);
contentStream.lineTo(12, 1);
contentStream.lineTo(12, 7);
contentStream.lineTo(16, 7);
contentStream.lineTo(8.5f, 19);
contentStream.closeAndFillAndStroke();
}
代码示例来源:origin: apache/pdfbox
cs.transform(Matrix.getRotateInstance(angle, x1, y1));
float lineLength = (float) Math.sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
if (ANGLED_STYLES.contains(annotation.getStartPointEndingStyle()))
cs.transform(Matrix.getRotateInstance(angle, x1, y1));
drawStyle(annotation.getStartPointEndingStyle(), cs, 0, y, lineEndingSize, hasStroke, hasBackground, false);
cs.transform(Matrix.getRotateInstance(angle, x2, y2));
drawStyle(annotation.getEndPointEndingStyle(), cs, 0, y, lineEndingSize, hasStroke, hasBackground, true);
代码示例来源:origin: apache/pdfbox
PDPageContentStream.AppendMode.PREPEND, false))
cs.transform(Matrix.getRotateInstance(-Math.toRadians(angle), 0, 0));
代码示例来源:origin: org.apache.pdfbox/pdfbox
/**
* Rotares this matrix by the given factors.
*
* @param theta The angle of rotation measured in radians
*/
public void rotate(double theta)
{
Matrix m = Matrix.getRotateInstance(theta, 0, 0);
concatenate(m);
}
代码示例来源:origin: apache/tika
cs.transform(Matrix.getRotateInstance(-Math.toRadians(angle), 0, 0));
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
/**
* Rotares this matrix by the given factors.
*
* @param theta The angle of rotation measured in radians
*/
public void rotate(double theta)
{
Matrix m = Matrix.getRotateInstance(theta, 0, 0);
concatenate(m);
}
代码示例来源:origin: org.apache.pdfbox/pdfbox
/**
* The Tm operator. Sets the text matrix to the given rotation and translation values.
* A current text matrix will be replaced with the new one.
* @param angle The angle used for the counterclockwise rotation in radians.
* @param tx The translation value in x-direction.
* @param ty The translation value in y-direction.
* @throws IOException If there is an error writing to the stream.
* @deprecated Use {@link #setTextMatrix(Matrix)} instead.
*/
@Deprecated
public void setTextRotation(double angle, double tx, double ty) throws IOException
{
setTextMatrix(Matrix.getRotateInstance(angle, (float) tx, (float) ty));
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
/**
* The Tm operator. Sets the text matrix to the given rotation and translation values.
* A current text matrix will be replaced with the new one.
* @param angle The angle used for the counterclockwise rotation in radians.
* @param tx The translation value in x-direction.
* @param ty The translation value in y-direction.
* @throws IOException If there is an error writing to the stream.
* @deprecated Use {@link #setTextMatrix(Matrix)} instead.
*/
@Deprecated
public void setTextRotation(double angle, double tx, double ty) throws IOException
{
setTextMatrix(Matrix.getRotateInstance(angle, (float) tx, (float) ty));
}
代码示例来源:origin: apache/pdfbox
cs.transform(Matrix.getRotateInstance(angle, x1, y1));
cs.transform(Matrix.getRotateInstance(Math.toRadians(rotation), 0, 0));
float xOffset;
float yOffset;
代码示例来源:origin: apache/pdfbox
contentStream.setTextMatrix(Matrix.getRotateInstance(Math.PI / 2, centerX, centerY));
代码示例来源:origin: apache/pdfbox
Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 0, 0);
Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), rect.getHeight());
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getRotateInstance(Math.toRadians(45), 2500, -800));
代码示例来源:origin: apache/pdfbox
contentStream.setTextMatrix(Matrix.getRotateInstance(i * Math.PI * 0.25,
centeredXPosition, pageSize.getHeight() - centeredYPosition));
contentStream.showText(message + " " + i);
contentStream.setTextMatrix(Matrix.getRotateInstance(-i*Math.PI*0.25,
centeredXPosition, centeredYPosition));
contentStream.showText(message + " " + i);
代码示例来源:origin: org.apache.pdfbox/pdfbox
private AffineTransform calculateMatrix(PDRectangle bbox, int rotation)
{
if (rotation == 0)
{
return new AffineTransform();
}
float tx = 0, ty = 0;
switch (rotation)
{
case 90:
tx = bbox.getUpperRightY();
break;
case 180:
tx = bbox.getUpperRightY();
ty = bbox.getUpperRightX();
break;
case 270:
ty = bbox.getUpperRightX();
break;
default:
break;
}
Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), tx, ty);
return matrix.createAffineTransform();
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
private AffineTransform calculateMatrix(PDRectangle bbox, int rotation)
{
if (rotation == 0)
{
return new AffineTransform();
}
float tx = 0, ty = 0;
switch (rotation)
{
case 90:
tx = bbox.getUpperRightY();
break;
case 180:
tx = bbox.getUpperRightY();
ty = bbox.getUpperRightX();
break;
case 270:
ty = bbox.getUpperRightX();
break;
default:
break;
}
Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), tx, ty);
return matrix.createAffineTransform();
}
代码示例来源:origin: org.apache.tika/tika-parsers
cs.transform(Matrix.getRotateInstance(-Math.toRadians(angle), 0, 0));
内容来源于网络,如有侵权,请联系作者删除!