本文整理汇总了Java中org.apache.pdfbox.pdmodel.edit.PDPageContentStream.setLineDashPattern方法的典型用法代码示例。如果您正苦于以下问题:Java PDPageContentStream.setLineDashPattern方法的具体用法?Java PDPageContentStream.setLineDashPattern怎么用?Java PDPageContentStream.setLineDashPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pdfbox.pdmodel.edit.PDPageContentStream
的用法示例。
在下文中一共展示了PDPageContentStream.setLineDashPattern方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLineDashPattern
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入方法依赖的package包/类
private static void setLineDashPattern(PDPageContentStream contentStream, LineStyle lineStyle) throws IOException {
if (contentStream != null) { // && lineStyle != null) {
float[] pattern;
float phase;
switch (lineStyle) {
case DASHED:
pattern = new float[]{3.0f};
phase = 0.0f;
break;
default: //solid else...
pattern = new float[] {};
phase = 0.0f;
break;
}
// if (pattern != null) {
contentStream.setLineDashPattern(pattern, phase);
// }
}
}
示例2: applyTo
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; //导入方法依赖的package包/类
/**
* Applies this stroke to the given content stream.
* @param contentStream the content stream to apply this stroke to.
* @throws IOException by PDFBox.
*/
public void applyTo(final PDPageContentStream contentStream)
throws IOException {
if (getCapStyle() != null) {
contentStream.setLineCapStyle(getCapStyle().value());
}
if (getJoinStyle() != null) {
contentStream.setLineJoinStyle(getJoinStyle().value());
}
if (getDashPattern() != null) {
contentStream.setLineDashPattern(getDashPattern().getPattern(),
getDashPattern().getPhase());
}
contentStream.setLineWidth(getLineWidth());
}