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.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.void setStrokeDashArray(float[] strokeDashArray)
strokeDashArray
- the vector describing the dashes pattern.void setStrokeDashOffset(float strokeDashOffset)
strokeDashOffset
- the dash offset.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.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.y
- the y coordinate of the top left point of the group box.width
- the width of the group box.height
- the height of the group box.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.void drawRectangle(float x, float y, float width, float height)
x
- the x coordinate of the top left point.y
- the y coordinate of the top left point.width
- the width.height
- the height.void drawLine(float x1, float y1, float x2, float y2)
x1
- the x coordinate of the first point.y1
- the y coordinate of the first point.x2
- the x coordinate of the last point.y2
- the y coordinate of the last point.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.y
- the y coordinate of the top left point of the viewport rectangle.width
- the width of the viewport rectangle.height
- the height of the viewport rectangle.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.y
- the y coordinate of the position from where to draw the text.xmin
- minimal x coordinate of the rendered text.ymin
- minimal y coordinate of the rendered text.xmax
- maximal x coordinate of the rendered text.ymax
- maximal y coordinate of the rendered text.