public class

FreehandCreate

extends SimpleShapeCreate
java.lang.Object
   ↳ com.pdftron.pdf.tools.Tool
     ↳ com.pdftron.pdf.tools.BaseTool
       ↳ com.pdftron.pdf.tools.SimpleShapeCreate
         ↳ com.pdftron.pdf.tools.FreehandCreate

Class Overview

This class is for creating a free hand annotation.

Summary

[Expand]
Inherited Constants
From class com.pdftron.pdf.tools.BaseTool
From class com.pdftron.pdf.tools.Tool
[Expand]
Inherited Fields
From class com.pdftron.pdf.tools.Tool
Public Constructors
FreehandCreate(PDFViewCtrl ctrl)
Class constructor
Public Methods
boolean canEraseStroke()
boolean canRedoStroke()
boolean canUndoStroke()
void clearStrokes()
Clears all strokes.
void commitAnnotation()
Commits all changes to the annotation.
static PointF convPagePtToDrawingPt(PDFViewCtrl pdfViewCtrl, float pageX, float pageY, int pageNum, PointF offset)
static ArrayList<ArrayList<PointF>> createDrawingStrokesFromPageStrokes(PDFViewCtrl pdfViewCtrl, ArrayList<ArrayList<PointF>> pathStrokes, boolean isStylus, int annotPage, PointF offset)
static ArrayList<ArrayList<PointF>> createDrawingStrokesFromPageStrokes(PDFViewCtrl pdfViewCtrl, ArrayList<ArrayList<PointF>> pathStrokes, boolean isStylus, int annotPage)
int getCreateAnnotType()
Gets what annotation type this tool can create
ToolManager.ToolModeBase getToolMode()
The overload implementation of getToolMode().
boolean isCreatingAnnotation()
The overload implementation of isCreatingAnnotation().
void onClose()
The overload implementation of onClose().
boolean onDoubleTap(MotionEvent e)
The overload implementation of onDoubleTap(MotionEvent).
boolean onDoubleTapEvent(MotionEvent e)
The overload implementation of onDoubleTapEvent(MotionEvent).
boolean onDown(MotionEvent e)
The overload implementation of onDown(MotionEvent).
void onDraw(Canvas canvas, Matrix tfm)
The overload implementation of onDraw(Canvas, Matrix).
boolean onFlingStop()
The overload implementation of onFlingStop().
void onLayout(boolean changed, int l, int t, int r, int b)
The overload implementation of onLayout(boolean, int, int, int, int).
boolean onMove(MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)
The overload implementation of onMove(MotionEvent, MotionEvent, float, float).
boolean onScaleBegin(float x, float y)
The overload implementation of onScaleBegin(float, float).
boolean onUp(MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)
The overload implementation of onUp(MotionEvent, PDFViewCtrl.PriorEventMode).
void redoStroke()
Redoes the last undo.
static void setDebug(boolean debug)
void setInitInkItem(Annot inkAnnot, int pageNum)
Initializes the ink item based on the specified annotation.
void setMultiStrokeMode(boolean mode)
Sets multiple stroke mode.
void setOnToolbarStateUpdateListener(OnToolbarStateUpdateListener listener)
Sets the OnToolbarStateUpdateListener listener.
void setTimedModeEnabled(boolean enabled)
Sets time mode.
void setupAnnotProperty(int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName)
void setupEraserProperty(float halfThickness)
Setups eraser property.
static void setupInkItem(Ink ink, InkItem item, int pageNum)
Sets the initial ink item.
void undoStroke()
Undoes the last stroke.
[Expand]
Inherited Methods
From class com.pdftron.pdf.tools.SimpleShapeCreate
From class com.pdftron.pdf.tools.BaseTool
From class com.pdftron.pdf.tools.Tool
From class java.lang.Object
From interface com.pdftron.pdf.tools.ToolManager.Tool

Public Constructors

public FreehandCreate (PDFViewCtrl ctrl)

Class constructor

Public Methods

public boolean canEraseStroke ()

Returns
  • True if can erase any strokes

public boolean canRedoStroke ()

Returns
  • True if can redo the last undo

public boolean canUndoStroke ()

Returns
  • True if can undo the last stroke

public void clearStrokes ()

Clears all strokes.

public void commitAnnotation ()

Commits all changes to the annotation.

Before undo/redo, you should ensure there is no commit left to annotations.

public static PointF convPagePtToDrawingPt (PDFViewCtrl pdfViewCtrl, float pageX, float pageY, int pageNum, PointF offset)

public static ArrayList<ArrayList<PointF>> createDrawingStrokesFromPageStrokes (PDFViewCtrl pdfViewCtrl, ArrayList<ArrayList<PointF>> pathStrokes, boolean isStylus, int annotPage, PointF offset)

public static ArrayList<ArrayList<PointF>> createDrawingStrokesFromPageStrokes (PDFViewCtrl pdfViewCtrl, ArrayList<ArrayList<PointF>> pathStrokes, boolean isStylus, int annotPage)

public int getCreateAnnotType ()

Gets what annotation type this tool can create

Returns
  • annot type for annotation creation tool, or unknown for non-creation tool.

public ToolManager.ToolModeBase getToolMode ()

The overload implementation of getToolMode().

Returns
  • the mode/identifier of this tool.

public boolean isCreatingAnnotation ()

The overload implementation of isCreatingAnnotation().

public void onClose ()

The overload implementation of onClose().

public boolean onDoubleTap (MotionEvent e)

The overload implementation of onDoubleTap(MotionEvent).

public boolean onDoubleTapEvent (MotionEvent e)

The overload implementation of onDoubleTapEvent(MotionEvent).

public boolean onDown (MotionEvent e)

The overload implementation of onDown(MotionEvent).

public void onDraw (Canvas canvas, Matrix tfm)

The overload implementation of onDraw(Canvas, Matrix).

public boolean onFlingStop ()

The overload implementation of onFlingStop().

public void onLayout (boolean changed, int l, int t, int r, int b)

The overload implementation of onLayout(boolean, int, int, int, int).

public boolean onMove (MotionEvent e1, MotionEvent e2, float x_dist, float y_dist)

The overload implementation of onMove(MotionEvent, MotionEvent, float, float).

public boolean onScaleBegin (float x, float y)

The overload implementation of onScaleBegin(float, float).

public boolean onUp (MotionEvent e, PDFViewCtrl.PriorEventMode priorEventMode)

The overload implementation of onUp(MotionEvent, PDFViewCtrl.PriorEventMode).

public void redoStroke ()

Redoes the last undo.

public static void setDebug (boolean debug)

public void setInitInkItem (Annot inkAnnot, int pageNum)

Initializes the ink item based on the specified annotation.

Parameters
inkAnnot The ink annotation
pageNum The page number

public void setMultiStrokeMode (boolean mode)

Sets multiple stroke mode.

Parameters
mode True if multiple stroke mode is enabled

public void setOnToolbarStateUpdateListener (OnToolbarStateUpdateListener listener)

Sets the OnToolbarStateUpdateListener listener.

Parameters
listener the OnToolbarStateUpdateListener listener

public void setTimedModeEnabled (boolean enabled)

Sets time mode.

Parameters
enabled True if time mode is enabled

public void setupAnnotProperty (int color, float opacity, float thickness, int fillColor, String icon, String pdfTronFontName)

Parameters
color The color
opacity The opacity
thickness The thickness
fillColor The color for filling
icon The icon
pdfTronFontName The PDFTron font name

public void setupEraserProperty (float halfThickness)

Setups eraser property.

Parameters
halfThickness The thickness in half

public static void setupInkItem (Ink ink, InkItem item, int pageNum)

Sets the initial ink item. This method will not lock internally and requires a lock outside of it.

public void undoStroke ()

Undoes the last stroke.