org.icepdf.core.pobjects
Class Resources

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.Resources

public class Resources
extends Dictionary

A resource is a dictionary type as defined by the PDF specification. It can contain fonts, xobjects, colorspaces, patterns, shading and external graphic states.

Since:
1.0

Field Summary
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, inited, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
Resources(Library l, java.util.Hashtable h)
           
 
Method Summary
 void addReference(java.lang.Object referer)
          Increments the refernce count, meaning that at least one object is depending on this reference.
 boolean dispose(boolean cache, Dictionary referer)
          Disposes this classes resources if an only if no other PObject is also using this oject.
 PColorSpace getColorSpace(java.lang.Object o)
           
 ExtGState getExtGState(java.lang.String namedReference)
          Returns the ExtGState object which has the specified reference name.
 Font getFont(java.lang.String s)
           
 Form getForm(java.lang.String nameReference)
          Gets the Form XObject specified by the named reference.
 java.awt.Image getImage(java.lang.String s, java.awt.Color fill)
           
 Pattern getPattern(java.lang.String name)
          Retrieves a Pattern object given the named resource.
 ShadingPattern getShading(java.lang.String name)
          Gets the shadding pattern based on a shading dictionary name, similar to getPattern but is only called for the 'sh' token.
 boolean isForm(java.lang.String s)
           
 void removeReference(java.lang.Object referer)
           
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, getPObjectReference, init, isDeleted, isNew, setDeleted, setNew, setPObjectReference, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Resources

public Resources(Library l,
                 java.util.Hashtable h)
Parameters:
l -
h -
Method Detail

addReference

public void addReference(java.lang.Object referer)
Increments the refernce count, meaning that at least one object is depending on this reference.

Parameters:
referer - object doing the reference, used for debug purposes.

removeReference

public void removeReference(java.lang.Object referer)

dispose

public boolean dispose(boolean cache,
                       Dictionary referer)
Disposes this classes resources if an only if no other PObject is also using this oject. If no other PObject references this instance then we can dispose of image, stream and xform objects.

Parameters:
cache - true to cache image streams, false otherwise.
referer - only used for debuggin, can be null otherwise.

getColorSpace

public PColorSpace getColorSpace(java.lang.Object o)
Parameters:
o -
Returns:

getFont

public Font getFont(java.lang.String s)
Parameters:
s -
Returns:

getImage

public java.awt.Image getImage(java.lang.String s,
                               java.awt.Color fill)
Parameters:
s -
fill -
Returns:

isForm

public boolean isForm(java.lang.String s)
Parameters:
s -
Returns:

getForm

public Form getForm(java.lang.String nameReference)
Gets the Form XObject specified by the named reference.

Parameters:
nameReference - name of resourse to retreive.
Returns:
if the named reference is found return it, otherwise return null;

getPattern

public Pattern getPattern(java.lang.String name)
Retrieves a Pattern object given the named resource. This can be call for a fill, text fill or do image mask.

Parameters:
name - of object to find.
Returns:
tiling or shading type pattern object. If not constructor is found, then null is returned.

getShading

public ShadingPattern getShading(java.lang.String name)
Gets the shadding pattern based on a shading dictionary name, similar to getPattern but is only called for the 'sh' token.

Parameters:
name - name of shading dictionary
Returns:
associated shading pattern if any.

getExtGState

public ExtGState getExtGState(java.lang.String namedReference)
Returns the ExtGState object which has the specified reference name.

Parameters:
namedReference - name of ExtGState object to try and find.
Returns:
ExtGState which contains the named references ExtGState attrbutes, if the namedReference could not be found null is returned.