Class ShadingPattern
- java.lang.Object
-
- com.inductiveautomation.rm.pdf.reader.PDFPattern
-
- com.inductiveautomation.rm.pdf.reader.fps.ShadingPattern
-
- All Implemented Interfaces:
java.awt.Paint,java.awt.PaintContext,java.awt.Transparency
- Direct Known Subclasses:
AxialShading,FunctionShading,RadialShading
public abstract class ShadingPattern extends PDFPattern implements java.awt.PaintContext, java.awt.Paint
PDFShadingPattern.
-
-
Field Summary
Fields Modifier and Type Field Description static intArbitraryColorSpaceShadingstatic intDeviceGrayShadingstatic intDeviceRGBShading
-
Constructor Summary
Constructors Constructor Description ShadingPattern(java.util.Map patternDict, java.util.Map shadingDict, PDFFile srcFile)Constructor - patternDict may be null if this object was created from the shading operator (sh).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.PaintContextcreateContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)Paint & PaintContext interfacesvoiddispose()abstract voiddoShading(int[] samples, int x, int y, int w, int h)Subclasses should implement this method to draw the shading.java.awt.geom.Rectangle2DgetBounds()java.awt.image.ColorModelgetColorModel()static ShadingPatterngetInstance(java.util.Map dict, PDFFile srcFile)Create an instance from a shading dictionary or a pattern dictionary.java.awt.PaintgetPaint()Returns the awt Paint object which will render the patternjava.awt.image.RastergetRaster(int x, int y, int w, int h)intgetRGBAPixel(float[] sampleValues)This routine will get called for every pixel in the inner loop of the shading.java.awt.geom.AffineTransformgetTransform()Returns the pattern space transformintgetTransparency()Alpha & color definitionsvoidinitializeShadingParameters(java.util.Map shadingDict, PDFFile srcFile)Read the shading parametersvoidsetColorSpace(java.awt.color.ColorSpace c)voidsetDeviceTransform(java.awt.geom.AffineTransform x, java.awt.Rectangle devRect)Sets the transform from user space to device space-
Methods inherited from class com.inductiveautomation.rm.pdf.reader.PDFPattern
getGState, getInstance
-
-
-
-
Field Detail
-
DeviceRGBShading
public static final int DeviceRGBShading
- See Also:
- Constant Field Values
-
DeviceGrayShading
public static final int DeviceGrayShading
- See Also:
- Constant Field Values
-
ArbitraryColorSpaceShading
public static final int ArbitraryColorSpaceShading
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ShadingPattern
public ShadingPattern(java.util.Map patternDict, java.util.Map shadingDict, PDFFile srcFile)Constructor - patternDict may be null if this object was created from the shading operator (sh).
-
-
Method Detail
-
getInstance
public static ShadingPattern getInstance(java.util.Map dict, PDFFile srcFile)
Create an instance from a shading dictionary or a pattern dictionary.
-
initializeShadingParameters
public void initializeShadingParameters(java.util.Map shadingDict, PDFFile srcFile)Read the shading parameters
-
setDeviceTransform
public void setDeviceTransform(java.awt.geom.AffineTransform x, java.awt.Rectangle devRect)Sets the transform from user space to device space
-
getTransform
public java.awt.geom.AffineTransform getTransform()
Returns the pattern space transform- Specified by:
getTransformin classPDFPattern
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
-
setColorSpace
public void setColorSpace(java.awt.color.ColorSpace c)
-
getRGBAPixel
public int getRGBAPixel(float[] sampleValues)
This routine will get called for every pixel in the inner loop of the shading. If that gets too slow, you could always try to inline it. sampleValues are assumed to to have the right number of elements in the right range for the colorspace.
-
getPaint
public java.awt.Paint getPaint()
Description copied from class:PDFPatternReturns the awt Paint object which will render the pattern- Specified by:
getPaintin classPDFPattern
-
createContext
public java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)Paint & PaintContext interfaces- Specified by:
createContextin interfacejava.awt.Paint
-
dispose
public void dispose()
- Specified by:
disposein interfacejava.awt.PaintContext
-
getRaster
public java.awt.image.Raster getRaster(int x, int y, int w, int h)- Specified by:
getRasterin interfacejava.awt.PaintContext
-
getTransparency
public int getTransparency()
Alpha & color definitions- Specified by:
getTransparencyin interfacejava.awt.Transparency
-
getColorModel
public java.awt.image.ColorModel getColorModel()
- Specified by:
getColorModelin interfacejava.awt.PaintContext
-
doShading
public abstract void doShading(int[] samples, int x, int y, int w, int h)Subclasses should implement this method to draw the shading. Samples is defined to be an array of 8 bit persample/4 samples per pixel ARGB pixels. There is no padding, so all scanlines are w integers wide.
-
-