Class GouraudShadingContext

    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
      • triangleList

        private java.util.List<ShadedTriangle> triangleList
        triangle list.
    • Constructor Detail

      • GouraudShadingContext

        protected GouraudShadingContext​(PDShading shading,
                                        java.awt.image.ColorModel colorModel,
                                        java.awt.geom.AffineTransform xform,
                                        Matrix matrix)
                                 throws java.io.IOException
        Constructor creates an instance to be used for fill operations.
        Parameters:
        shading - the shading type to be used
        colorModel - the color model to be used
        xform - transformation for user to device space
        matrix - the pattern matrix concatenated with that of the parent content stream
        Throws:
        java.io.IOException - if something went wrong
    • Method Detail

      • readVertex

        protected Vertex readVertex​(javax.imageio.stream.ImageInputStream input,
                                    long maxSrcCoord,
                                    long maxSrcColor,
                                    PDRange rangeX,
                                    PDRange rangeY,
                                    PDRange[] colRangeTab,
                                    Matrix matrix,
                                    java.awt.geom.AffineTransform xform)
                             throws java.io.IOException
        Read a vertex from the bit input stream performs interpolations.
        Parameters:
        input - bit input stream
        maxSrcCoord - max value for source coordinate (2^bits-1)
        maxSrcColor - max value for source color (2^bits-1)
        rangeX - dest range for X
        rangeY - dest range for Y
        colRangeTab - dest range array for colors
        matrix - the pattern matrix concatenated with that of the parent content stream
        Returns:
        a new vertex with the flag and the interpolated values
        Throws:
        java.io.IOException - if something went wrong
      • setTriangleList

        final void setTriangleList​(java.util.List<ShadedTriangle> triangleList)
      • calcPixelTable

        protected java.util.Map<java.awt.Point,​java.lang.Integer> calcPixelTable​(java.awt.Rectangle deviceBounds)
                                                                                throws java.io.IOException
        Description copied from class: TriangleBasedShadingContext
        Calculate every point and its color and store them in a Hash table.
        Specified by:
        calcPixelTable in class TriangleBasedShadingContext
        Returns:
        a Hash table which contains all the points' positions and colors of one image
        Throws:
        java.io.IOException
      • interpolate

        private float interpolate​(float src,
                                  long srcMax,
                                  float dstMin,
                                  float dstMax)
        Calculate the interpolation, see p.345 pdf spec 1.7.
        Parameters:
        src - src value
        srcMax - max src value (2^bits-1)
        dstMin - min dst value
        dstMax - max dst value
        Returns:
        interpolated value