• Sub-task
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0
    • 1.8.5, 2.0.0
    • PDModel
    • None


      Type 0 (Sampled) Functions are described in 3.9.1 of the pdf spec and basically, its cheating: there's an n-dimensional grid of values ("samples") and the function shall return these values or something in-between.

      PDFunctionType0 has two bugs:

      1) it does not do any interpolation. The function interpolate() is called several times, but only adjust values between ranges etc, not to calculate the color between 2^n samples - that part is "outputValues[i] = (outputValuesPrevious[i] + outputValuesNext[i]) / 2". The spec does not tell much, only that "Interpolation is used to determine output values from the nearest surrounding values in the sample table". I have done a linear/bilinear interpolation implementation for 1D/2D inputs. I did not do an interpolation implementation for 3D and higher, because its unclear whether this is actually used. Instead, I return random values.

      2) the sample bits are not collected correctly, the current code ignores the leftover bits when a row is done. The spec tells us "Successive values are adjacent in the bit stream; there is no padding at byte boundaries". Luckily, that one is easy to correct, three lines must be moved up. Alternatively, one might use the bit-io lib I mention in PDFBOX-615.


        1. technical_v2_p91.after.jpg
          53 kB
          John Hewson
        2. technical_v2_p9.before.pdf-1.png
          667 kB
          Tilman Hausherr
        3. technical_v2_p9.before.pdf
          5.35 MB
          John Hewson
        4. technical_v2_p9.before.jpg
          58 kB
          John Hewson
        5. PDFunctionType0.patch
          22 kB
          Tilman Hausherr
        6. PDFunctionType0.patch
          2 kB
          Tilman Hausherr
        7. PDFunctionType0.patch
          4 kB
          Tilman Hausherr
        8. devicen3.pdf-1.png
          50 kB
          Tilman Hausherr
        9. Devicen3.pdf
          349 kB
          John Hewson
        10. Devicen3.before.jpg
          85 kB
          John Hewson
        11. Devicen3.after.jpg
          37 kB
          John Hewson



            lehmi Andreas Lehmkühler
            tilman Tilman Hausherr
            0 Vote for this issue
            3 Start watching this issue