Package org.apache.fop.pdf
Class PDFShading
- java.lang.Object
-
- org.apache.fop.pdf.PDFObject
-
- org.apache.fop.pdf.PDFShading
-
- All Implemented Interfaces:
PDFWritable
public class PDFShading extends PDFObject
class representing a PDF Smooth Shading object. PDF Functions represent parameterized mathematical formulas and sampled representations with arbitrary resolution. Functions are used in two areas: device-dependent rasterization information for halftoning and transfer functions, and color specification for smooth shading (a PDF 1.3 feature). All PDF Functions have a shadingType (0,2,3, or 4), a Domain, and a Range.
-
-
Field Summary
Fields Modifier and Type Field Description private PDFFunction
pdfFunction
private Shading
shading
protected java.lang.String
shadingName
The name of the Shading e.g.
-
Constructor Summary
Constructors Constructor Description PDFShading(int shadingType, PDFDeviceColorSpace colorSpace, java.util.List coords, PDFFunction pdfFunction)
Constructor for Type 2 and 3
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
contentEquals(PDFObject obj)
Check if the other PDFObject has the same content as the current object.java.lang.String
getName()
Get the name of this shading.void
setName(java.lang.String name)
Sets the name of the shadingjava.lang.String
toPDFString()
represent as PDF.-
Methods inherited from class org.apache.fop.pdf.PDFObject
encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getChildren, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF
-
-
-
-
Field Detail
-
shadingName
protected java.lang.String shadingName
The name of the Shading e.g. "Shading1"
-
shading
private final Shading shading
-
pdfFunction
private final PDFFunction pdfFunction
-
-
Constructor Detail
-
PDFShading
public PDFShading(int shadingType, PDFDeviceColorSpace colorSpace, java.util.List coords, PDFFunction pdfFunction)
Constructor for Type 2 and 3- Parameters:
shadingType
- 2 or 3 for axial or radial shadingcolorSpace
- "DeviceRGB" or similar.coords
- List of four (type 2) or 6 (type 3) DoublepdfFunction
- the Stitching (PDFfunction type 3) function, even if it's stitching a single function
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the name of this shading.- Returns:
- the name of the shading
-
setName
public void setName(java.lang.String name)
Sets the name of the shading- Parameters:
name
- the name of the shading pattern. Can be anything without spaces. "Shading1" or "Sh1" are good examples.
-
toPDFString
public java.lang.String toPDFString()
represent as PDF. Whatever the shadingType is, the correct representation spits out. The sets of required and optional attributes are different for each type, but if a required attribute's object was constructed as null, then no error is raised. Instead, the malformed PDF that was requested by the construction is dutifully output. This policy should be reviewed.- Overrides:
toPDFString
in classPDFObject
- Returns:
- the PDF string.
-
contentEquals
protected boolean contentEquals(PDFObject obj)
Check if the other PDFObject has the same content as the current object.Note: This function has a contract which is less binding than
Object.equals(Object)
. Whereas equals would require all values to be identical, this method is not required to check everything. In the case of PDFObjects, this means that the overriding function does not have to check forPDFObject.getObjectID()
.- Overrides:
contentEquals
in classPDFObject
- Parameters:
obj
- object to compare to.- Returns:
- true if the other object has the same content.
-
-