PTGState
@interface PTGState : NSObject
GState is a class that keeps track of a number of style attributes used to visually define graphical Elements. Each PDF::Element has an associated GState that can be used to query or set various graphics properties.
Note
current clipping path is not tracked in the graphics state for efficiency reasons. In most cases tracking of the current clipping path is best left to the client.-
Note
If you are looking for a matrix that maps coordinates to the initial user space see Element::GetCTM().Return Value
the transformation matrix for this element.
-
Declaration
Objective-C
- (PTColorSpace *)GetStrokeColorSpace;
Swift
func getStrokeColorSpace() -> PTColorSpace!
Return Value
color space used for stroking
-
Declaration
Objective-C
- (PTColorSpace *)GetFillColorSpace;
Swift
func getFillColorSpace() -> PTColorSpace!
Return Value
color space used for filling
-
Declaration
Objective-C
- (PTPatternColor *)GetStrokePattern;
Swift
func getStrokePattern() -> PTPatternColor!
Return Value
the SDF pattern object of currently selected PatternColorSpace used for stroking.
-
Declaration
Objective-C
- (PTPatternColor *)GetFillPattern;
Swift
func getFillPattern() -> PTPatternColor!
Return Value
the pattern color of currently selected pattern color space used for filling.
-
Flatness is a number in the range 0 to 100; a value of 0 specifies the output device’s default flatness tolerance.
The flatness tolerance controls the maximum permitted distance in device pixels between the mathematically correct path and an approximation constructed from straight line segments.
Declaration
Objective-C
- (double)GetFlatness;
Swift
func getFlatness() -> Double
Return Value
current value of flatness tolerance
-
The line join style specifies the shape to be used at the corners of paths that are stroked.
Return Value
currently selected LineJoin style
-
Note
A line width of 0 denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide.Declaration
Objective-C
- (double)GetLineWidth;
Swift
func getLineWidth() -> Double
Return Value
the thickness of the line used to stroke a 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.
Declaration
Objective-C
- (double)GetMiterLimit;
Swift
func getMiterLimit() -> Double
Return Value
current value of miter limit.
-
The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The dash array’s elements are numbers that specify the lengths of alternating dashes and gaps; the dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the dash array and the dash phase are expressed in user space units.
Declaration
Objective-C
- (NSMutableArray *)GetDashes;
Swift
func getDashes() -> NSMutableArray!
Return Value
The method fills the vector with an array of numbers representing the dash pattern
-
Declaration
Objective-C
- (double)GetPhase;
Swift
func getPhase() -> Double
Return Value
the phase of the currently selected dash pattern. dash phase is expressed in user space units.
-
The character spacing parameter is a number specified in unscaled text space units. When the glyph for each character in the string is rendered, the character spacing is added to the horizontal or vertical component of the glyph’s displacement, depending on the writing mode. See Section 5.2.1 in PDF Reference Manual for details.
Declaration
Objective-C
- (double)GetCharSpacing;
Swift
func getCharSpacing() -> Double
Return Value
currently selected character spacing.
-
Word spacing works the same way as character spacing, but applies only to the space character (char code 32). See Section 5.2.2 in PDF Reference Manual for details.
Declaration
Objective-C
- (double)GetWordSpacing;
Swift
func getWordSpacing() -> Double
Return Value
currently selected word spacing
-
The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction. Its value is specified as a percentage of the normal width of the glyphs, with 100 being the normal width. The scaling always applies to the horizontal coordinate in text space, independently of the writing mode. See Section 5.2.3 in PDF Reference Manual for details.
Declaration
Objective-C
- (double)GetHorizontalScale;
Swift
func getHorizontalScale() -> Double
Return Value
currently selected horizontal scale
-
The leading parameter is measured in unscaled text space units. It specifies the vertical distance between the baselines of adjacent lines of text. See Section 5.2.4 in PDF Reference Manual for details.
Declaration
Objective-C
- (double)GetLeading;
Swift
func getLeading() -> Double
Return Value
currently selected leading parameter
-
Declaration
Objective-C
- (double)GetFontSize;
Swift
func getFontSize() -> Double
Return Value
the font size
-
The text rendering mode determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. See Section 5.2.5 in PDF Reference Manual for details..
Declaration
Objective-C
- (PTTextRenderingMode)GetTextRenderMode;
Swift
func getTextRenderMode() -> PTTextRenderingMode
Return Value
current text rendering mode.
-
Text rise specifies the distance, in unscaled text space units, to move the baseline up or down from its default location. Positive values of text rise move the baseline up
Declaration
Objective-C
- (double)GetTextRise;
Swift
func getTextRise() -> Double
Return Value
current value of text rise
-
Declaration
Objective-C
- (BOOL)IsTextKnockout;
Swift
func isTextKnockout() -> Bool
Return Value
a boolean flag that determines the text element is considered elementary objects for purposes of color compositing in the transparent imaging model.
-
Declaration
Objective-C
- (PTRenderingIntent)GetRenderingIntent;
Swift
func getRenderingIntent() -> PTRenderingIntent
Return Value
The color intent to be used for rendering the Element
-
A utility function that maps a string representing a rendering intent to RenderingIntent type.
Declaration
Objective-C
+ (PTRenderingIntent)GetRenderingIntentType:(NSString *)name;
Swift
class func getRenderingIntentType(_ name: String!) -> PTRenderingIntent
Parameters
name
string that represents the rendering intent to get.
Return Value
The color rendering intent type matching the specified string
-
Return Value
the current blend mode to be used in the transparent imaging model. Corresponds to the /BM key within the ExtGState’s dictionary.
-
Declaration
Objective-C
- (double)GetFillOpacity;
Swift
func getFillOpacity() -> Double
Return Value
the opacity value for painting operations other than stroking. Returns the value of the /ca key in the ExtGState dictionary. If the value is not found, the default value of 1 is returned.
-
Declaration
Objective-C
- (double)GetStrokeOpacity;
Swift
func getStrokeOpacity() -> Double
Return Value
opacity value for stroke painting operations for paths and glyph outlines. Returns the value of the /CA key in the ExtGState dictionary. If the value is not found, the default value of 1 is returned.
-
Declaration
Objective-C
- (BOOL)GetAISFlag;
Swift
func getAISFlag() -> Bool
Return Value
the alpha source flag (‘alpha is shape’), specifying whether the current soft mask and alpha constant are to be interpreted as shape values (true) or opacity values (false).
-
Declaration
Objective-C
- (PTMatrix2D *)GetSoftMaskTransform;
Swift
func getSoftMaskTransform() -> PTMatrix2D!
Return Value
The soft mask transform. This is the transformation matrix at the moment the soft mask is established in the graphics state with the gs operator. This information is only relevant when applying the soft mask that may be specified in the graphics state to the current element.
-
Declaration
Objective-C
- (BOOL)GetStrokeOverprint;
Swift
func getStrokeOverprint() -> Bool
Return Value
whether overprint is enabled for stroke painting operations. Corresponds to the /OP key within the ExtGState’s dictionary.
-
Declaration
Objective-C
- (BOOL)GetFillOverprint;
Swift
func getFillOverprint() -> Bool
Return Value
whether overprint is enabled for fill painting operations. Corresponds to the /op key within the ExtGState’s dictionary.
-
Declaration
Objective-C
- (int)GetOverprintMode;
Swift
func getOverprintMode() -> Int32
Return Value
the overprint mode used by this graphics state. Corresponds to the /OPM key within the ExtGState’s dictionary.
-
Declaration
Objective-C
- (BOOL)GetAutoStrokeAdjust;
Swift
func getAutoStrokeAdjust() -> Bool
Return Value
a flag specifying whether stroke adjustment is enabled in the graphics state. Corresponds to the /SA key within the ExtGState’s dictionary.
-
Declaration
Objective-C
- (double)GetSmoothnessTolerance;
Swift
func getSmoothnessTolerance() -> Double
Return Value
the smoothness tolerance used to control the quality of smooth shading. Corresponds to the /SM key within the ExtGState’s dictionary. The allowable error (or tolerance) is expressed as a fraction of the range of the color component, from 0.0 to 1.0.
-
Return Value
currently selected transfer function (NULL by default) used during color conversion process. A transfer function adjusts the values of color components to compensate for nonlinear response in an output device and in the human eye. Corresponds to the /TR key within the ExtGState’s dictionary.
-
Return Value
currently selected halftone dictionary or stream (NULL by default). Corresponds to the /HT key within the ExtGState’s dictionary. Halftoning is a process by which continuous-tone colors are approximated on an output device that can achieve only a limited number of discrete colors.
-
Set the transformation matrix associated with this element.
Note
in PDF associating a transformation matrix with an element (‘cm’ operator) will also affect all subsequent elements.
Declaration
Objective-C
- (void)SetTransformWithMatrix:(PTMatrix2D *)mtx;
Swift
func setTransformWith(_ mtx: PTMatrix2D!)
Parameters
mtx
The new transformation for this text element.
-
Set the transformation matrix associated with this element.
A transformation matrix in PDF is specified by six numbers, usually in the form of an array containing six elements. In its most general form, this array is denoted [a b c d h v]; it can represent any linear transformation from one coordinate system to another. For more information about PDF matrices please refer to section 4.2.2 ‘Common Transformations’ in PDF Reference Manual, and to documentation for pdftron::Common::Matrix2D class.
Declaration
Objective-C
- (void)SetTransform:(double)a b:(double)b c:(double)c d:(double)d h:(double)h v:(double)v;
Swift
func setTransform(_ a: Double, b: Double, c: Double, d: Double, h: Double, v: Double)
Parameters
a
- horizontal ‘scaling’ component of the new text matrix.
b
- ‘rotation’ component of the new text matrix.
c
- ‘rotation’ component of the new text matrix.
d
- vertical ‘scaling’ component of the new text matrix.
h
- horizontal translation component of the new text matrix.
v
- vertical translation component of the new text matrix.
-
Concatenate the given matrix to the transformation matrix of this element.
Declaration
Objective-C
- (void)ConcatWithMatrix:(PTMatrix2D *)mtx;
Swift
func concat(with mtx: PTMatrix2D!)
Parameters
mtx
Matrix2D object to concatenate the current matrix with.
-
Concatenate the given matrix expressed in its values to the transformation matrix of this element.
Declaration
Objective-C
- (void)Concat:(double)a b:(double)b c:(double)c d:(double)d h:(double)h v:(double)v;
Swift
func concat(_ a: Double, b: Double, c: Double, d: Double, h: Double, v: Double)
Parameters
a
- horizontal ‘scaling’ component of the new text matrix.
b
- ‘rotation’ component of the new text matrix.
c
- ‘rotation’ component of the new text matrix.
d
- vertical ‘scaling’ component of the new text matrix.
h
- horizontal translation component of the new text matrix.
v
- vertical translation component of the new text matrix.
-
Sets the color space used for stroking operations
Declaration
Objective-C
- (void)SetStrokeColorSpace:(PTColorSpace *)cs;
Swift
func setStroke(_ cs: PTColorSpace!)
Parameters
cs
ColorSpace object to use for stroking operations
-
Sets the color space used for filling operations
Declaration
Objective-C
- (void)SetFillColorSpace:(PTColorSpace *)cs;
Swift
func setFill(_ cs: PTColorSpace!)
Parameters
cs
ColorSpace object to use for filling operations
-
Sets the color value/point used for stroking operations.
Note
The color value must be represented in the currently selected color space used for stroking.Declaration
Objective-C
- (void)SetStrokeColorWithColorPt:(PTColorPt *)c;
Swift
func setStrokeColor(with c: PTColorPt!)
Parameters
c
is the color used for stroking operations
-
Set the stroke color to the given tiling pattern.
Note
The currently selected stroke color space must be Pattern color space.Declaration
Objective-C
- (void)SetStrokeColorWithPattern:(PTPatternColor *)pattern;
Swift
func setStrokeColor(withPattern pattern: PTPatternColor!)
Parameters
pattern
SDF pattern object.
-
Set the stroke color to the given uncolored tiling pattern.
Note
The currently selected stroke color space must be Pattern color space.Declaration
Objective-C
- (void)SetStrokeColorWithPatternAndColorPt:(PTPatternColor *)pattern c:(PTColorPt *)c;
Swift
func setStrokeColor(withPatternAndColorPt pattern: PTPatternColor!, c: PTColorPt!)
Parameters
pattern
pattern (PatternType = 1 and PaintType = 2) object.
c
is a color in the pattern’s underlying color space.
-
Sets the color value/point used for filling operations.
Declaration
Objective-C
- (void)SetFillColorWithColorPt:(PTColorPt *)c;
Swift
func setFillColor(with c: PTColorPt!)
Parameters
c
the color used for filling operations The color value must be represented in the currently selected color space used for filling.
-
Set the fill color to the given tiling pattern.
Note
The currently selected fill color space must be Pattern color space.Declaration
Objective-C
- (void)SetFillColorWithPattern:(PTPatternColor *)pattern;
Swift
func setFillColor(withPattern pattern: PTPatternColor!)
Parameters
pattern
New pattern color.
-
Set the fill color to the given uncolored tiling pattern.
Note
The currently selected fill color space must be Pattern color space.Declaration
Objective-C
- (void)SetFillColorWithPatternAndColorPt:(PTPatternColor *)pattern c:(PTColorPt *)c;
Swift
func setFillColor(withPatternAndColorPt pattern: PTPatternColor!, c: PTColorPt!)
Parameters
pattern
PatternColor (PatternType = 1 and PaintType = 2) object.
c
is a color in the pattern’s underlying color space.
-
Sets the value of flatness tolerance.
The flatness tolerance controls the maximum permitted distance in device pixels between the mathematically correct path and an approximation constructed from straight line segments.
Declaration
Objective-C
- (void)SetFlatness:(double)flatness;
Swift
func setFlatness(_ flatness: Double)
Parameters
flatness
is a number in the range 0 to 100; a value of 0 specifies the output device’s default flatness tolerance.
-
Sets LineJoin style property.
The line join style specifies the shape to be used at the corners of paths that are stroked.
Declaration
Objective-C
- (void)SetLineJoin:(PTLineJoin)join;
Swift
func setLineJoin(_ join: PTLineJoin)
-
Sets the thickness of the line used to stroke a path.
Declaration
Objective-C
- (void)SetLineWidth:(double)width;
Swift
func setLineWidth(_ width: Double)
Parameters
width
a non-negative number expressed in user space units. A line width of 0 denotes the thinnest line that can be rendered at device resolution: 1 device pixel wide.
-
Sets miter limit.
Declaration
Objective-C
- (void)SetMiterLimit:(double)miter_limit;
Swift
func setMiterLimit(_ miter_limit: Double)
Parameters
miter_limit
A number that 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.
-
Sets the dash pattern used to stroke paths. The line dash pattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash array and a dash phase. The elements of both the dash array and the dash phase are expressed in user space units.
Declaration
Objective-C
- (void)SetDashPattern:(NSMutableArray *)dash_array phase:(double)phase;
Swift
func setDashPattern(_ dash_array: NSMutableArray!, phase: Double)
Parameters
dash_array
the numbers that specify the lengths of alternating dashes and gaps.
phase
specifies the distance into the dash pattern at which to start the dash.
-
Sets character spacing.
Declaration
Objective-C
- (void)SetCharSpacing:(double)char_spacing;
Swift
func setCharSpacing(_ char_spacing: Double)
Parameters
char_spacing
a number specified in unscaled text space units. When the glyph for each character in the string is rendered, the character spacing is added to the horizontal or vertical component of the glyph’s displacement, depending on the writing mode. See Section 5.2.1 in PDF Reference Manual for details.
-
Sets word spacing.
Declaration
Objective-C
- (void)SetWordSpacing:(double)word_spacing;
Swift
func setWordSpacing(_ word_spacing: Double)
Parameters
word_spacing
- a number specified in unscaled text space units. Word spacing works the same way as character spacing, but applies only to the space character (char code 32). See Section 5.2.2 in PDF Reference Manual for details.
-
Sets horizontal scale. The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction. Its value is specified as a percentage of the normal width of the glyphs, with 100 being the normal width. The scaling always applies to the horizontal coordinate in text space, independently of the writing mode. See Section 5.2.3 in PDF Reference Manual for details.
Declaration
Objective-C
- (void)SetHorizontalScale:(double)hscale;
Swift
func setHorizontalScale(_ hscale: Double)
Parameters
hscale
value to set horizontal scale to.
-
Sets the leading parameter.
The leading parameter is measured in unscaled text space units. It specifies the vertical distance between the baselines of adjacent lines of text. See Section 5.2.4 in PDF Reference Manual for details.
Declaration
Objective-C
- (void)SetLeading:(double)leading;
Swift
func setLeading(_ leading: Double)
Parameters
leading
number representing vertical distance between lines of text
-
Sets text rendering mode. The text rendering mode determines whether showing text causes glyph outlines to be stroked, filled, used as a clipping boundary, or some combination of the three. See Section 5.2.5 in PDF Reference Manual for details..
Declaration
Objective-C
- (void)SetTextRenderMode:(PTTextRenderingMode)rmode;
Swift
func setTextRenderMode(_ rmode: PTTextRenderingMode)
-
Sets text rise. Text rise specifies the distance, in unscaled text space units, to move the baseline up or down from its default location. Positive values of text rise move the baseline up
Declaration
Objective-C
- (void)SetTextRise:(double)rise;
Swift
func setTextRise(_ rise: Double)
Parameters
rise
distance to move baseline up. Negative values move baseline down.
-
Mark the object as elementary for purposes of color compositing in the transparent imaging model.
Declaration
Objective-C
- (void)SetTextKnockout:(BOOL)knockout;
Swift
func setTextKnockout(_ knockout: Bool)
Parameters
knockout
Whether an object is elementary or not.
-
Sets the color intent to be used for rendering the Element.
Declaration
Objective-C
- (void)SetRenderingIntent:(PTRenderingIntent)intent;
Swift
func setRenderingIntent(_ intent: PTRenderingIntent)
-
Sets the current blend mode to be used in the transparent imaging model. Corresponds to the /BM key within the ExtGState’s dictionary.
// C# gs.SetBlendMode(GState.BlendMode.e_lighten); // C++ gs->SetBlendMode(GState::e_lighten);
Declaration
Objective-C
- (void)SetBlendMode:(PTBlendMode)BM;
Swift
func setBlendMode(_ BM: PTBlendMode)
Parameters
BM
- New blending mode type.
-
Sets the opacity value for painting operations other than stroking. Corresponds to the value of the /ca key in the ExtGState dictionary.
Declaration
Objective-C
- (void)SetFillOpacity:(double)ca;
Swift
func setFillOpacity(_ ca: Double)
Parameters
ca
value to set fill opacity to
-
Sets opacity value for stroke painting operations for paths and glyph outlines. Corresponds to the value of the /CA key in the ExtGState dictionary.
Declaration
Objective-C
- (void)SetStrokeOpacity:(double)ca;
Swift
func setStrokeOpacity(_ ca: Double)
Parameters
ca
value to set stroke opacity to
-
Specifies if the alpha is to be interpreted as a shape or opacity mask. The alpha source flag (‘alpha is shape’), specifies whether the current soft mask and alpha constant are to be interpreted as shape values (true) or opacity values (false).
Declaration
Objective-C
- (void)SetAISFlag:(BOOL)AIS;
Swift
func setAISFlag(_ AIS: Bool)
Parameters
AIS
true for interpretation as shape values or false for opacity values
-
Specifies if overprint is enabled for stroke operations. Corresponds to the /OP key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetStrokeOverprint:(BOOL)OP;
Swift
func setStrokeOverprint(_ OP: Bool)
Parameters
OP
true to enable overprint for stroke, false to disable.
-
Specifies if overprint is enabled for fill operations. Corresponds to the /op key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetFillOverprint:(BOOL)op;
Swift
func setFillOverprint(_ op: Bool)
Parameters
op
true to enable overprint for fill, false to disable.
-
Sets the overprint mode. Corresponds to the /OPM key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetOverprintMode:(int)OPM;
Swift
func setOverprintMode(_ OPM: Int32)
Parameters
OPM
overprint mode.
-
Specify whether to apply automatic stroke adjustment. Corresponds to the /SA key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetAutoStrokeAdjust:(BOOL)SA;
Swift
func setAutoStrokeAdjust(_ SA: Bool)
Parameters
SA
if true automatic stroke adjustment will be applied.
-
Sets the smoothness tolerance used to control the quality of smooth shading. Corresponds to the /SM key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetSmoothnessTolerance:(double)SM;
Swift
func setSmoothnessTolerance(_ SM: Double)
-
Sets black-generation function used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /BG key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetBlackGenFunct:(PTObj *)BG;
Swift
func setBlackGenFunct(_ BG: PTObj!)
Parameters
BG
- SDF/Cos black-generation function or name
-
Sets undercolor-removal function used during conversion between DeviceRGB and DeviceCMYK. Corresponds to the /UCR key within the ExtGState’s dictionary.
Parameters
UCR
- SDF/Cos undercolor-removal function or name
-
Sets transfer function used during color conversion process. A transfer function adjusts the values of color components to compensate for nonlinear response in an output device and in the human eye. Corresponds to the /TR key within the ExtGState’s dictionary.
Declaration
Objective-C
- (void)SetTransferFunct:(PTObj *)TR;
Swift
func setTransferFunct(_ TR: PTObj!)
Parameters
TR
- SDF/Cos transfer function, array, or name
-
Sets currently selected halftone dictionary or stream (NULL by default). Corresponds to the /HT key within the ExtGState’s dictionary. Halftoning is a process by which continuous-tone colors are approximated on an output device that can achieve only a limited number of discrete colors.
Parameters
HT
- SDF/Cos halftone dictionary, stream, or name
-
Undocumented
Declaration
Objective-C
- (instancetype)init;
Swift
init!()