public interface ICanvas
Modifier and Type | Method and Description |
---|---|
IPath |
createPath()
Creates a new general path.
|
void |
drawLine(float x1,
float y1,
float x2,
float y2)
Requests drawing of a line segment.
|
void |
drawObject(java.lang.String url,
java.lang.String mimeType,
float x,
float y,
float width,
float height)
Requests drawing of an object.
|
void |
drawPath(IPath path)
Requests drawing of a path.
|
void |
drawRectangle(float x,
float y,
float width,
float height)
Requests drawing of a rectangle.
|
void |
drawText(java.lang.String label,
float x,
float y,
float xmin,
float ymin,
float xmax,
float ymax)
Requests drawing of text.
|
void |
endGroup(java.lang.String id)
Indicates that the drawing of a group of items ends.
|
void |
endItem(java.lang.String id)
Indicates that the drawing of an item ends.
|
Transform |
getTransform()
Retrieves the current transform.
|
void |
setFillColor(Color fillColor)
Sets the fill color.
|
void |
setFillRule(FillRule fillRule)
Sets the fill rule.
|
void |
setFontProperties(java.lang.String family,
float lineHeight,
float size,
java.lang.String style,
java.lang.String variant,
int weight)
Sets the font properties.
|
void |
setStrokeColor(Color strokeColor)
Sets the stroke color.
|
void |
setStrokeDashArray(float[] strokeDashArray)
Sets the pattern of dashes and gaps used to stroke paths.
|
void |
setStrokeDashOffset(float strokeDashOffset)
Sets the distance into the dash pattern to start the dash.
|
void |
setStrokeLineCap(LineCap strokeLineCap)
Sets the stroke line cap.
|
void |
setStrokeLineJoin(LineJoin strokeLineJoin)
Sets the stroke line join.
|
void |
setStrokeMiterLimit(float strokeMiterLimit)
Sets the stroke miter limit.
|
void |
setStrokeWidth(float strokeWith)
Sets the stroke width.
|
void |
setTransform(Transform transform)
Sets the transform.
|
void |
startGroup(java.lang.String id,
float x,
float y,
float width,
float height,
boolean clipContent)
Indicates that the drawing of a group of items starts.
|
void |
startItem(java.lang.String id)
Indicates that the drawing of an item starts.
|
void setTransform(Transform transform)
transform
- the transform.Transform getTransform()
void setStrokeColor(Color strokeColor)
strokeColor
- the stroke color.void setStrokeWidth(float strokeWith)
strokeWith
- the stroke width (document coordinates in mm).void setStrokeLineCap(LineCap strokeLineCap)
strokeLineCap
- the stroke line cap.void setStrokeLineJoin(LineJoin strokeLineJoin)
strokeLineJoin
- the stroke line join.void setStrokeMiterLimit(float strokeMiterLimit)
strokeMiterLimit
- the stroke miter limit (document coordinates in mm).void setStrokeDashArray(float[] strokeDashArray)
strokeDashArray
- the vector describing the dashes pattern (document coordinates in mm).void setStrokeDashOffset(float strokeDashOffset)
strokeDashOffset
- the dash offset (document coordinates in mm).void setFillColor(Color fillColor)
fillColor
- the fill color.void setFillRule(FillRule fillRule)
fillRule
- the fill rule.void setFontProperties(java.lang.String family, float lineHeight, float size, java.lang.String style, java.lang.String variant, int weight)
family
- the font family.lineHeight
- the font line height.size
- the font size (document coordinates in mm).style
- the font style.variant
- the font variant.weight
- the font weight.void startGroup(java.lang.String id, float x, float y, float width, float height, boolean clipContent)
id
- the identifier of the group.x
- the x coordinate of the top left point of the group box (document coordinates in mm).y
- the y coordinate of the top left point of the group box (document coordinates in mm).width
- the width of the group box (document coordinates in mm).height
- the height of the group box (document coordinates in mm).clipContent
- true
if the canvas should use the group box as the
clipping region until corresponding endGroup(String)
,
otherwise false
.void endGroup(java.lang.String id)
id
- the identifier of the group.void startItem(java.lang.String id)
id
- the identifier of the group.void endItem(java.lang.String id)
id
- the identifier of the group.IPath createPath()
drawPath(IPath)
.
Note: the drawPath(IPath)
method may be called with a path that
was created by another instance of canvas, because the renderer maintains a
cache of the paths that hold the visual representation of ink strokes.
void drawPath(IPath path)
path
- the path to draw (document coordinates in mm).void drawRectangle(float x, float y, float width, float height)
x
- the x coordinate of the top left point (document coordinates in mm).y
- the y coordinate of the top left point (document coordinates in mm).width
- the width (document coordinates in mm).height
- the height (document coordinates in mm).void drawLine(float x1, float y1, float x2, float y2)
x1
- the x coordinate of the first point (document coordinates in mm).y1
- the y coordinate of the first point (document coordinates in mm).x2
- the x coordinate of the last point (document coordinates in mm).y2
- the y coordinate of the last point (document coordinates in mm).void drawObject(java.lang.String url, java.lang.String mimeType, float x, float y, float width, float height)
Note: the object should be transformed (translation and uniform scale) so that it fits centered in the specified viewport rectangle.
url
- the URL of the object.mimeType
- the Mime type associated with the object.x
- the x coordinate of the top left point of the viewport rectangle (document coordinates in mm).y
- the y coordinate of the top left point of the viewport rectangle (document coordinates in mm).width
- the width of the viewport rectangle (document coordinates in mm).height
- the height of the viewport rectangle (document coordinates in mm).void drawText(java.lang.String label, float x, float y, float xmin, float ymin, float xmax, float ymax)
Note: the extent of the rendered text as given by xmin, ymin, xmax, and ymax is informative and should not be used for the actual rendering.
label
- the label of the text to draw.x
- the x coordinate of the position from where to draw the text (document coordinates in mm).y
- the y coordinate of the position from where to draw the text (document coordinates in mm).xmin
- minimal x coordinate of the rendered text (document coordinates in mm).ymin
- minimal y coordinate of the rendered text (document coordinates in mm).xmax
- maximal x coordinate of the rendered text (document coordinates in mm).ymax
- maximal y coordinate of the rendered text (document coordinates in mm).