ICEpdf
  1. ICEpdf
  2. PDF-1008

Annotations with nonstandard blend mode can cause other annotations and tools to be rendered incorrectly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.2
    • Fix Version/s: 6.1.3
    • Component/s: Core/Rendering
    • Labels:
      None
    • Environment:
      ICEpdf 6.1.2 Pro
      Java SE 8u92 x64
      Windows 10 x64
    • Workaround Description:
      Hide
      While debugging Viewer RI, we discovered just one call to Graphics2D.setComposite(...) while the page was drawn, with the following stack trace:
      - BlendCompositeDrawCmd.paintOperand
      - Shapes.paintOperand
      - Annotation.renderAppearanceStream
      - TextMarkupAnnotation.renderAppearanceStream
      - Annotation.render
      - PageViewComponentImpl.paintAnnotations
      - PageViewComponentImpl.paintComponent
      - <...>

      It appears that Annotation.render(...) method never resets its Graphics2D's Composite property after it's done. We were able to fix the visual artifacts by getting/storing old Composite object and setting/restoring it before exiting. The same approach is already present in Annotation.render(...) for Transform and Clip properties.

      Here is the patch: https://gist.github.com/fragmer/3747eebebeda82dde6da9bf01b5498d8
      Show
      While debugging Viewer RI, we discovered just one call to Graphics2D.setComposite(...) while the page was drawn, with the following stack trace: - BlendCompositeDrawCmd.paintOperand - Shapes.paintOperand - Annotation.renderAppearanceStream - TextMarkupAnnotation.renderAppearanceStream - Annotation.render - PageViewComponentImpl.paintAnnotations - PageViewComponentImpl.paintComponent - <...> It appears that Annotation.render(...) method never resets its Graphics2D's Composite property after it's done. We were able to fix the visual artifacts by getting/storing old Composite object and setting/restoring it before exiting. The same approach is already present in Annotation.render(...) for Transform and Clip properties. Here is the patch: https://gist.github.com/fragmer/3747eebebeda82dde6da9bf01b5498d8

      Description

      I have a document with several TextMarkup annotations that have "multiply" blending mode. When a page with such annotations is rendered, some of the other annotations (that do not specify any special blending mode) and some tools in Viewer RI (e.g. SquareAnnotationTool) end up incorrectly rendered with "multiply" blend mode.

      Here are screenshots from Viewer RI demonstrating this problem:
      1. http://i.imgur.com/crdC6TQ.png -- This is a document with one correctly-rendered SquareAnnotation, as reference. No problems here.

      2. http://i.imgur.com/Qo5eZ5H.png -- This document contains some TextMarkup annotations with "multiply" blend mode. The new SquareAnnotation I added -- which has the exact same attributes as in the first screenshot -- is rendered much darker.

      3. http://i.imgur.com/cQeceoy.png -- Same document as #2, after I deleted all "multiply"-blended TextMarkup annotations from the page. The SquareAnnotation is again rendered normally.

      Unfortunately I cannot provide the PDF document here (proprietary company stuff), but we did find a workaround.

        Activity

        Matvei Stefarov created issue -
        Patrick Corless made changes -
        Field Original Value New Value
        Fix Version/s 6.1.3 [ 13086 ]
        Patrick Corless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Matvei Stefarov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: