/**
* The name of the Shading e.g. "Shading1"
*/
- protected String shadingName = null;
+ protected String shadingName;
- /**
- * Required: The Type of shading (1,2,3,4,5,6,7)
- */
- protected int shadingType = 3; // Default
+ private final Shading shading;
+ private final PDFFunction pdfFunction;
+ /**
+ * A ColorSpace representing the colorspace. "DeviceRGB" is an example.
+ */
+ protected PDFDeviceColorSpace colorSpace;
- /**
- * The background color. Since shading is opaque,
- * this is very rarely used.
- */
- protected List background;
-
- /**
- * Optional: A List specifying the clipping rectangle
- */
- protected List bBox;
-
- /**
- * Optional: A flag whether or not to filter the shading function
- * to prevent aliasing artifacts. Default is false.
- */
- protected boolean antiAlias;
-
- /**
- * Optional for Type 1: Array of four numbers, xmin, xmax, ymin, ymax.
- * Default is [0 1 0 1]
- * Optional for Type 2: An array of two numbers between which the blend
- * varies between start and end points. Default is 0, 1.
- * Optional for Type 3: An array of two numbers between which the blend
- * varies between start and end points. Default is 0, 1.
- */
- protected List domain;
-
- /**
- * Optional for Type 1: A transformation matrix
- */
- protected List matrix;
-
- /**
- * Required for Type 1, 2, and 3:
- * The object of the color mapping function (usually type 2 or 3).
- * Optional for Type 4,5,6, and 7: When it's nearly the same thing.
- */
- protected PDFFunction function;
-
- /**
- * Required for Type 2: An Array of four numbers specifying
- * the starting and ending coordinate pairs
- * Required for Type 3: An Array of six numbers [x0,y0,r0,x1,y1,r1]
- * specifying the centers and radii of
- * the starting and ending circles.
- */
- protected List coords;
-
- /**
- * Required for Type 2+3: An Array of two boolean values specifying
- * whether to extend the start and end colors past the start
- * and end points, respectively.
- * Default is false, false.
- */
- protected List extend;
-
- /**
- * Required for Type 4,5,6, and 7: Specifies the number of bits used
- * to represent each vertex coordinate.
- * Allowed to be 1,2,4,8,12,16,24, or 32.
- */
- protected int bitsPerCoordinate;
-
- /**
- * Required for Type 4,5,6, and 7: Specifies the number of bits used
- * to represent the edge flag for each vertex.
- * Allowed to be 2,4,or 8, while the Edge flag itself is allowed to
- * be 0,1 or 2.
- */
- protected int bitsPerFlag;
-
- /**
- * Required for Type 4,5,6, and 7: Array of Doubles which specifies
- * how to decode coordinate and color component values.
- * Each type has a differing number of decode array members, so check
- * the spec.
- * Page 303 in PDF Spec 1.3
- */
- protected List decode;
-
- /**
- * Required for Type 4,5,6, and 7: Specifies the number of bits used
- * to represent each color coordinate.
- * Allowed to be 1,2,4,8,12, or 16
- */
- protected int bitsPerComponent;
-
- /**
- * Required for Type 5:The number of vertices in each "row" of
- * the lattice; it must be greater than or equal to 2.
- */
- protected int verticesPerRow;
-
- /**
- * Constructor for type function based shading
- *
- * @param theShadingType The type of shading object, which should be 1 for function
- * based shading.
- * @param theColorSpace The colorspace is 'DeviceRGB' or something similar.
- * @param theBackground An array of color components appropriate to the
- * colorspace key specifying a single color value.
- * This key is used by the f operator buy ignored by the sh operator.
- * @param theBBox List of double's representing a rectangle
- * in the coordinate space that is current at the
- * time of shading is imaged. Temporary clipping
- * boundary.
- * @param theAntiAlias Whether or not to anti-alias.
- * @param theDomain Optional vector of Doubles specifying the domain.
- * @param theMatrix List of Doubles specifying the matrix.
- * If it's a pattern, then the matrix maps it to pattern space.
- * If it's a shading, then it maps it to current user space.
- * It's optional, the default is the identity matrix
- * @param theFunction The PDF Function that maps an (x,y) location to a color
- */
- public PDFShading(int theShadingType, PDFDeviceColorSpace theColorSpace,
- List theBackground, List theBBox,
- boolean theAntiAlias, List theDomain,
- List theMatrix, PDFFunction theFunction) {
- super();
- this.shadingType = theShadingType; // 1
- this.colorSpace = theColorSpace;
- this.background = theBackground;
- this.bBox = theBBox;
- this.antiAlias = theAntiAlias;
-
- this.domain = theDomain;
- this.matrix = theMatrix;
- this.function = theFunction;
-
- }
-
/**
* Constructor for Type 2 and 3
*