ICEpdf
  1. ICEpdf
  2. PDF-1009

Annotation tool support for alpha in external graphics (CA, ca)

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.2
    • Fix Version/s: 6.2
    • Component/s: Viewer RI
    • Labels:
      None
    • Environment:
      ICEpdf 6.1.2 Pro
      Java SE 8u92 x64
      Windows 10 x64

      Description

      Chosen transparency is ignored for annotation "Border Color", "Ink Color", and "Line Color".

      Steps to reproduce:
      1) Open sample PDF doc in Viewer RI and show the utility pane
      2) Select any of the graphical tools (Line, Rectangle, Circle, or Ink Annotation)
      3) Create an annotation anywhere on the page, and select it
      4) Change line/border/ink color for the selected annotation, specifying alpha value less than 255: http://i.imgur.com/WeKkx5k.png

      Expected behavior:
      Annotation line/border/ink becomes partially transparent: http://i.imgur.com/oL4EeiX.png (mocked up).

      Actual behavior:
      Annotation line/border/ink remains fully opaque: http://i.imgur.com/KP1cBjD.png

      Additional info:
      Expected behavior is possible to achieve programmatically by extending SquareAnnotationHandler and setting lineColor field to a Color object with partial alpha.

        Activity

        Hide
        Matvei Stefarov added a comment -

        Actually, it seems that the problem is in Annotation.setColor(...) rather than in the Viewer RI code. The first line of this method copies just the RGB components, and discards the alpha channel. So I was incorrect – it's not possible to work around this by extending AnnotationHandlers, since that would only fix the tool appearance, and not appearance of the actual annotation.

        Show
        Matvei Stefarov added a comment - Actually, it seems that the problem is in Annotation.setColor(...) rather than in the Viewer RI code. The first line of this method copies just the RGB components, and discards the alpha channel. So I was incorrect – it's not possible to work around this by extending AnnotationHandlers, since that would only fix the tool appearance, and not appearance of the actual annotation.
        Hide
        Matvei Stefarov added a comment -

        Hmm. Digging deeper into this, I see that PDF spec does not permit RGBA values for Annotation color ("C" key). So the behavior in Annotation.setColor(...) is correct. I guess my only option to get transparent annotations is to define an AppearanceStream for my annotations. I'll have to take a look at how "fillColor" is handled (which does appear to support transparency/RGBA), and try to emulate it.

        So – instead of a bug report, consider this a feature request: allow RGBA colors to be used for Annotation.setColor(...)

        Show
        Matvei Stefarov added a comment - Hmm. Digging deeper into this, I see that PDF spec does not permit RGBA values for Annotation color ("C" key). So the behavior in Annotation.setColor(...) is correct. I guess my only option to get transparent annotations is to define an AppearanceStream for my annotations. I'll have to take a look at how "fillColor" is handled (which does appear to support transparency/RGBA), and try to emulate it. So – instead of a bug report, consider this a feature request: allow RGBA colors to be used for Annotation.setColor(...)
        Hide
        Patrick Corless added a comment -

        As you already researched the PDF colour mechanism doesn't support alpha. Alpha values are defined using an external graphics context. It would take a bit of work but it could be added as an enhancement for out annotation tools. I'll update this bug to reflect the enhancement request.

        Show
        Patrick Corless added a comment - As you already researched the PDF colour mechanism doesn't support alpha. Alpha values are defined using an external graphics context. It would take a bit of work but it could be added as an enhancement for out annotation tools. I'll update this bug to reflect the enhancement request.
        Hide
        Patrick Corless added a comment -

        Marking as fixed.

        Show
        Patrick Corless added a comment - Marking as fixed.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: