com.foxit.sdk.pdf.PSI Class Reference
Inheritance diagram for com.foxit.sdk.pdf.PSI:
com.foxit.sdk.common.Base

Public Member Functions

 PSI (Bitmap bitmap, boolean simulate) throws com.foxit.sdk.PDFException
 Constructor, with a bitmap as canvas. More...
 
 PSI (int width, int height, boolean simulate) throws com.foxit.sdk.PDFException
 Constructor, with specified width and height for canvas. More...
 
 PSI (PSI other)
 Constructor, with another PSI object. More...
 
void addPoint (PointF point, int type, float pressure) throws com.foxit.sdk.PDFException
 Add a point. More...
 
PSInk convertToPDFAnnot (PDFPage page, RectF annot_rect, int rotate) throws com.foxit.sdk.PDFException
 Convert a PSI object to a PSInk annotation and insert the PSInk annotation to a PDF page. More...
 
Bitmap getBitmap () throws com.foxit.sdk.PDFException
 Get the canvas bitmap. More...
 
RectF getContentsRect () throws com.foxit.sdk.PDFException
 Get contents rectangle. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
void setCallback (PSICallback callback) throws com.foxit.sdk.PDFException
 Set a callback object for refreshing. More...
 
void setColor (long color) throws com.foxit.sdk.PDFException
 Set ink color. More...
 
void setDiameter (int diameter) throws com.foxit.sdk.PDFException
 Set ink diameter. More...
 
void setOpacity (float opacity) throws com.foxit.sdk.PDFException
 Set ink opacity. More...
 

Detailed Description

PSI, "pressure sensitive ink", is specially defined for manual signature, and usually works together with a handwriting board or for a touchscreen. PSI contains private coordinates, and a canvas is created in its coordinates. Canvas limits operating area and generates appearance of PSI. PSI is independent of PDF, and can even be used directly in the device screen. If user wants to save a PSI object to PDF file, please call function PSI::convertToPDFAnnot. This function will convert PSI data to a PSInk annotation (as a Foxit custom annotation type) and insert the PSInk annotation to the specified position in a PDF page.

See also
annots::PSInk

Constructor & Destructor Documentation

◆ PSI() [1/3]

com.foxit.sdk.pdf.PSI.PSI ( Bitmap  bitmap,
boolean  simulate 
) throws com.foxit.sdk.PDFException

Constructor, with a bitmap as canvas.

Parameters
bitmapA bitmap used as canvas. It should be created with common::e_DIBArgb format. User should ensure this bitmap to keep valid until current PSI object is released.
simulateUsed to decide whether to turn on simulation of PSI or not: true means to turn on simulation, and false means to turn off simulation.
It can simulate handwriting weights by writing speed when simulation is on.

◆ PSI() [2/3]

com.foxit.sdk.pdf.PSI.PSI ( int  width,
int  height,
boolean  simulate 
) throws com.foxit.sdk.PDFException

Constructor, with specified width and height for canvas.

Parameters
widthWidth of PSI canvas in device coordinate system. This shall be greater than 0.
heightHeight of PSI canvas in device coordinate system. This shall be greater than 0.
simulateUsed to decide whether to turn on simulation of PSI or not: true means to turn on simulation, and false means to turn off simulation.
It can simulate handwriting weights by writing speed when simulation is on.

◆ PSI() [3/3]

com.foxit.sdk.pdf.PSI.PSI ( PSI  other)

Constructor, with another PSI object.

Parameters
otherAnother PSI object.

Member Function Documentation

◆ addPoint()

void com.foxit.sdk.pdf.PSI.addPoint ( PointF  point,
int  type,
float  pressure 
) throws com.foxit.sdk.PDFException

Add a point.

Parameters
pointA point in canvas coordinate system.
typePoint type. Please refer to values starting from common::e_TypeMoveTo and this should be one of these values.
pressurePressure value for this point. Valid range: from 0.0 to 1.0.
Returns
None.

◆ convertToPDFAnnot()

PSInk com.foxit.sdk.pdf.PSI.convertToPDFAnnot ( PDFPage  page,
RectF  annot_rect,
int  rotate 
) throws com.foxit.sdk.PDFException

Convert a PSI object to a PSInk annotation and insert the PSInk annotation to a PDF page.

Actually, this function is to convert the path data of current PSI to a PSInk annotation, ignoring the canvas bitmap.
Before calling this function, user should ensure that current PSI object has contained a valid path (whose last point's type is common::e_TypeLineToCloseFigure. Otherwise, the conversion will be failed and this function will throw exception e_ErrInvalidData.

Parameters
pageA valid PDF page object, to which the PSI is expected to inserted.
annot_rectA rectangle to specify the position in the PDF page, where the new PSInk annotation will be inserted. It should be valid in PDF coordinate system .
rotateRotation value. Currently, it can only be e_Rotation0.
Returns
A new PSInk annotation object.
Note
User do not need to call function annots::PSInk::resetAppearanceStream to reset the appearance of PSInk annotation after this conversion.

◆ getBitmap()

Bitmap com.foxit.sdk.pdf.PSI.getBitmap ( ) throws com.foxit.sdk.PDFException

Get the canvas bitmap.

Returns
Canvas bitmap.

◆ getContentsRect()

RectF com.foxit.sdk.pdf.PSI.getContentsRect ( ) throws com.foxit.sdk.PDFException

Get contents rectangle.

Returns
Contents rectangle, in device coordinate system. If current PSI object does not contain a valid path, a RectF object with all 0 values would be returned.

◆ isEmpty()

boolean com.foxit.sdk.pdf.PSI.isEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ setCallback()

void com.foxit.sdk.pdf.PSI.setCallback ( PSICallback  callback) throws com.foxit.sdk.PDFException

Set a callback object for refreshing.

Parameters
callbackA callback object PSICallback which is implemented by user. Please ensure that the callback object keeps valid until the life-cycle of current PSI object ends.
Returns
None.

◆ setColor()

void com.foxit.sdk.pdf.PSI.setColor ( long  color) throws com.foxit.sdk.PDFException

Set ink color.

This should be set before adding first point to PSI object. If not set, the default value 0x000000 will be used.

Parameters
colorInk color. Format: 0xRRGGBB.
Returns
None.

◆ setDiameter()

void com.foxit.sdk.pdf.PSI.setDiameter ( int  diameter) throws com.foxit.sdk.PDFException

Set ink diameter.

This should be set before adding first point to PSI object. If not set, the default value 10 will be used.

Parameters
diameterInk diameter. This should be bigger than 1.
Returns
None.

◆ setOpacity()

void com.foxit.sdk.pdf.PSI.setOpacity ( float  opacity) throws com.foxit.sdk.PDFException

Set ink opacity.

This should be set before adding first point to PSI object. If not set, the default value 1.0 will be used.

Parameters
opacityInk opacity. Valid range: from 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.
Returns
None.

Foxit Software Corporation Logo
@2018 Foxit Software Incorporated. All rights reserved.