org.icepdf.core.pobjects.graphics
Class ShadingPattern

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.graphics.ShadingPattern
All Implemented Interfaces:
Pattern
Direct Known Subclasses:
ShadingType1Pattern, ShadingType2Pattern, ShadingType3Pattern

public abstract class ShadingPattern
extends Dictionary
implements Pattern

Shading Pattern is a Base class for a all shading Types. It contains all common dictionary entries and acts a factory examing the patternType entry and returning a know Pattern Type implementation. Currently the factory only support Shading Type2 and Type3 patterns, as thses are the only types we have concrete examples of.

Since:
3.0
Author:
ICEsoft Technologies Inc.

Field Summary
protected  boolean antiAlias
           
protected  java.util.Vector background
           
protected  java.awt.geom.Rectangle2D bBox
           
protected  PColorSpace colorSpace
           
protected  ExtGState extGState
           
protected  boolean inited
           
protected  java.awt.geom.AffineTransform matrix
           
protected  int patternType
           
protected  java.util.Hashtable shading
           
static int SHADING_PATTERN_TYPE_1
           
static int SHADING_PATTERN_TYPE_2
           
static int SHADING_PATTERN_TYPE_3
           
static int SHADING_PATTERN_TYPE_4
           
static int SHADING_PATTERN_TYPE_5
           
static int SHADING_PATTERN_TYPE_6
           
protected  int shadingType
           
protected  java.lang.String type
           
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY
 
Fields inherited from interface org.icepdf.core.pobjects.graphics.Pattern
PATTERN_TYPE_SHADING, PATTERN_TYPE_TILING
 
Constructor Summary
ShadingPattern(Library library, java.util.Hashtable entries)
           
 
Method Summary
 java.util.Vector getBackground()
           
 java.awt.geom.Rectangle2D getBBox()
           
 PColorSpace getColorSpace()
           
 ExtGState getExtGState()
           
 java.awt.geom.AffineTransform getMatrix()
           
abstract  java.awt.Paint getPaint()
          Gets the Paint object need to fill a shape etc.
 int getPatternType()
           
static ShadingPattern getShadingPattern(Library library, java.util.Hashtable attribute)
          Factory method to resolve the shading dictionaries ShaddingType.
static ShadingPattern getShadingPattern(Library library, java.util.Hashtable entries, java.util.Hashtable shading)
          Factory call create a support pattern type.
 int getShadingType()
           
 java.lang.String getType()
           
abstract  void init()
          Initialized shading dictionary attributes.
 boolean isAntiAlias()
           
 boolean isInited()
           
 void setMatrix(java.awt.geom.AffineTransform matrix)
           
 void setParentGraphicState(GraphicsState graphicsState)
           
 void setShading(java.util.Hashtable shading)
           
 java.lang.String toString()
          Returns a summary of the dictionary entries.
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, getPObjectReference, isDeleted, isNew, setDeleted, setNew, setPObjectReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SHADING_PATTERN_TYPE_1

public static final int SHADING_PATTERN_TYPE_1
See Also:
Constant Field Values

SHADING_PATTERN_TYPE_2

public static final int SHADING_PATTERN_TYPE_2
See Also:
Constant Field Values

SHADING_PATTERN_TYPE_3

public static final int SHADING_PATTERN_TYPE_3
See Also:
Constant Field Values

SHADING_PATTERN_TYPE_4

public static final int SHADING_PATTERN_TYPE_4
See Also:
Constant Field Values

SHADING_PATTERN_TYPE_5

public static final int SHADING_PATTERN_TYPE_5
See Also:
Constant Field Values

SHADING_PATTERN_TYPE_6

public static final int SHADING_PATTERN_TYPE_6
See Also:
Constant Field Values

type

protected java.lang.String type

patternType

protected int patternType

shading

protected java.util.Hashtable shading

shadingType

protected int shadingType

bBox

protected java.awt.geom.Rectangle2D bBox

colorSpace

protected PColorSpace colorSpace

background

protected java.util.Vector background

antiAlias

protected boolean antiAlias

matrix

protected java.awt.geom.AffineTransform matrix

extGState

protected ExtGState extGState

inited

protected boolean inited
Constructor Detail

ShadingPattern

public ShadingPattern(Library library,
                      java.util.Hashtable entries)
Method Detail

getShadingPattern

public static ShadingPattern getShadingPattern(Library library,
                                               java.util.Hashtable attribute)
Factory method to resolve the shading dictionaries ShaddingType. Currently only types 2 and 3 are supported. In test suite these are the most common of the pattern shading types

Parameters:
library - library for document
attribute - dictionary for potential shading object.
Returns:
returns a ShadingPatern object based ont he shadingType criteria. if the proper constructor cannot be found then null is returned.

getShadingPattern

public static ShadingPattern getShadingPattern(Library library,
                                               java.util.Hashtable entries,
                                               java.util.Hashtable shading)
Factory call create a support pattern type. Currently only types 2 and 3 are supported.

Parameters:
library - document library
entries - entries in the the currently dictionary.
shading - shading dictionary.
Returns:
shading pattern

getPaint

public abstract java.awt.Paint getPaint()
Gets the Paint object need to fill a shape etc. Each individual implementation will return a particular paint type.

Specified by:
getPaint in interface Pattern
Returns:
Paint type for fill.

init

public abstract void init()
Initialized shading dictionary attributes. Discrepancies between sh and scn tokens cause us to handle initialization at a later time.

Specified by:
init in interface Pattern
Overrides:
init in class Dictionary

setParentGraphicState

public void setParentGraphicState(GraphicsState graphicsState)
Specified by:
setParentGraphicState in interface Pattern

setMatrix

public void setMatrix(java.awt.geom.AffineTransform matrix)
Specified by:
setMatrix in interface Pattern

getPatternType

public int getPatternType()
Specified by:
getPatternType in interface Pattern

getBBox

public java.awt.geom.Rectangle2D getBBox()
Specified by:
getBBox in interface Pattern

getMatrix

public java.awt.geom.AffineTransform getMatrix()
Specified by:
getMatrix in interface Pattern

getShadingType

public int getShadingType()

setShading

public void setShading(java.util.Hashtable shading)

getType

public java.lang.String getType()
Specified by:
getType in interface Pattern

getColorSpace

public PColorSpace getColorSpace()

getBackground

public java.util.Vector getBackground()

isAntiAlias

public boolean isAntiAlias()

getExtGState

public ExtGState getExtGState()

isInited

public boolean isInited()

toString

public java.lang.String toString()
Description copied from class: Dictionary
Returns a summary of the dictionary entries.

Overrides:
toString in class Dictionary
Returns:
dictionary values.