public class PSI
extends java.lang.Object
PSI
represents as Pressure Sensitive Ink. This class
contains following features:Pressure sensitive ink (PSI):
convertToPDFAnnot(RectF, PDFPage, RectF)
requires that PDF module is initialized and PDF page object is available.Modifier and Type | Field and Description |
---|---|
static int |
PT_ENDPATH
Point adding flags of END PATH.
|
static int |
PT_LINETO
Point adding flags of LINE TO.
|
static int |
PT_MOVETO
Point adding flags of MOVE TO.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(java.awt.geom.Point2D.Float point,
float pressure,
int pointType)
Add a point to the pressure sensitive ink object.
|
Annot |
convertToPDFAnnot(RectF renderRect,
PDFPage page,
RectF annotRect)
Convert the pressure sensitive ink object to a PDF annotation.
|
static PSI |
create(boolean simulate)
Create a pressure sensitive ink object.
|
RectF |
getContentsRect()
Get contents rectangle of current pressure sensitive ink object.
|
void |
initCanvas(float width,
float height)
Initialize canvas for current pressure sensitive ink.
|
void |
invalidateRect(IInvalidate invalidate)
Invalidating the pressure sensitive ink area
|
void |
release()
Destroy current pressure sensitive ink object.
|
void |
render(Renderer render,
java.awt.Point dest,
int width,
int height,
java.awt.geom.Point2D.Float src)
Render the pressure sensitive ink object.
|
void |
setInkColor(long color)
Set ink color of current pressure sensitive ink object.
|
void |
setInkDiameter(int diameter)
Set ink diameter of current pressure sensitive ink object.
|
void |
setOpacity(float opacity)
Set ink opacity of current pressure sensitive ink object.
|
public static final int PT_LINETO
public static final int PT_MOVETO
public static final int PT_ENDPATH
public static PSI create(boolean simulate) throws PDFException
simulate
- Turn on/off simulation of Pressure Sensitive Ink:
true
means turn on simulation, and
false
means turn off simulation. It can simulate
handwriting weights by writing speed if simulation is turn on.PSI
object that receives the object of Pressure
Sensitive Ink.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void initCanvas(float width, float height) throws PDFException
Coordinate of canvas is the same as device coordinate.
width
- The width of the PSI canvas. This shall be greater than 0.height
- The height of the PSI canvas. This shall be greater than 0.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void release() throws PDFException
PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void setInkColor(long color) throws PDFException
color
- The ink color. Format: 0xAARRGGBB, and alpha value is ignored.
If set red, call like "setInkColor(0x00FF0000);"PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void setInkDiameter(int diameter) throws PDFException
diameter
- Ink diameter. This should be a positive value.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void setOpacity(float opacity) throws PDFException
opacity
- Ink opacity. Valid range: from 0.0f to 1.0fPDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public RectF getContentsRect() throws PDFException
RectF
object that receives the rectangle of a
pressure sensitive ink object, in canvas coordinate.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
,
RectF
public void addPoint(java.awt.geom.Point2D.Float point, float pressure, int pointType) throws PDFException
point
- The value of x and y coordinate of the point in canvas.pressure
- Pressure value of current point, between 0.0f to 1.0f.pointType
- Point type. For more definitions please refer to
PT_XXX
and this should be
one of these constants.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
public void render(Renderer render, java.awt.Point dest, int width, int height, java.awt.geom.Point2D.Float src) throws PDFException
render
- A Renderer
object.dest
- Left-top position of the render area in device.width
- Width of the display area for drawing PSI in canvas.height
- Height of the display area for drawing PSI in canvas.src
- Left-top position of the display area in canvas.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
,
Renderer
public Annot convertToPDFAnnot(RectF renderRect, PDFPage page, RectF annotRect) throws PDFException
renderRect
- A rectangle which represents an area used as display area in canvas,
and its value is in canvas coordinate.page
- A PDFPage
object.annotRect
- An annotation rectangle in PDF page coordinate.Annot
object that receives the newly added
PSInk annotation.PDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
,
Annot
,
PDFPage
,
RectF
public void invalidateRect(IInvalidate invalidate) throws PDFException
invalidate
- An IInvalidate
object is used to
invalidate a pressure sensitive ink areaPDFException
- For more exception information please refer to
PDFException.ERRCODE_XXX
.PDFException
,
IInvalidate