Author: tilman Date: Tue Jan 30 20:51:31 2018 New Revision: 1822698 URL: http://svn.apache.org/viewvc?rev=1822698&view=rev Log: PDFBOX-3353: remove old ink appearance implementation
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1822698&r1=1822697&r2=1822698&view=diff ============================================================================== --- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original) +++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Tue Jan 30 20:51:31 2018 @@ -1109,100 +1109,6 @@ public class PageDrawer extends PDFGraph annotation.constructAppearances(null); } super.showAnnotation(annotation); - - //TODO delete these when PDFBOX-3353 done - if (annotation.getAppearance() == null) - { - if (annotation instanceof PDAnnotationLink) - { - drawAnnotationLinkBorder((PDAnnotationLink) annotation); - } - } - } - - // return border info. BorderStyle must be provided as parameter because - // method is not available in the base class - private AnnotationBorder getAnnotationBorder(PDAnnotation annotation, - PDBorderStyleDictionary borderStyle) - { - AnnotationBorder ab = new AnnotationBorder(); - COSArray border = annotation.getBorder(); - if (borderStyle == null) - { - if (border.getObject(2) instanceof COSNumber) - { - ab.width = ((COSNumber) border.getObject(2)).floatValue(); - } - if (border.size() > 3) - { - COSBase base3 = border.getObject(3); - if (base3 instanceof COSArray) - { - ab.dashArray = ((COSArray) base3).toFloatArray(); - } - } - } - else - { - ab.width = borderStyle.getWidth(); - if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_DASHED)) - { - ab.dashArray = borderStyle.getDashStyle().getDashArray(); - } - if (borderStyle.getStyle().equals(PDBorderStyleDictionary.STYLE_UNDERLINE)) - { - ab.underline = true; - } - } - ab.color = annotation.getColor(); - if (ab.color == null) - { - // spec is unclear, but black seems to be the right thing to do - ab.color = new PDColor(new float[] { 0 }, PDDeviceGray.INSTANCE); - } - if (ab.dashArray != null) - { - boolean allZero = true; - for (float f : ab.dashArray) - { - if (f != 0) - { - allZero = false; - break; - } - } - if (allZero) - { - ab.dashArray = null; - } - } - return ab; - } - - private void drawAnnotationLinkBorder(PDAnnotationLink link) throws IOException - { - AnnotationBorder ab = getAnnotationBorder(link, link.getBorderStyle()); - if (ab.width == 0 || ab.color.getComponents().length == 0) - { - return; - } - PDRectangle rectangle = link.getRectangle(); - Stroke oldStroke = graphics.getStroke(); - graphics.setPaint(getPaint(ab.color)); - BasicStroke stroke = new BasicStroke(ab.width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, ab.dashArray, 0); - graphics.setStroke(stroke); - graphics.setClip(null); - if (ab.underline) - { - graphics.drawLine((int) rectangle.getLowerLeftX(), (int) rectangle.getLowerLeftY(), - (int) (rectangle.getLowerLeftX() + rectangle.getWidth()), (int) rectangle.getLowerLeftY()); - } - else - { - graphics.drawRect((int) rectangle.getLowerLeftX(), (int) rectangle.getLowerLeftY(), - (int) rectangle.getWidth(), (int) rectangle.getHeight()); - } - graphics.setStroke(oldStroke); } @Override