Foxit PDF SDK
FSPSI Class Reference
Inheritance diagram for FSPSI:
FSBase

Instance Methods

(void) - addPoint:type:pressure:
 Add a point.
More...
 
(FSPSInk *) - convertToPDFAnnot:annot_rect:rotate:
 Convert a PSI object to a PSInk annotation and insert the PSInk annotation to a PDF page.
More...
 
(FSBitmap *) - getBitmap
 Get the canvas bitmap.
More...
 
(FSRectF *) - getContentsRect
 Get contents rectangle.
More...
 
(id) - initWithBitmap:simulate:
 Constructor, with a bitmap as canvas.
More...
 
(id) - initWithOther:
 Constructor, with another PSI object.
More...
 
(id) - initWithWidth:height:simulate:
 Constructor, with specified width and height for canvas.
More...
 
(BOOL) - isEmpty
 Check whether current object is empty or not.
More...
 
(void) - setCallback:
 Set a callback object for refreshing.
More...
 
(void) - setColor:
 Set ink color.
More...
 
(void) - setDiameter:
 Set ink diameter.
More...
 
(void) - setOpacity:
 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 FSPSI::convertToPDFAnnot:annot_rect:rotate:. 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
FSPSInk

Method Documentation

◆ addPoint:type:pressure:()

- (void) addPoint: (FSPointF*)  point
type: (FSPathPointType type
pressure: (float)  pressure 

Add a point.

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

◆ convertToPDFAnnot:annot_rect:rotate:()

- (FSPSInk *) convertToPDFAnnot: (FSPDFPage*)  page
annot_rect: (FSRectF*)  annot_rect
rotate: (FSRotation rotate 

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 FSPathTypeLineToCloseFigure. Otherwise, the conversion will be failed and this function will throw exception FSErrInvalidData.

Parameters
[in]pageA valid PDF page object, to which the PSI is expected to inserted.
[in]annot_rectA rectangle to specify the position in the PDF page, where the new PSInk annotation will be inserted. It should be valid in .
[in]rotateRotation value. Currently, it can only be FSRotation0.
Returns
A new PSInk annotation object.
Note
User do not need to call function FSAnnot::resetAppearanceStream (inherited from PSInk's parent class) to reset the appearance of PSInk annotation after this conversion.

◆ getBitmap()

- (FSBitmap *) getBitmap

Get the canvas bitmap.

Returns
Canvas bitmap.

◆ getContentsRect()

- (FSRectF *) getContentsRect

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.

◆ initWithBitmap:simulate:()

- (id) initWithBitmap: (FSBitmap*)  bitmap
simulate: (BOOL)  simulate 

Constructor, with a bitmap as canvas.

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

◆ initWithOther:()

- (id) initWithOther: (FSPSI*)  other

Constructor, with another PSI object.

Parameters
[in]otherAnother PSI object.

◆ initWithWidth:height:simulate:()

- (id) initWithWidth: (int)  width
height: (int)  height
simulate: (BOOL)  simulate 

Constructor, with specified width and height for canvas.

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

◆ isEmpty()

- (BOOL) isEmpty

Check whether current object is empty or not.

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

Returns
YES means current object is empty, while NO means not.

◆ setCallback:()

- (void) setCallback: (id<FSPSICallback>)  callback

Set a callback object for refreshing.

Parameters
[in]callbackA callback object 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) setColor: (unsigned int)  color

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
[in]colorInk color. Format: 0xRRGGBB.
Returns
None.

◆ setDiameter:()

- (void) setDiameter: (int)  diameter

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
[in]diameterInk diameter. This should be bigger than 1.
Returns
None.

◆ setOpacity:()

- (void) setOpacity: (float)  opacity

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
[in]opacityInk opacity. Valid range: from 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.
Returns
None.