org.foray.pdf.object
Class PDFPattern

java.lang.Object
  extended by org.foray.pdf.object.PDFObject
      extended by org.foray.pdf.object.PDFPathPaint
          extended by org.foray.pdf.object.PDFPattern
All Implemented Interfaces:
org.axsl.pdf.PdfPathPaint, org.axsl.pdf.PdfPattern

public class PDFPattern
extends PDFPathPaint
implements org.axsl.pdf.PdfPattern

class representing a PDF Function. 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 FunctionType (0,2,3, or 4), a Domain, and a Range.


Field Summary
 
Fields inherited from class org.foray.pdf.object.PDFObject
EOL, MSG_EOL, XREF_EOL
 
Constructor Summary
PDFPattern(PDFDocument doc, int thePatternType, PDFShading theShading, List<Integer> theXUID, StringBuilder theExtGState, List<Double> theMatrix)
          Create a type 2 pattern (smooth shading).
PDFPattern(PDFDocument doc, PDFResources theResources, int thePatternType, int thePaintType, int theTilingType, List<Double> theBBox, double theXStep, double theYStep, List<Double> theMatrix, List<Integer> theXUID, StringBuilder thePatternDataStream)
          Create a tiling pattern (type 1).
 
Method Summary
 String getName()
          Get the name of the pattern.
 String getSetterString(boolean fillNotStroke)
           
 String toPDF()
          represent as PDF.
 
Methods inherited from class org.foray.pdf.object.PDFPathPaint
getColorSpace, setColorSpace
 
Methods inherited from class org.foray.pdf.object.PDFObject
bufferToByteArray, byteArrayToStream, getCharsPerLine, getGeneration, getLogger, getNumber, getPDFDocument, output, pdfID, pdfReference, setNumber, stringToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFPattern

public PDFPattern(PDFDocument doc,
                  PDFResources theResources,
                  int thePatternType,
                  int thePaintType,
                  int theTilingType,
                  List<Double> theBBox,
                  double theXStep,
                  double theYStep,
                  List<Double> theMatrix,
                  List<Integer> theXUID,
                  StringBuilder thePatternDataStream)
Create a tiling pattern (type 1).

Parameters:
doc - The PDF document being built.
theResources - the resources associated with this pattern
thePatternType - the type of pattern, which is 1 for tiling.
thePaintType - 1 or 2, colored or uncolored.
theTilingType - 1, 2, or 3, constant spacing, no distortion, or faster tiling.
theBBox - List of Doubles: The pattern cell bounding box
theXStep - horizontal spacing
theYStep - vertical spacing
theMatrix - Optional List of Doubles transformation matrix
theXUID - Optional List of Integers that uniquely identify the pattern.
thePatternDataStream - The stream of pattern data to be tiled.

PDFPattern

public PDFPattern(PDFDocument doc,
                  int thePatternType,
                  PDFShading theShading,
                  List<Integer> theXUID,
                  StringBuilder theExtGState,
                  List<Double> theMatrix)
Create a type 2 pattern (smooth shading).

Parameters:
doc - The PDF document being built.
thePatternType - the type of the pattern, which is 2, smooth shading
theShading - the PDF Shading object that comprises this pattern
theXUID - optional:the extended unique Identifier if used.
theExtGState - optional: the extended graphics state, if used.
theMatrix - Optional:List of Doubles that specify the matrix.
Method Detail

getName

public String getName()
Get the name of the pattern.

Returns:
String representing the name of the pattern.

getSetterString

public String getSetterString(boolean fillNotStroke)
Specified by:
getSetterString in interface org.axsl.pdf.PdfPathPaint

toPDF

public String toPDF()
represent as PDF. Whatever the FunctionType 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.

Returns:
the PDF string.


Copyright © 2017. All rights reserved.