Package com.myscript.iink.graphics
Interface ICanvas
public interface ICanvas
The ICanvas interface receives drawing commands.
-
Method Summary
Modifier and TypeMethodDescriptionvoidblendOffscreen(int id, float src_x, float src_y, float src_width, float src_height, float dest_x, float dest_y, float dest_width, float dest_height, @NotNull Color blend_color) Requests drawing of an offscreen surface (usually a bitmap).@NotNull IPathCreates a new general path.voiddrawLine(float x1, float y1, float x2, float y2) Requests drawing of a line segment.voiddrawObject(@NotNull String url, @NotNull String mimeType, float x, float y, float width, float height) Requests drawing of an object.voidRequests drawing of a path.voiddrawRectangle(float x, float y, float width, float height) Requests drawing of a rectangle.default voiddrawStrokeWithExtraBrush(@NotNull InkPoints[] vInkPoints, int temporaryPoints, @NotNull ExtraBrushStyle style, boolean fullStroke, long id) Requests drawing of a stroke with an extra brush.voidRequests drawing of text.voidendDraw()Indicates that a drawing session ends.voidIndicates that the drawing of a group of items ends.voidIndicates that the drawing of an item ends.@NotNull TransformRetrieves the current transform.default booleanisExtraBrushSupported(@NotNull String brushName) Checks if an extra brush is supported.voidsetDropShadow(float xOffset, float yOffset, float radius, @NotNull Color color) Configures the drop shadow display.voidsetFillColor(@NotNull Color fillColor) Sets the fill color.voidsetFillRule(@NotNull FillRule fillRule) Sets the fill rule.voidsetFontProperties(@NotNull String family, float lineHeight, float size, @NotNull String style, @NotNull String variant, int weight) Sets the font properties.voidsetStrokeColor(@NotNull Color strokeColor) Sets the stroke color.voidsetStrokeDashArray(@org.jetbrains.annotations.Nullable float[] strokeDashArray) Sets the pattern of dashes and gaps used to stroke paths.voidsetStrokeDashOffset(float strokeDashOffset) Sets the distance into the dash pattern to start the dash.voidsetStrokeLineCap(@NotNull LineCap strokeLineCap) Sets the stroke line cap.voidsetStrokeLineJoin(@NotNull LineJoin strokeLineJoin) Sets the stroke line join.voidsetStrokeMiterLimit(float strokeMiterLimit) Sets the stroke miter limit.voidsetStrokeWidth(float strokeWith) Sets the stroke width.voidsetTransform(@NotNull Transform transform) Sets the transform.voidstartDraw(int x, int y, int width, int height) Indicates that a drawing session starts, on a given area.voidstartGroup(@NotNull String id, float x, float y, float width, float height, boolean clipContent) Indicates that the drawing of a group of items starts.voidIndicates that the drawing of an item starts.
-
Method Details
-
setTransform
Sets the transform.- Parameters:
transform- the transform.
-
getTransform
Retrieves the current transform.- Returns:
- the transform.
-
setStrokeColor
Sets the stroke color.- Parameters:
strokeColor- the stroke color.
-
setStrokeWidth
void setStrokeWidth(float strokeWith) Sets the stroke width.- Parameters:
strokeWith- the stroke width (document coordinates in mm).
-
setStrokeLineCap
Sets the stroke line cap.- Parameters:
strokeLineCap- the stroke line cap.
-
setStrokeLineJoin
Sets the stroke line join.- Parameters:
strokeLineJoin- the stroke line join.
-
setStrokeMiterLimit
void setStrokeMiterLimit(float strokeMiterLimit) Sets the stroke miter limit.- Parameters:
strokeMiterLimit- the stroke miter limit (document coordinates in mm).
-
setStrokeDashArray
void setStrokeDashArray(@Nullable @org.jetbrains.annotations.Nullable float[] strokeDashArray) Sets the pattern of dashes and gaps used to stroke paths.- Parameters:
strokeDashArray- the vector describing the dashes pattern (document coordinates in mm).
-
setStrokeDashOffset
void setStrokeDashOffset(float strokeDashOffset) Sets the distance into the dash pattern to start the dash.- Parameters:
strokeDashOffset- the dash offset (document coordinates in mm).
-
setFillColor
Sets the fill color.- Parameters:
fillColor- the fill color.
-
setFillRule
Sets the fill rule.- Parameters:
fillRule- the fill rule.
-
setDropShadow
Configures the drop shadow display.- Parameters:
xOffset- the drop shadow horizontal offset.yOffset- the drop shadow vertical offset.radius- the blur radius of the drop shadow.color- the color of the drop shadow.
-
setFontProperties
void setFontProperties(@NotNull @NotNull String family, float lineHeight, float size, @NotNull @NotNull String style, @NotNull @NotNull String variant, int weight) Sets the font properties.- Parameters:
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.
-
startGroup
void startGroup(@NotNull @NotNull String id, float x, float y, float width, float height, boolean clipContent) Indicates that the drawing of a group of items starts.- Parameters:
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-trueif the canvas should use the group box as the clipping region until correspondingendGroup(String), otherwisefalse.
-
endGroup
Indicates that the drawing of a group of items ends.- Parameters:
id- the identifier of the group.
-
startItem
Indicates that the drawing of an item starts.- Parameters:
id- the identifier of the group.
-
endItem
Indicates that the drawing of an item ends.- Parameters:
id- the identifier of the group.
-
createPath
Creates a new general path. The renderer will then send commands to this path, and it will be used in the call todrawPath(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.- Returns:
- the newly created general path.
-
drawPath
Requests drawing of a path.- Parameters:
path- the path to draw (document coordinates in mm).
-
isExtraBrushSupported
Checks if an extra brush is supported.- Parameters:
brushName- the name of the brush.- Returns:
trueif extra brush is supported, otherwisefalse.- Since:
- 3.1
-
drawStrokeWithExtraBrush
default void drawStrokeWithExtraBrush(@NotNull @NotNull InkPoints[] vInkPoints, int temporaryPoints, @NotNull @NotNull ExtraBrushStyle style, boolean fullStroke, long id) Requests drawing of a stroke with an extra brush.- Parameters:
vInkPoints- the stroke parts as array of ink points (document coordinates in mm).temporaryPoints- the temporary points count included at the end ofinkPoints.style- the stroke style.fullStroke-trueif the stroke is complete, otherwisefalse.id- the stroke id, or-1.- Since:
- 4.0
-
drawRectangle
void drawRectangle(float x, float y, float width, float height) Requests drawing of a rectangle.- Parameters:
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).
-
drawLine
void drawLine(float x1, float y1, float x2, float y2) Requests drawing of a line segment.- Parameters:
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).
-
drawObject
void drawObject(@NotNull @NotNull String url, @NotNull @NotNull String mimeType, float x, float y, float width, float height) Requests drawing of an object.Note: the object should be transformed (translation and uniform scale) so that it fits centered in the specified viewport rectangle.
- Parameters:
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).
-
drawText
void drawText(@NotNull @NotNull String label, float x, float y, float xmin, float ymin, float xmax, float ymax) Requests drawing of text.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.
- Parameters:
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).
-
startDraw
void startDraw(int x, int y, int width, int height) Indicates that a drawing session starts, on a given area. Provided area must be cleared within this call.- Parameters:
x- the x coordinate of the top left point of the drawing area.y- the y coordinate of the top left point of the drawing area.width- the width of the drawing area.height- the height of the drawing area.- Since:
- 1.4
-
endDraw
void endDraw()Indicates that a drawing session ends.- Since:
- 1.4
-
blendOffscreen
void blendOffscreen(int id, float src_x, float src_y, float src_width, float src_height, float dest_x, float dest_y, float dest_width, float dest_height, @NotNull @NotNull Color blend_color) Requests drawing of an offscreen surface (usually a bitmap).- Parameters:
id- the identifier of the surface.src_x- minimal x coordinate of the offscreen surface.src_y- minimal y coordinate of the offscreen surface.src_width- maximal x coordinate of the offscreen surface.src_height- maximal y coordinate of the offscreen surface.dest_x- minimal x coordinate where to draw this offscreen surface.dest_y- minimal y coordinate where to draw this offscreen surface.dest_width- maximal x coordinate where to draw this offscreen surface.dest_height- maximal y coordinate where to draw this offscreen surface.blend_color- The color used for the blending operation- Since:
- 1.4
-