public class

PressureInkUtils

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.utils.PressureInkUtils

Class Overview

Helper class used to create custom Pressure Sensitive appearances for Ink annotations. Custom appearance uses pressure information to determine the thickness of the strokes.

Summary

Nested Classes
class PressureInkUtils.EraserData  
Public Constructors
PressureInkUtils()
Public Methods
static void clearThicknessList(Annot annot)
Clears the thickness list that contains varying stroke thickness information for each stroke in the given Ink annotation
static List<double[]> generateOutlines(List<List<PointF>> pathList, List<List<Float>> thicknessesList, float baseThickness)
Create a stroke outline given a stroke (i.e.
static List<double[]> getThicknessArrays(Ink ink)
static List<List<Float>> getThicknessList(Ink ink)
Stores the thickness list that contains varying stroke thickness information for each stroke in the given Ink annotation

Must be wrapped in a read lock

static boolean isPressureSensitive(Annot ink)
Checks whether the Ink annotation contains pressure information.
static boolean refreshCustomAppearanceForNewAnnot(PDFViewCtrl pdfViewCtrl, Annot annot)
Adds a custom Ink appearance to an new Annotation that uses Pressure sensitive ink information stored in the Annot.
static boolean refreshCustomInkAppearanceForExistingAnnot(Annot annot)
Adds a custom Ink appearance to an existing Annotation that uses Pressure sensitive ink information stored in the Annot.
static void setInkList(Ink ink, List<List<PointF>> inkList)
Clears the ink list in the ink annotation and sets a new one
static void setThicknessList(Ink annot, List<List<Float>> thicknessesList)
Stores the given thickness list which contains varying stroke thickness information for each stroke in the given Ink annotation
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PressureInkUtils ()

Public Methods

public static void clearThicknessList (Annot annot)

Clears the thickness list that contains varying stroke thickness information for each stroke in the given Ink annotation

Parameters
annot the annotation with thickness list that we want to clear

public static List<double[]> generateOutlines (List<List<PointF>> pathList, List<List<Float>> thicknessesList, float baseThickness)

Create a stroke outline given a stroke (i.e. list of points) and a list of thicknesses

Parameters
pathList the stroke points to generate outline
thicknessesList the thickness information for each point
baseThickness the base thickness to reference for annotation
Returns
  • the array containing the outline points with alternative x and y coordinates

public static List<double[]> getThicknessArrays (Ink ink)

Parameters
ink Ink Annotation that may contain a thickness list
Returns
  • the thickness list of each stroke in array form from Ink the annotation, or null if none can be fine

public static List<List<Float>> getThicknessList (Ink ink)

Stores the thickness list that contains varying stroke thickness information for each stroke in the given Ink annotation

Must be wrapped in a read lock

Parameters
ink Ink Annotation that may contain a thickness list
Returns
  • the thickness list of each stroke from the Ink annotation, or null if none can be fine

public static boolean isPressureSensitive (Annot ink)

Checks whether the Ink annotation contains pressure information.

Parameters
ink the ink annotation to check
Returns
  • true if the ink annotation contains thickness information

public static boolean refreshCustomAppearanceForNewAnnot (PDFViewCtrl pdfViewCtrl, Annot annot)

Adds a custom Ink appearance to an new Annotation that uses Pressure sensitive ink information stored in the Annot.

Must be called wrapped in a write lock

Parameters
annot Ink annotation with the appearance that we want to update
Returns
  • true if an appearance was successfully added and false otherwise

public static boolean refreshCustomInkAppearanceForExistingAnnot (Annot annot)

Adds a custom Ink appearance to an existing Annotation that uses Pressure sensitive ink information stored in the Annot.

Must be called wrapped in a write lock

Parameters
annot Ink annotation with the appearance that we want to update
Returns
  • true if an appearance was successfully added and false otherwise

public static void setInkList (Ink ink, List<List<PointF>> inkList)

Clears the ink list in the ink annotation and sets a new one

Parameters
ink the ink annotation to set the ink list to
inkList the ink list containing a list of stroke points

public static void setThicknessList (Ink annot, List<List<Float>> thicknessesList)

Stores the given thickness list which contains varying stroke thickness information for each stroke in the given Ink annotation

Parameters
annot the ink annotation with thickness list that we want to clear
thicknessesList thickness list that we want to add to the annotation