Foxit PDF SDK
foxit::common::GraphState Class Reference

Inherits Object.

Public Types

enum  LineCapStyle { e_LineCapButt = 0, e_LineCapRound = 1, e_LineCapSquare = 2 }
 Enumeration for line cap style. More...
 
enum  LineJoinStyle { e_LineJoinMiter = 0, e_LineJoinRound = 1, e_LineJoinBevel = 2 }
 Enumeration for line join style. More...
 

Public Member Functions

 GraphState (float line_width, LineJoinStyle line_join, float miter_limit, LineCapStyle line_cap, float dash_phase, const FloatArray &dashes)
 Constructor, with parameters. More...
 
 GraphState ()
 Constructor.
 
 GraphState (const GraphState &state)
 Constructor, with another graph state object. More...
 
 ~GraphState ()
 Destructor.
 
GraphStateoperator= (const GraphState &state)
 Assign operator. More...
 
void Set (float line_width, LineJoinStyle line_join, float miter_limit, LineCapStyle line_cap, float dash_phase, const FloatArray &dashes)
 Set value. More...
 

Public Attributes

float dash_phase
 Dash phase for dash pattern.
 
FloatArray dashes
 A dash array that represents the dash patterns. Value of each element in this array should not be negative.
 
LineCapStyle line_cap
 Line cap style. More...
 
LineJoinStyle line_join
 Line join style. More...
 
float line_width
 Line width. More...
 
float miter_limit
 The miter limit for line join. More...
 

Detailed Description

This class represents PDF graph states.

Member Enumeration Documentation

◆ LineCapStyle

Enumeration for line cap style.

Values of this enumeration should be used alone. The line cap style specifies the shape to be used at the ends of open sub paths (and dashes, if any) when they are stroked.

Enumerator
e_LineCapButt 

Butt cap. The stroke is squared off at the endpoint of a path. There is no projection beyond the end of a path.

e_LineCapRound 

Round cap. A semicircular arc with a diameter equal to the line width is drawn around the endpoint and filled in.

e_LineCapSquare 

Projecting square cap. The stroke continues beyond the endpoint of the path for a distance equal to half the line width and is squared off.

◆ LineJoinStyle

Enumeration for line join style.

Values of this enumeration should be used alone. The line join style specifies the shape to be used at the corners of paths that are stroked.

Enumerator
e_LineJoinMiter 

Miter line join type.

The outer edges of the strokes for the two segments are extended until they meet at an angle.

e_LineJoinRound 

Round line join type.

An arc of a circle with a diameter equal to the line width is drawn around the point where the two segments meet, connecting the outer edges of the strokes for the two segments.

e_LineJoinBevel 

Bevel line join type.

The two segments are finished with butt caps and the resulting notch beyond the end of the segments is filled with a triangle.

Constructor & Destructor Documentation

◆ GraphState() [1/2]

foxit::common::GraphState::GraphState ( float  line_width,
LineJoinStyle  line_join,
float  miter_limit,
LineCapStyle  line_cap,
float  dash_phase,
const FloatArray dashes 
)
inline

Constructor, with parameters.

Parameters
[in]line_widthLine width. If 0 is set to this, it will be treated as 1 by default.
[in]line_joinLine join style. Please refer to values starting from GraphState::e_LineJoinMiter and this should be one of these values.
[in]miter_limitThe miter limit for line join.
[in]line_capLine cap style. Please refer to values starting from GraphState::e_LineCapButt and this should be one of these values.
[in]dash_phaseDash phase for line dash pattern.
[in]dashesA dash array that represents the dash patterns. The value of each element in this array should not be negative.

◆ GraphState() [2/2]

foxit::common::GraphState::GraphState ( const GraphState state)
inline

Constructor, with another graph state object.

Parameters
[in]stateAnother graph state object.

Member Function Documentation

◆ operator=()

GraphState& foxit::common::GraphState::operator= ( const GraphState state)
inline

Assign operator.

Parameters
[in]stateAnother graph state object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ Set()

void foxit::common::GraphState::Set ( float  line_width,
LineJoinStyle  line_join,
float  miter_limit,
LineCapStyle  line_cap,
float  dash_phase,
const FloatArray dashes 
)
inline

Set value.

Parameters
[in]line_widthLine width. If 0 is set to this, it will be treated as 1 by default.
[in]line_joinLine join style. Please refer to values starting from GraphState::e_LineJoinMiter and this should be one of these values.
[in]miter_limitThe miter limit for line join.
[in]line_capLine cap style. Please refer to values starting from GraphState::e_LineCapButt and this should be one of these values.
[in]dash_phaseDash phase for line dash pattern.
[in]dashesA dash array that represents the dash patterns. The value of each element in this array should not be negative.
Returns
None.

Member Data Documentation

◆ line_cap

LineCapStyle foxit::common::GraphState::line_cap

Line cap style.

The line cap style specifies the shape to be used at the ends of open sub-paths (and dashes, if any) when they are stroked. Please refer to values starting from GraphState::e_LineCapButt and this should be one of these values.

◆ line_join

LineJoinStyle foxit::common::GraphState::line_join

Line join style.

The line join style specifies the shape to be used at the corners of paths that are stroked. Please refer to values starting from GraphState::e_LineJoinMiter and this should be one of these values.

◆ line_width

float foxit::common::GraphState::line_width

Line width.

It should be a non-negative number in PDF coordinate system. If 0 is set to this, it will be treated as 1 by default.

◆ miter_limit

float foxit::common::GraphState::miter_limit

The miter limit for line join.

When two line segments meet at a sharp angle and mitered joins have been specified as the line join style, it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miter limit imposes a maximum on the ratio of the miter length to the line width. When the limit is exceeded, the join is converted from a miter to a bevel.
Please refer to <PDF Reference 1.7> P217 "Miter Limit" for more details.