public class

Ink

extends Markup
java.lang.Object
   ↳ com.pdftron.pdf.Annot
     ↳ com.pdftron.pdf.annots.Markup
       ↳ com.pdftron.pdf.annots.Ink

Class Overview

An ink annotation (PDF 1.3) represents a freehand "scribble" composed of one or more disjoint paths. When opened, it shall display a pop-up window containing the text of the associated note.

Summary

Nested Classes
enum Ink.BlendMode  
[Expand]
Inherited Constants
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
Public Constructors
Ink(Obj d)
Creates an Ink annotation and initialize it using given Cos/SDF object.
Ink()
Creates an empty Ink annotation.
Ink(Annot annot)
Creates an Ink annotation and initialize it using given annotation object.
Public Methods
Point GetPoint(int pathindex, int pointindex)
Get the specific point in the Ink List.
static Ink create(Doc doc, Rect pos)
Creates a new Ink annotation, in the specified document.
boolean erase(Point pt1, Point pt2, double eraserHalfWidth)
Erase a rectangle area formed by pt1pt2 with width
static boolean erasePoints(Obj sdfObj, Rect rect, Point pt1, Point pt2, double eraserHalfWidth)
Erase a rectangle area formed by pt1pt2 with width from the SDF object
static double[] getBezierControlPoints(double[] polyline)
Returns an array of Bezier Control Points for smoothing the given polyline
int getBlendMode()
Gets the blend mode
int getPathCount()
Get number of stroked pathes in the InkList.
int getPointCount(int pathindex)
Get number of points in a certain stroked path in the InkList.
boolean getSmoothing()
Gets whether smoothing should be used then refreshing the inks appearance
void setBlendMode(Ink.BlendMode blendMode)
Sets the blend mode
void setPoint(int pathindex, int pointindex, Point pt)
Set the specific point in the Ink List.
void setSmoothing(boolean smoothing)
Sets whether smoothing should be used then refreshing the inks appearance
[Expand]
Inherited Methods
From class com.pdftron.pdf.annots.Markup
From class com.pdftron.pdf.Annot
From class java.lang.Object

Public Constructors

public Ink (Obj d)

Creates an Ink annotation and initialize it using given Cos/SDF object.

Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Parameters
d the input Cos/SDF object

public Ink ()

Creates an empty Ink annotation.

public Ink (Annot annot)

Creates an Ink annotation and initialize it using given annotation object.

Note: The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Parameters
annot the annot

Public Methods

public Point GetPoint (int pathindex, int pointindex)

Get the specific point in the Ink List.

Note: The Ink list is An array of n arrays, each representing a stroked path. Each array shall be a series of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.

Parameters
pathindex An unsigned integer indicating the index of the stroked path
pointindex An unsigned integer indicating the index of the point within the stroked path indicated by the parameter "pathindex".
Returns
  • A Point object that is located by "pathindex" and "pointindex".

public static Ink create (Doc doc, Rect pos)

Creates a new Ink annotation, in the specified document.

Parameters
doc A document to which the Ink annotation is added.
pos A rectangle specifying the Ink annotation's bounds, specified in user space coordinates.
Returns
  • A newly created blank Ink annotation.

public boolean erase (Point pt1, Point pt2, double eraserHalfWidth)

Erase a rectangle area formed by pt1pt2 with width

Parameters
pt1 A point object that is one end of the eraser segment
pt2 A point object that is the other end of the eraser segment
eraserHalfWidth The half width of the eraser

public static boolean erasePoints (Obj sdfObj, Rect rect, Point pt1, Point pt2, double eraserHalfWidth)

Erase a rectangle area formed by pt1pt2 with width from the SDF object

Parameters
sdfObj An SDF object containing points on which the erase will be performed
pt1 A point object that is one end of the eraser segment
pt2 A point object that is the other end of the eraser segment
eraserHalfWidth The half width of the eraser

public static double[] getBezierControlPoints (double[] polyline)

Returns an array of Bezier Control Points for smoothing the given polyline

Parameters
polyline A double array of points that form a polyline

public int getBlendMode ()

Gets the blend mode

public int getPathCount ()

Get number of stroked pathes in the InkList.

Note: The Ink list is An array of n arrays, each representing a stroked path. Each array shall be a series of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.

Returns
  • An integer representing the number of pathes in the Ink list.

public int getPointCount (int pathindex)

Get number of points in a certain stroked path in the InkList.

Note: The Ink list is An array of n arrays, each representing a stroked path. Each array shall be a series of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.

Parameters
pathindex An unsigned integer indicating the index of the stroked path, the number of points within whom is of our interest.
Returns
  • An integer representing the number of points in the stroked path of the Ink list.

public boolean getSmoothing ()

Gets whether smoothing should be used then refreshing the inks appearance

public void setBlendMode (Ink.BlendMode blendMode)

Sets the blend mode

Parameters
blendMode The blend mode

public void setPoint (int pathindex, int pointindex, Point pt)

Set the specific point in the Ink List.

Note: The Ink list is An array of n arrays, each representing a stroked path. Each array shall be a series of Point objects specifying points along the path. When drawn, the points shall be connected by straight lines or curves in an implementation-dependent way.

Parameters
pathindex An unsigned integer indicating the index of the stroked path
pointindex An unsigned integer indicating the index of the point within the stroked path indicated by the parameter "pathindex".
pt A Point object that is to be located by "pathindex" and "pointindex".

public void setSmoothing (boolean smoothing)

Sets whether smoothing should be used then refreshing the inks appearance

Parameters
smoothing A bool indicating whether smoothing should be used (true by default).