Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5498

Setting NonStrokingColor with RGB checks wrong color ranges

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Bug
    • 3.0.0 PDFBox
    • None
    • None

    Description

      In the PDAbstractContentStream, you can set the NonStrokingColor by passing RGB values.

      However, these values may only be 0 or 1, as they are checked with isOutsideOneInterval():

       

      public void setNonStrokingColor(float r, float g, float b) throws IOException {

         if (isOutsideOneInterval(r) || isOutsideOneInterval(g) || isOutsideOneInterval(b))
         {
            throw new IllegalArgumentException("Parameters must be within 0..1, but are "
            + String.format("(%.2f,%.2f,%.2f)", r, g, b));
         }
         ...

      }

       

      The comment of the method seems correct to me: "Range is 0..255."

       

      So I suppose the values have to be checked using isOutside255Interval(.).

      Attachments

        Activity

          People

            Unassigned Unassigned
            holleymcfly Holger Herrmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: