|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ICSDevice
The abstraction of a device that is manipulated by a PDF content stream
interpreter (ICSInterpreter
) processing a content stream.
The device lifecycle is framed by open/close, issued by the
ICSInterpreter
. The behavior of an ICSDevice
that is not
open is undefined.
Any of the ICSDevice
methods may throw a CSException
. When
the ICSDevice
is used in the context of an ICSInterpreter
,
the exception may be handled by the associated ICSExceptionHandler
,
otherwise you have to be prepared yourself.
Following a list of operator/method relationship. Not all operators may have
a corresponding method.
b | pathCloseFillStrokeNonZero
B | pathFillStrokeNonZero
b* | patcCloseFillStrokeEvenOdd
B* | pathFillStrokeEvenOdd
BDC | markedContentBeginProperties
BI | inlineImageBegin
BMC | markedContentBegin
BT | textBegin
BX | compatibilityBegin
c | penCurveToC
cm | transform
CS | setStrokeColorSpace
cs | setNonStrokeColorSpace
d | setLineDash
d0 | textT3SetGlyphWidth
d1 | textT3SetGlyphWidthBB
Do | doXObject
DP | markedContentPointProperties
EI | inlineImageEnd
EMC | markedContentEnd
ET | textEnd
EX | compatibilityEnd
f | pathFillNonZero
f* | pathFillEvenOdd
G | setStrokeColorGray
g | setNonStrokeColorGray
gs | setExtendedState
h | pathClose
i | setFlatnessTolerance
ID | inlineImageBeginData
j | setLineJoin
J | setLineCap
K | setStrokeColorCMYK
k | setNonStrokeColorCMYK
l | penLineTo
m | penMoveTo
M | setMiterLimit
MP | markedContentPoint
n | pathEnd
q | saveState
Q | restoreState
re | penRectangle
RG | setStrokeColorRGB
rg | setNonStrokeColorRGB
ri | setRenderingIntent
s | pathCloseStroke
S | pathStroke
SC | setStrokeColorValues
sc | setNonStrokeColorValues
SCN | setStrokeColorValuesSpecial
scn | setNonStrokeColorValuesSpecial
sh | paintFill
T* | textLineNew
Tc | textSetCharSpacing
Td | textLineMove
TD | use primitive methods
Tf | textSetFont
Tj | textShow
TJ | textShow & textMove
TL | textSetLeading
Tm | textSetTransform
Tr | textSetRenderingMode
Ts | textSetRise
Tw | textSetWordSpacing
Tz | textSetHorizontalScaling
v | penCurveToV
w | setLineWidth
W | pathClipNonZero
W* | pathClipEvenOdd
y | penCurveToY
' | use primitive methods
" | use primitive methods
Method Summary | |
---|---|
void |
close()
Close the device after use. |
void |
compatibilityBegin()
Begin a compatibility section. |
void |
compatibilityEnd()
End a compatibility section. |
void |
doShading(COSName resourceName,
PDShading shading)
Paint shape and color shading according to shading dictionary. |
void |
doXObject(COSName resourceName,
PDXObject xObject)
Stroke a PDXObject. |
ICSGraphicsState |
getGraphicsState()
The current ICSGraphicsState active. |
ICSInterpreter |
getInterpreter()
The ICSInterpreter associated with this ICSDevice . |
void |
inlineImage(PDImage img)
Stroke an inlined image. |
void |
markedContentBegin(COSName tag)
Begin a marked content sequence. |
void |
markedContentBeginProperties(COSName tag,
COSName resourceName,
COSDictionary properties)
Begin a marked content sequence with a property list. |
void |
markedContentEnd()
End marked content sequence started with "BMC" or "BDC". |
void |
markedContentPoint(COSName tag)
Set a marked point. |
void |
markedContentPointProperties(COSName tag,
COSName resourceName,
COSDictionary properties)
Define a marked content point with a property list. |
void |
open(ICSInterpreter interpreter)
Open the device for use by interpreter . |
void |
pathClipEvenOdd()
Intersect the current clipping path with the current path using the even/odd rule. |
void |
pathClipNonZero()
Intersect the current clipping path with the current path using the nonzero winding rule. |
void |
pathClose()
Close the path and append a line segment from the current coordinate to the starting point of the path. |
void |
pathCloseFillStrokeEvenOdd()
Close, Fill and then stroke the path using the even/odd rule. |
void |
pathCloseFillStrokeNonZero()
Close, Fill and then stroke the path using the non zero winding rule. |
void |
pathCloseStroke()
Close and then stroke the path. |
void |
pathEnd()
End the path without filling or stroking. |
void |
pathFillEvenOdd()
Fill the path using the even/odd rule. |
void |
pathFillNonZero()
Fill the path using the non-zero winding rule. |
void |
pathFillStrokeEvenOdd()
Fill and then stroke the path using the even/odd rule. |
void |
pathFillStrokeNonZero()
Fill and then stroke the path using the non-zero winding rule. |
void |
pathStroke()
Stroke the current path. |
void |
penCurveToC(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Append a cubic bezier curve to the path. |
void |
penCurveToV(float x2,
float y2,
float x3,
float y3)
Append a cubic bezier curve to the path. |
void |
penCurveToY(float x1,
float y1,
float x3,
float y3)
Append a cubic bezier curve to the path. |
void |
penLineTo(float x,
float y)
Add a line from the current point to x , y . |
void |
penMoveTo(float x,
float y)
Move the current point to x , y . |
void |
penRectangle(float x,
float y,
float w,
float h)
Append a complete rectangle to as a subpath. |
void |
restoreState()
Restore the graphics state from the stack. |
void |
saveState()
Save the current graphics state on a stack for later use. |
void |
setExtendedState(COSName resourceName,
PDExtGState gstate)
Set the dictionary as the new graphic state, creating a new PDResources entry if needed. |
void |
setFlatnessTolerance(float flatness)
Set the flatness tolerance. |
void |
setLineCap(int capStyle)
The line cap specifies the shape to be used at the ends of open subpaths. |
void |
setLineDash(float[] pattern,
float phase)
Define the pattern used to stroke paths. |
void |
setLineJoin(int joinStyle)
The line join specifies the shape to be used at the connection points of two adjacent lines in a path. |
void |
setLineWidth(float lineWidth)
Set the thickness of the line used to stroke a path. |
void |
setMiterLimit(float miterLimit)
The maximum ratio of MiterLength/LineWidth when connecting two lines with miter style. |
void |
setNonStrokeColorCMYK(float c,
float m,
float y,
float k)
Set the non stroking color space to /DeviceCMYK and set the color values c , m , y , K . |
void |
setNonStrokeColorGray(float gray)
Set the non stroking color space to /DeviceGray and set the gray level to gray . |
void |
setNonStrokeColorRGB(float r,
float g,
float b)
Set the non stroking color space to /DeviceRGB and set the color values r , g , b . |
void |
setNonStrokeColorSpace(COSName resourceName,
PDColorSpace colorSpace)
Set color space for non-stroking. |
void |
setNonStrokeColorValues(float[] values)
Set the color used for non stroking operations, dependent on the currently selected color spaces. |
void |
setNonStrokeColorValues(float[] values,
COSName resourceName,
PDPattern pattern)
Set the color used for non stroking operations, dependent on the currently selected special color spaces. |
void |
setRenderingIntent(COSName intent)
Set the color rendering intent. |
void |
setStrokeColorCMYK(float c,
float m,
float y,
float k)
Set the stroking color space to /DeviceCMYK and set the color values c , m , y , K . |
void |
setStrokeColorGray(float gray)
Set the stroking color space to /DeviceGray and set the gray level to gray . |
void |
setStrokeColorRGB(float r,
float g,
float b)
Set the stroking color space to /DeviceRGB and set the color values r , g , b . |
void |
setStrokeColorSpace(COSName resourceName,
PDColorSpace colorSpace)
Set color space for stroking. |
void |
setStrokeColorValues(float[] values)
Set the color used for stroking operations, dependent on the currently selected color spaces. |
void |
setStrokeColorValues(float[] values,
COSName resourceName,
PDPattern pattern)
Set the color used for stroking operations, dependent on the currently selected special color spaces. |
void |
textBegin()
Begin text mode. |
void |
textEnd()
End text mode. |
void |
textLineMove(float dx,
float dy)
Move the current lext line by dx , dy . |
void |
textLineNew()
Move the current position to a new line. |
void |
textMove(float dx,
float dy)
Move the current text cursor by dx , dy . |
void |
textMoveTo(float x,
float y)
Move the current text cursor to x , y . |
void |
textSetCharSpacing(float charSpacing)
Set the character spacing. |
void |
textSetFont(COSName resourceName,
PDFont font,
float size)
Set the current font and size. |
void |
textSetHorizontalScaling(float scale)
Set the horizontal scling factor. |
void |
textSetLeading(float leading)
Set the text leading. |
void |
textSetRenderingMode(int renderingMode)
Set the text rendering mode. |
void |
textSetRise(float rise)
Set the text rise. |
void |
textSetTransform(float a,
float b,
float c,
float d,
float e,
float f)
Set the text transformation matrix. |
void |
textSetWordSpacing(float wordSpacing)
Set the word spacing. |
void |
textShow(byte[] text,
int offset,
int length)
Show a sequence of bytes as text. |
void |
textShow(String text)
Show a string value as text, using the current font encoding. |
void |
textT3SetGlyphWidth(float x,
float y)
Set the glyph width for a type 3 font. |
void |
textT3SetGlyphWidthBB(float x,
float y,
float llx,
float lly,
float urx,
float ury)
Set the glyph width and bounding box for a type 3 font. |
void |
transform(float a,
float b,
float c,
float d,
float e,
float f)
Modify the current transformation matrix by concatenating the transformations. |
Method Detail |
---|
void close()
void doShading(COSName resourceName, PDShading shading)
PDF graphics operator "sh"
resourceName
- The logical name of the resource in the PDResources
shading
- The PDShading
to be painted.void doXObject(COSName resourceName, PDXObject xObject)
PDF graphics operator "Do"
resourceName
- The logical name of the resource in the PDResources
xObject
- The PDXObject
to be stroked.void inlineImage(PDImage img)
PDF graphics operators "BI", "ID", "EI"
img
- The inlined image. The image may use some special keys instead
of the standard PDImage
dictionary keys.void markedContentBegin(COSName tag)
PDF graphics operator "BMC"
tag
- The tag indicating the role or significance.void compatibilityBegin()
PDF graphics operator "BX"
void compatibilityEnd()
PDF graphics operator "EX"
void markedContentBeginProperties(COSName tag, COSName resourceName, COSDictionary properties)
PDF graphics operator "BDC"
tag
- The tag indicating the role or significance.resourceName
- The logical name of the resource in the PDResources
properties
- The properties for the marked content sequence.void markedContentEnd()
PDF graphics operator "EMC"
void markedContentPoint(COSName tag)
PDF graphics operator "MP"
tag
- The tag indicating the role or significance.void markedContentPointProperties(COSName tag, COSName resourceName, COSDictionary properties)
PDF graphics operator "DP"
tag
- The tag indicating the role or significance.resourceName
- The logical name of the resource in the PDResources
properties
- The properties for the marked content point.void open(ICSInterpreter interpreter)
interpreter
.
interpreter
- void pathClipEvenOdd()
PDF graphics operator "W*"
void pathClipNonZero()
PDF graphics operator "W"
void pathClose()
PDF graphics operator "h"
void pathCloseFillStrokeEvenOdd()
PDF graphics operator "b*"
void pathCloseFillStrokeNonZero()
PDF graphics operator "b"
void pathCloseStroke()
PDF graphics operator "s"
void pathEnd()
This may for example be used to manipulate the clipping path without a painting operation.
PDF graphics operator "n"
void pathFillEvenOdd()
PDF graphics operator "f*"
void pathFillNonZero()
An open subpath is closed before filling.
PDF graphics operator "f"
void pathFillStrokeEvenOdd()
PDF graphics operator "B*"
void pathFillStrokeNonZero()
PDF graphics operator "B"
void pathStroke()
PDF graphics operator "S"
void penCurveToC(float x1, float y1, float x2, float y2, float x3, float y3)
current
+---------* x1/y1
. _
-.
. *x2/y2
.
.
.
+ x3/y3
PDF graphics operator "c"
x1
- x coordinate of first control pointy1
- y coordinate of first control pointx2
- x coordinate of second control pointy2
- y coordinate of second control pointx3
- x coordinate of endpointy3
- y coordinate of endpointvoid penCurveToV(float x2, float y2, float x3, float y3)
current
+
. _
-.
. *x2/y2
.
.
.
+ x3/y3
PDF graphics operator "v"
x2
- x coordinate of second control pointy2
- y coordinate of second control pointx3
- x coordinate of endpointy3
- y coordinate of endpointvoid penCurveToY(float x1, float y1, float x3, float y3)
The curve extends from the current point to x3, y3, where x1,y1 and x3,y3
are the bezier control points.
current
+---------* x1/y1
. _
-.
.
.
.
.
+ x3/y3
PDF graphics operator "y"
x1
- x coordinate of first control pointy1
- y coordinate of first control pointx3
- x coordinate of endpointy3
- y coordinate of endpointvoid penLineTo(float x, float y)
x
, y
.
The new current point is x
, y
.
PDF graphics operator "l"
x
- The new current x coordinatey
- The new current y coordinatevoid penMoveTo(float x, float y)
x
, y
. No line
is added to the path, a new subpath is started.
PDF graphics operator "m"
x
- The new current x coordinatey
- The new current y coordinatevoid penRectangle(float x, float y, float w, float h)
The lower left corner is at x
, y
, the
dimensions are width
and height
. The
numbers are defined in user space.
PDF graphics operator "re"
x
- The x coordinate of the lower left corner in user spacey
- The y coordinate of the lower left corner in user spacew
- The width in user spaceh
- The height in user spacevoid restoreState()
PDF graphics operator "Q"
void saveState()
PDF graphics operator "q"
void setExtendedState(COSName resourceName, PDExtGState gstate)
PDResources
entry if needed.
PDF graphics operator "gs"
resourceName
- The logical name of the resource in the PDResources
gstate
- The new PDExtGState
void setFlatnessTolerance(float flatness)
flatness
is a value between 0
and 100, with 0 defining the device's default flatness tolerance.
PDF graphics operator "i"
flatness
- The flatness tolerance between 0 and 100.void setLineCap(int capStyle)
0: Butt. The stroke is cut at the endpoint.
1: Round. A circle is drawn with the diamter of the line width at the endpoint
2: Square. A square is drawn with its center at the endpoint.
PDF graphics operator "J"
capStyle
- The line cap style to use (0,1 or 2)void setLineDash(float[] pattern, float phase)
unitsOn
defines a
length in user space where the line is drawn, unitsOff
defines a length in user space wher the line is not drawn.
phase
defines a "offset" in the pattern definition.
This is a simplified version that only allows for a two phase pattern.
PDF graphics operator "d"
pattern
- The pattern array for the dashphase
- Offset in patternvoid setLineJoin(int joinStyle)
0: Miter Join, the outer line boreders are extended until they meet.
1: Round join. A circle is drawn at the meeting point with its
diameter the same as the line width.
2: Bevel join. The segments are cut at the endpoints as in the line cap
style "Butt". The empty triangle is filled.
PDF graphics operator "j"
joinStyle
- The line join style to use (one of 0,1,2)void setLineWidth(float lineWidth)
A width of zero denotes the thinest line that can be rendered.
PDF graphics operator "w"
lineWidth
- The line width in user space.void setMiterLimit(float miterLimit)
PDF graphics operator "M"
miterLimit
- The maximum ratio of MiterLength/LineWidth when connecting two
lines with miter style.void setNonStrokeColorCMYK(float c, float m, float y, float k)
c
, m
, y
, K
.
c
- A number between 0 (minimum) and 1 (maximum)m
- A number between 0 (minimum) and 1 (maximum)y
- A number between 0 (minimum) and 1 (maximum)k
- A number between 0 (minimum) and 1 (maximum)void setNonStrokeColorGray(float gray)
gray
.
gray
- A number between 0 (black) and 1 (white)void setNonStrokeColorRGB(float r, float g, float b)
r
, g
, b
.
r
- A number between 0 (minimum) and 1 (maximum)g
- A number between 0 (minimum) and 1 (maximum)b
- A number between 0 (minimum) and 1 (maximum)void setNonStrokeColorSpace(COSName resourceName, PDColorSpace colorSpace)
PDF graphics operator "cs"
resourceName
- The logical name of the resource in the PDResources
colorSpace
- The new PDColorSpace
void setNonStrokeColorValues(float[] values)
PDF graphics operator "sc" or "scn", dependen on the active color space.
values
- The color valuesvoid setNonStrokeColorValues(float[] values, COSName resourceName, PDPattern pattern)
PDF graphics operator "scn"
values
- The color values.resourceName
- An optional logical name of the resource in the
PDResources
pattern
- An optional PDPattern
void setRenderingIntent(COSName intent)
PDF graphics operator "ri"
intent
- The name of the rendering intent.void setStrokeColorCMYK(float c, float m, float y, float k)
c
, m
, y
, K
.
c
- A number between 0 (minimum) and 1 (maximum)m
- A number between 0 (minimum) and 1 (maximum)y
- A number between 0 (minimum) and 1 (maximum)k
- A number between 0 (minimum) and 1 (maximum)void setStrokeColorGray(float gray)
gray
.
gray
- A number between 0 (black) and 1 (white)void setStrokeColorRGB(float r, float g, float b)
r
, g
, b
.
r
- A number between 0 (minimum) and 1 (maximum)g
- A number between 0 (minimum) and 1 (maximum)b
- A number between 0 (minimum) and 1 (maximum)void setStrokeColorSpace(COSName resourceName, PDColorSpace colorSpace)
PDF graphics operator "CS"
resourceName
- The logical name of the resource in the PDResources
colorSpace
- The new PDColorSpace
void setStrokeColorValues(float[] values)
PDF graphics operator "SC" or "SCN", dependen on the active color space.
values
- The color values.void setStrokeColorValues(float[] values, COSName resourceName, PDPattern pattern)
PDF graphics operator "SCN"
values
- The color values.resourceName
- An optional logical name of the resource in the
PDResources
pattern
- An optional PDPattern
void textBegin()
PDF graphics operator "BT"
void textEnd()
PDF graphics operator "ET"
void textLineMove(float dx, float dy)
dx
, dy
.
PDF graphics operator "Td"
dx
- The x offset for the new glyph starting point from the last
text line starting point.dy
- The y offset for the new glyph starting point from the last
text line starting point.void textMove(float dx, float dy)
dx
, dy
.
There is no graphics operator for this. It is implemented as a tool for the ease of creating a content stream.
dx
- The x offset for the new glyph starting point from the current
text cursor position.dy
- The x offset for the new glyph starting point from the current
text cursor position.void textMoveTo(float x, float y)
x
, y
.
There is no graphics operator for this. It is implemented as a tool for the ease of creating a content stream.
x
- The x coordinate for the next glyph starting point .y
- The y coordinate for the next glyph starting point .void textLineNew()
y
.
PDF graphics operator "T*"
void textSetCharSpacing(float charSpacing)
PDF graphics operator "Tc"
charSpacing
- The character spacingvoid textSetFont(COSName resourceName, PDFont font, float size)
PDF graphics operator "Tf"
resourceName
- The logical name of the resource in the PDResources
font
- The new PDFont
size
- The new font size (scaling)void textSetHorizontalScaling(float scale)
PDF graphics operator "Tz"
scale
- The new horizontal scaling factor.void textSetLeading(float leading)
PDF graphics operator "TL"
leading
- The new leadingvoid textSetRenderingMode(int renderingMode)
PDF graphics operator "Tr"
renderingMode
- The new rendering mode.void textSetRise(float rise)
PDF graphics operator "Ts"
rise
- The new text rise (super/subscript) amountvoid textSetTransform(float a, float b, float c, float d, float e, float f)
PDF graphics operator "Tm"
a
- operand 1,1 in the matrixb
- operand 1,2 in the matrixc
- operand 2,1 in the matrixd
- operand 2,2 in the matrixe
- operand 3,1 in the matrixf
- operand 3,2 in the matrixvoid textSetWordSpacing(float wordSpacing)
PDF graphics operator "Tw"
wordSpacing
- The new word spacing.void textShow(byte[] text, int offset, int length)
PDF graphics operator "Tj"
text
- The bytes to be shown.offset
- length
- void textShow(String text)
This is an optional operation from the viewpoint of an
ICSInterpreter
. It is called only "manually" in content creation
devices. This method may throw an UnsupportedOperationException
.
PDF graphics operator "Tj"
text
- The text value to be shown using the current fonts encoding.void textT3SetGlyphWidth(float x, float y)
PDF graphics operator "d0"
x
- The glyph widthy
- must be 0void textT3SetGlyphWidthBB(float x, float y, float llx, float lly, float urx, float ury)
PDF graphics operator "d1"
x
- The glyph width.y
- must be 0llx
- lower left x of bounding boxlly
- lower left y of bounding boxurx
- upper right x of bounding boxury
- upper right y of bounding boxvoid transform(float a, float b, float c, float d, float e, float f)
PDF graphics operator "cm"
a
- operand 1,1 in the matrixb
- operand 1,2 in the matrixc
- operand 2,1 in the matrixd
- operand 2,2 in the matrixe
- operand 3,1 in the matrixf
- operand 3,2 in the matrixICSInterpreter getInterpreter()
ICSInterpreter
associated with this ICSDevice
. The
interpreter is associated with "open" and should be no longer used after
"close".
ICSInterpreter
associated with this ICSDevice
.ICSGraphicsState getGraphicsState()
ICSGraphicsState
active.
This is a read only representation of the graphics state used when performing rendering operations in the device.
ICSGraphicsState
active.
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |