org.icepdf.core.util.content
Class AbstractContentParser

java.lang.Object
  extended by org.icepdf.core.util.content.AbstractContentParser
All Implemented Interfaces:
ContentParser
Direct Known Subclasses:
OContentParser

public abstract class AbstractContentParser
extends java.lang.Object
implements ContentParser

AbstractContentParser contains all base operand implementations for the Post Script operand set.

Since:
5.0

Field Summary
protected  java.awt.geom.GeneralPath geometricPath
           
protected  float glyph2UserSpaceScale
           
protected  GraphicsState graphicState
           
protected  boolean inTextBlock
           
protected  Library library
           
protected  java.util.LinkedList<OptionalContents> oCGs
           
static float OVERPAINT_ALPHA
           
protected  Resources resources
           
protected  Shapes shapes
           
protected  java.util.Stack<java.lang.Object> stack
           
protected  java.awt.geom.AffineTransform textBlockBase
           
 
Constructor Summary
AbstractContentParser(Library l, Resources r)
           
 
Method Summary
protected static java.awt.geom.AffineTransform applyTextScaling(GraphicsState graphicState)
          Text scaling must be applied to the main graphic state.
protected static void commonFill(Shapes shapes, GraphicsState graphicState, java.awt.geom.GeneralPath geometricPath)
          Common fill operations used by f, F, F*, b, b*, B, B*.
protected static float commonOverPrintAlpha(float alpha)
          Utility method for fudging overprinting calculation for screen representation.
protected static void commonStroke(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
          Common stroke operations used by S and s.
protected static java.awt.geom.GeneralPath consume_b_star(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_B_star(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_b(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_B(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_BDC(java.util.Stack stack, Shapes shapes, java.util.LinkedList<OptionalContents> oCGs, Resources resources)
           
protected static void consume_BMC(java.util.Stack stack, Shapes shapes, java.util.LinkedList<OptionalContents> oCGs, Resources resources)
           
protected static java.awt.geom.GeneralPath consume_c(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_cm(GraphicsState graphicState, java.util.Stack stack, boolean inTextBlock, java.awt.geom.AffineTransform textBlockBase)
           
protected static void consume_cs(GraphicsState graphicState, java.util.Stack stack, Resources resources)
           
protected static void consume_CS(GraphicsState graphicState, java.util.Stack stack, Resources resources)
           
protected static void consume_d(GraphicsState graphicState, java.util.Stack stack, Shapes shapes)
           
protected static GraphicsState consume_d0(GraphicsState graphicState, java.util.Stack stack)
           
protected static GraphicsState consume_d1(GraphicsState graphicState, java.util.Stack stack)
           
protected static GraphicsState consume_Do(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, Resources resources, boolean viewParse)
          Process the xObject content.
protected static void consume_double_quote(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, TextMetrics textMetrics, GlyphOutlineClip glyphOutlineClip, java.util.LinkedList<OptionalContents> oCGs)
           
static void consume_DP(java.util.Stack stack)
           
protected static void consume_EMC(Shapes shapes, java.util.LinkedList<OptionalContents> oCGs)
           
protected static java.awt.geom.GeneralPath consume_f_star(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_f(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_F(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_g(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static void consume_G(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static void consume_gs(GraphicsState graphicState, java.util.Stack stack, Resources resources)
           
protected static void consume_h(java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_i(java.util.Stack stack)
           
protected static void consume_j(GraphicsState graphicState, java.util.Stack stack, Shapes shapes)
           
protected static void consume_J(GraphicsState graphicState, java.util.Stack stack, Shapes shapes)
           
protected static void consume_k(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static void consume_K(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static java.awt.geom.GeneralPath consume_L(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_M(GraphicsState graphicState, java.util.Stack stack, Shapes shapes)
           
protected static java.awt.geom.GeneralPath consume_m(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
static void consume_MP(java.util.Stack stack)
           
protected static java.awt.geom.GeneralPath consume_n(java.awt.geom.GeneralPath geometricPath)
           
protected static GraphicsState consume_q(GraphicsState graphicState)
           
protected  GraphicsState consume_Q(GraphicsState graphicState, Shapes shapes)
           
protected static java.awt.geom.GeneralPath consume_re(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_rg(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static void consume_RG(GraphicsState graphicState, java.util.Stack stack, Library library)
           
protected static void consume_ri(java.util.Stack stack)
           
protected static java.awt.geom.GeneralPath consume_s(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static java.awt.geom.GeneralPath consume_S(GraphicsState graphicState, Shapes shapes, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_sc(GraphicsState graphicState, java.util.Stack stack, Library library, Resources resources, boolean isTint)
           
protected static void consume_SC(GraphicsState graphicState, java.util.Stack stack, Library library, Resources resources, boolean isTint)
           
static void consume_sh(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, Resources resources)
           
protected static void consume_single_quote(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, TextMetrics textMetrics, GlyphOutlineClip glyphOutlineClip, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_T_star(GraphicsState graphicState, TextMetrics textMetrics, PageText pageText, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_Tc(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_Td(GraphicsState graphicState, java.util.Stack stack, TextMetrics textMetrics, PageText pageText, double previousBTStart, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_TD(GraphicsState graphicState, java.util.Stack stack, TextMetrics textMetrics, PageText pageText, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_Tf(GraphicsState graphicState, java.util.Stack stack, Resources resources)
           
protected static void consume_Tj(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, TextMetrics textMetrics, GlyphOutlineClip glyphOutlineClip, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_TJ(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, TextMetrics textMetrics, GlyphOutlineClip glyphOutlineClip, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_TL(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_tm(GraphicsState graphicState, java.util.Stack stack, TextMetrics textMetrics, PageText pageText, double previousBTStart, java.awt.geom.AffineTransform textBlockBase, java.util.LinkedList<OptionalContents> oCGs)
           
protected static void consume_Tr(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_Ts(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_Tw(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_Tz(GraphicsState graphicState, java.util.Stack stack)
           
protected static void consume_v(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
static void consume_W_star(GraphicsState graphicState, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_W(GraphicsState graphicState, java.awt.geom.GeneralPath geometricPath)
           
protected static void consume_w(GraphicsState graphicState, java.util.Stack stack, Shapes shapes, float glyph2UserSpaceScale)
           
protected static void consume_y(java.util.Stack stack, java.awt.geom.GeneralPath geometricPath)
           
protected static void drawModeFill(GraphicsState graphicState, TextSprite textSprites, Shapes shapes, int rmode)
          Utility Method for adding a text sprites to the Shapes stack, given the specified rmode.
protected static void drawModeFillStroke(GraphicsState graphicState, TextSprite textSprites, TextState textState, Shapes shapes, int rmode)
          Utility Method for adding a text sprites to the Shapes stack, given the specifed rmode.
protected static void drawModeStroke(GraphicsState graphicState, TextSprite textSprites, TextState textState, Shapes shapes, int rmode)
          Utility Method for adding a text sprites to the Shapes stack, given the specifed rmode.
protected static void drawString(java.lang.StringBuilder displayText, TextMetrics textMetrics, TextState textState, Shapes shapes, GlyphOutlineClip glyphOutlineClip, GraphicsState graphicState, java.util.LinkedList<OptionalContents> oCGs)
          Utility method for calculating the advanceX need for the displayText given the strings parsed textState.
 GraphicsState getGraphicsState()
          Returns the current graphics state object being used by this content stream.
 Shapes getShapes()
          Returns the Shapes that have accumulated turing multiple calls to parse().
 java.util.Stack<java.lang.Object> getStack()
          Returns the stack of object used to parse content streams.
abstract  ContentParser parse(byte[][] streamBytes)
          Parse a pages content stream.
abstract  Shapes parseTextBlocks(byte[][] source)
          Specialized method for extracting text from documents.
protected static void setAlpha(Shapes shapes, int rule, float alpha)
          Adds a new Alpha Composite object ot the shapes stack.
 void setGlyph2UserSpaceScale(float scale)
          Sets the scale factor used by some graphic state parameters so that the to users space CTM scale factor can be applied.
 void setGraphicsState(GraphicsState graphicState)
          Sets the graphics state object which will be used for the current content parsing.
protected static void setStroke(Shapes shapes, GraphicsState graphicState)
          Sets the state of the BasicStrok with the latest values from the graphicSate instance value: graphicState.lineWidth - line width graphicState.lineCap - line cap type graphicState.lineJoin - line join type graphicState.miterLimit - miter limit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OVERPAINT_ALPHA

public static final float OVERPAINT_ALPHA
See Also:
Constant Field Values

graphicState

protected GraphicsState graphicState

library

protected Library library

resources

protected Resources resources

shapes

protected Shapes shapes

oCGs

protected java.util.LinkedList<OptionalContents> oCGs

geometricPath

protected java.awt.geom.GeneralPath geometricPath

inTextBlock

protected boolean inTextBlock

textBlockBase

protected java.awt.geom.AffineTransform textBlockBase

glyph2UserSpaceScale

protected float glyph2UserSpaceScale

stack

protected java.util.Stack<java.lang.Object> stack
Constructor Detail

AbstractContentParser

public AbstractContentParser(Library l,
                             Resources r)
Parameters:
l - PDF library master object.
r - resources
Method Detail

getShapes

public Shapes getShapes()
Returns the Shapes that have accumulated turing multiple calls to parse().

Specified by:
getShapes in interface ContentParser
Returns:
resultant shapes object of all processed content streams.

getStack

public java.util.Stack<java.lang.Object> getStack()
Returns the stack of object used to parse content streams. If parse was successful the stack should be empty.

Specified by:
getStack in interface ContentParser
Returns:
stack of objects accumulated during a cotent stream parse.

getGraphicsState

public GraphicsState getGraphicsState()
Returns the current graphics state object being used by this content stream.

Specified by:
getGraphicsState in interface ContentParser
Returns:
current graphics context of content stream. May be null if parse method has not been previously called.

setGraphicsState

public void setGraphicsState(GraphicsState graphicState)
Sets the graphics state object which will be used for the current content parsing. This method must be called before the parse method is called otherwise it will not have an effect on the state of the draw operands.

Specified by:
setGraphicsState in interface ContentParser
Parameters:
graphicState - graphics state of this content stream

parse

public abstract ContentParser parse(byte[][] streamBytes)
                             throws java.lang.InterruptedException,
                                    java.io.IOException
Parse a pages content stream.

Specified by:
parse in interface ContentParser
Parameters:
streamBytes - byte stream containing page content
Returns:
a Shapes Object containing all the pages text and images shapes.
Throws:
java.lang.InterruptedException - if current parse thread is interrupted.
java.io.IOException - unexpected end of content stream.

parseTextBlocks

public abstract Shapes parseTextBlocks(byte[][] source)
                                throws java.io.UnsupportedEncodingException
Specialized method for extracting text from documents.

Specified by:
parseTextBlocks in interface ContentParser
Parameters:
source - content stream source.
Returns:
vector where each entry is the text extracted from a text block.
Throws:
java.io.UnsupportedEncodingException - encoding error.

consume_G

protected static void consume_G(GraphicsState graphicState,
                                java.util.Stack stack,
                                Library library)

consume_g

protected static void consume_g(GraphicsState graphicState,
                                java.util.Stack stack,
                                Library library)

consume_RG

protected static void consume_RG(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Library library)

consume_rg

protected static void consume_rg(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Library library)

consume_K

protected static void consume_K(GraphicsState graphicState,
                                java.util.Stack stack,
                                Library library)

consume_k

protected static void consume_k(GraphicsState graphicState,
                                java.util.Stack stack,
                                Library library)

consume_CS

protected static void consume_CS(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Resources resources)

consume_cs

protected static void consume_cs(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Resources resources)

consume_ri

protected static void consume_ri(java.util.Stack stack)

consume_SC

protected static void consume_SC(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Library library,
                                 Resources resources,
                                 boolean isTint)

consume_sc

protected static void consume_sc(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Library library,
                                 Resources resources,
                                 boolean isTint)

consume_q

protected static GraphicsState consume_q(GraphicsState graphicState)

consume_Q

protected GraphicsState consume_Q(GraphicsState graphicState,
                                  Shapes shapes)

consume_cm

protected static void consume_cm(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 boolean inTextBlock,
                                 java.awt.geom.AffineTransform textBlockBase)

consume_i

protected static void consume_i(java.util.Stack stack)

consume_J

protected static void consume_J(GraphicsState graphicState,
                                java.util.Stack stack,
                                Shapes shapes)

consume_Do

protected static GraphicsState consume_Do(GraphicsState graphicState,
                                          java.util.Stack stack,
                                          Shapes shapes,
                                          Resources resources,
                                          boolean viewParse)
Process the xObject content.

Parameters:
graphicState - graphic state to appent
stack - stack of object being parsed.
shapes - shapes object.
resources - associated resources.
viewParse - true indicates parsing is for a normal view. If false the consumption of Do will skip Image based xObjects for performance.

consume_d

protected static void consume_d(GraphicsState graphicState,
                                java.util.Stack stack,
                                Shapes shapes)

consume_j

protected static void consume_j(GraphicsState graphicState,
                                java.util.Stack stack,
                                Shapes shapes)

consume_w

protected static void consume_w(GraphicsState graphicState,
                                java.util.Stack stack,
                                Shapes shapes,
                                float glyph2UserSpaceScale)

consume_M

protected static void consume_M(GraphicsState graphicState,
                                java.util.Stack stack,
                                Shapes shapes)

consume_gs

protected static void consume_gs(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Resources resources)

consume_Tf

protected static void consume_Tf(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Resources resources)

consume_Tc

protected static void consume_Tc(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_tm

protected static void consume_tm(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 TextMetrics textMetrics,
                                 PageText pageText,
                                 double previousBTStart,
                                 java.awt.geom.AffineTransform textBlockBase,
                                 java.util.LinkedList<OptionalContents> oCGs)

consume_T_star

protected static void consume_T_star(GraphicsState graphicState,
                                     TextMetrics textMetrics,
                                     PageText pageText,
                                     java.util.LinkedList<OptionalContents> oCGs)

consume_TD

protected static void consume_TD(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 TextMetrics textMetrics,
                                 PageText pageText,
                                 java.util.LinkedList<OptionalContents> oCGs)

consume_double_quote

protected static void consume_double_quote(GraphicsState graphicState,
                                           java.util.Stack stack,
                                           Shapes shapes,
                                           TextMetrics textMetrics,
                                           GlyphOutlineClip glyphOutlineClip,
                                           java.util.LinkedList<OptionalContents> oCGs)

consume_single_quote

protected static void consume_single_quote(GraphicsState graphicState,
                                           java.util.Stack stack,
                                           Shapes shapes,
                                           TextMetrics textMetrics,
                                           GlyphOutlineClip glyphOutlineClip,
                                           java.util.LinkedList<OptionalContents> oCGs)

consume_Td

protected static void consume_Td(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 TextMetrics textMetrics,
                                 PageText pageText,
                                 double previousBTStart,
                                 java.util.LinkedList<OptionalContents> oCGs)

consume_Tz

protected static void consume_Tz(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_Tw

protected static void consume_Tw(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_Tr

protected static void consume_Tr(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_TL

protected static void consume_TL(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_Ts

protected static void consume_Ts(GraphicsState graphicState,
                                 java.util.Stack stack)

consume_L

protected static java.awt.geom.GeneralPath consume_L(java.util.Stack stack,
                                                     java.awt.geom.GeneralPath geometricPath)

consume_m

protected static java.awt.geom.GeneralPath consume_m(java.util.Stack stack,
                                                     java.awt.geom.GeneralPath geometricPath)

consume_c

protected static java.awt.geom.GeneralPath consume_c(java.util.Stack stack,
                                                     java.awt.geom.GeneralPath geometricPath)

consume_S

protected static java.awt.geom.GeneralPath consume_S(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)

consume_F

protected static java.awt.geom.GeneralPath consume_F(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)
                                              throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_f

protected static java.awt.geom.GeneralPath consume_f(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)
                                              throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_re

protected static java.awt.geom.GeneralPath consume_re(java.util.Stack stack,
                                                      java.awt.geom.GeneralPath geometricPath)

consume_h

protected static void consume_h(java.awt.geom.GeneralPath geometricPath)

consume_BDC

protected static void consume_BDC(java.util.Stack stack,
                                  Shapes shapes,
                                  java.util.LinkedList<OptionalContents> oCGs,
                                  Resources resources)

consume_EMC

protected static void consume_EMC(Shapes shapes,
                                  java.util.LinkedList<OptionalContents> oCGs)

consume_BMC

protected static void consume_BMC(java.util.Stack stack,
                                  Shapes shapes,
                                  java.util.LinkedList<OptionalContents> oCGs,
                                  Resources resources)

consume_f_star

protected static java.awt.geom.GeneralPath consume_f_star(GraphicsState graphicState,
                                                          Shapes shapes,
                                                          java.awt.geom.GeneralPath geometricPath)
                                                   throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_b

protected static java.awt.geom.GeneralPath consume_b(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)
                                              throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_n

protected static java.awt.geom.GeneralPath consume_n(java.awt.geom.GeneralPath geometricPath)
                                              throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_W

protected static void consume_W(GraphicsState graphicState,
                                java.awt.geom.GeneralPath geometricPath)
                         throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_v

protected static void consume_v(java.util.Stack stack,
                                java.awt.geom.GeneralPath geometricPath)

consume_y

protected static void consume_y(java.util.Stack stack,
                                java.awt.geom.GeneralPath geometricPath)

consume_B

protected static java.awt.geom.GeneralPath consume_B(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)
                                              throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_d0

protected static GraphicsState consume_d0(GraphicsState graphicState,
                                          java.util.Stack stack)

consume_s

protected static java.awt.geom.GeneralPath consume_s(GraphicsState graphicState,
                                                     Shapes shapes,
                                                     java.awt.geom.GeneralPath geometricPath)

consume_b_star

protected static java.awt.geom.GeneralPath consume_b_star(GraphicsState graphicState,
                                                          Shapes shapes,
                                                          java.awt.geom.GeneralPath geometricPath)
                                                   throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_d1

protected static GraphicsState consume_d1(GraphicsState graphicState,
                                          java.util.Stack stack)

consume_B_star

protected static java.awt.geom.GeneralPath consume_B_star(GraphicsState graphicState,
                                                          Shapes shapes,
                                                          java.awt.geom.GeneralPath geometricPath)
                                                   throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

consume_W_star

public static void consume_W_star(GraphicsState graphicState,
                                  java.awt.geom.GeneralPath geometricPath)

consume_DP

public static void consume_DP(java.util.Stack stack)

consume_MP

public static void consume_MP(java.util.Stack stack)

consume_sh

public static void consume_sh(GraphicsState graphicState,
                              java.util.Stack stack,
                              Shapes shapes,
                              Resources resources)

consume_TJ

protected static void consume_TJ(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Shapes shapes,
                                 TextMetrics textMetrics,
                                 GlyphOutlineClip glyphOutlineClip,
                                 java.util.LinkedList<OptionalContents> oCGs)

consume_Tj

protected static void consume_Tj(GraphicsState graphicState,
                                 java.util.Stack stack,
                                 Shapes shapes,
                                 TextMetrics textMetrics,
                                 GlyphOutlineClip glyphOutlineClip,
                                 java.util.LinkedList<OptionalContents> oCGs)

drawString

protected static void drawString(java.lang.StringBuilder displayText,
                                 TextMetrics textMetrics,
                                 TextState textState,
                                 Shapes shapes,
                                 GlyphOutlineClip glyphOutlineClip,
                                 GraphicsState graphicState,
                                 java.util.LinkedList<OptionalContents> oCGs)
Utility method for calculating the advanceX need for the displayText given the strings parsed textState. Each of displayText glyphs and respective, text state is added to the shapes collection.

Parameters:
displayText - text that will be drawn to the screen
textMetrics - current advanceX of last drawn string, last advance of where the string should be drawn
textState - formating properties associated with displayText
shapes - collection of all shapes for page content being parsed.

drawModeFill

protected static void drawModeFill(GraphicsState graphicState,
                                   TextSprite textSprites,
                                   Shapes shapes,
                                   int rmode)
Utility Method for adding a text sprites to the Shapes stack, given the specified rmode.

Parameters:
textSprites - text to add to shapes stack
shapes - shapes stack
rmode - write mode

drawModeStroke

protected static void drawModeStroke(GraphicsState graphicState,
                                     TextSprite textSprites,
                                     TextState textState,
                                     Shapes shapes,
                                     int rmode)
Utility Method for adding a text sprites to the Shapes stack, given the specifed rmode.

Parameters:
textSprites - text to add to shapes stack
shapes - shapes stack
textState - text state used to build new stroke
rmode - write mode

drawModeFillStroke

protected static void drawModeFillStroke(GraphicsState graphicState,
                                         TextSprite textSprites,
                                         TextState textState,
                                         Shapes shapes,
                                         int rmode)
Utility Method for adding a text sprites to the Shapes stack, given the specifed rmode.

Parameters:
textSprites - text to add to shapes stack
textState - text state used to build new stroke
shapes - shapes stack
rmode - write mode

commonStroke

protected static void commonStroke(GraphicsState graphicState,
                                   Shapes shapes,
                                   java.awt.geom.GeneralPath geometricPath)
Common stroke operations used by S and s. Takes into account patternColour and regular old fill colour.

Parameters:
shapes - current shapes stack
geometricPath - current path.

commonOverPrintAlpha

protected static float commonOverPrintAlpha(float alpha)
Utility method for fudging overprinting calculation for screen representation.

Parameters:
alpha - alph constant
Returns:
tweaked over printing alpha

commonFill

protected static void commonFill(Shapes shapes,
                                 GraphicsState graphicState,
                                 java.awt.geom.GeneralPath geometricPath)
                          throws java.awt.geom.NoninvertibleTransformException
Common fill operations used by f, F, F*, b, b*, B, B*. Takes into account patternColour and regular old fill colour.

Parameters:
shapes - current shapes stack
graphicState - current graphics state.
geometricPath - current path.
Throws:
java.awt.geom.NoninvertibleTransformException

setStroke

protected static void setStroke(Shapes shapes,
                                GraphicsState graphicState)
Sets the state of the BasicStrok with the latest values from the graphicSate instance value: graphicState.lineWidth - line width graphicState.lineCap - line cap type graphicState.lineJoin - line join type graphicState.miterLimit - miter limit

Parameters:
shapes - current Shapes object for the page being parsed
graphicState - graphic state used to build this stroke instance.

applyTextScaling

protected static java.awt.geom.AffineTransform applyTextScaling(GraphicsState graphicState)
Text scaling must be applied to the main graphic state. It can not be applied to the Text Matrix. We only have two test cases for its use but it appears that the scaling has to bee applied before a text write operand occurs, otherwise a call to Tm seems to break text positioning.

Scalling is special as it can be negative and thus apply a horizontal flip on the graphic state.

Parameters:
graphicState - current graphics state.

setAlpha

protected static void setAlpha(Shapes shapes,
                               int rule,
                               float alpha)
Adds a new Alpha Composite object ot the shapes stack.

Parameters:
shapes - - current shapes vector to add Alpha Composite to
rule - - rule to apply to the alphaComposite.
alpha - - alpha value, opaque = 1.0f.

setGlyph2UserSpaceScale

public void setGlyph2UserSpaceScale(float scale)
Description copied from interface: ContentParser
Sets the scale factor used by some graphic state parameters so that the to users space CTM scale factor can be applied. In particular some Type3 glyphs need to take into account this scaling factor.

Specified by:
setGlyph2UserSpaceScale in interface ContentParser
Parameters:
scale - scale factor to apply to various graphic state parameters.