use of com.tom_roush.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream in project PdfBox-Android by TomRoush.
the class PDSquareAppearanceHandler method generateNormalAppearance.
@Override
public void generateNormalAppearance() {
float lineWidth = getLineWidth();
PDAnnotationSquareCircle annotation = (PDAnnotationSquareCircle) getAnnotation();
PDAppearanceContentStream contentStream = null;
try {
contentStream = getNormalAppearanceAsContentStream();
boolean hasStroke = contentStream.setStrokingColorOnDemand(getColor());
boolean hasBackground = contentStream.setNonStrokingColorOnDemand(annotation.getInteriorColor());
setOpacity(contentStream, annotation.getConstantOpacity());
contentStream.setBorderLine(lineWidth, annotation.getBorderStyle(), annotation.getBorder());
PDBorderEffectDictionary borderEffect = annotation.getBorderEffect();
if (borderEffect != null && borderEffect.getStyle().equals(PDBorderEffectDictionary.STYLE_CLOUDY)) {
CloudyBorder cloudyBorder = new CloudyBorder(contentStream, borderEffect.getIntensity(), lineWidth, getRectangle());
cloudyBorder.createCloudyRectangle(annotation.getRectDifference());
annotation.setRectangle(cloudyBorder.getRectangle());
annotation.setRectDifference(cloudyBorder.getRectDifference());
PDAppearanceStream appearanceStream = annotation.getNormalAppearanceStream();
appearanceStream.setBBox(cloudyBorder.getBBox());
appearanceStream.setMatrix(cloudyBorder.getMatrix());
} else {
PDRectangle borderBox = handleBorderBox(annotation, lineWidth);
contentStream.addRect(borderBox.getLowerLeftX(), borderBox.getLowerLeftY(), borderBox.getWidth(), borderBox.getHeight());
}
contentStream.drawShape(lineWidth, hasStroke, hasBackground);
} catch (IOException e) {
Log.e("PdfBox-Android", e.getMessage(), e);
} finally {
IOUtils.closeQuietly(contentStream);
}
}
Aggregations