Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1641

[PATCH] ArrayIndexOutOfBoundsException when applying a CMYK color in PDFGraphics2D

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.5
    • None
    • renderer/pdf
    • Operating System: Windows XP
      Platform: PC
    • 46882

    Description

      There are two bugs in PDFGraphics2D.applyColor.

      Firstly, when applying a color with CMYK colorspace the number of components is 4, not 3.
      See line 744:
      float[] cComps = c.getColorComponents(new float[3]); //results in ArrayIndexOutOfBoundsException

      Secondly, Color.getColorComponents returns values in the range [0, 1] while PDFColor expects them in the [0, 255] range.

      I attached the patch and a sample program to reproduce the trouble.

      Regards,
      Yegor kozlov

      Attachments

        1. FOPScratchpad.java
          0.6 kB
          Yegor Kozlov
        2. cmyk_colorspace.patch
          1 kB
          Yegor Kozlov

        Activity

          People

            fop-dev@xmlgraphics.apache.org fop-dev
            roller_yegor Yegor Kozlov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: