public final class SpenObjectStroke extends SpenObjectBase
| Modifier and Type | Field and Description |
|---|---|
static int |
TOOL_TYPE_ERASER
Stroke creation with the eraser.
|
static int |
TOOL_TYPE_FINGER
Stroke creation with a finger.
|
static int |
TOOL_TYPE_MOUSE
Stroke creation with a mouse.
|
static int |
TOOL_TYPE_SPEN
Stroke creation with a S-Pen.
|
static int |
TOOL_TYPE_UNKNOWN
Unknown tool.
|
OBJECT_MINIMUM_SIZE, RESIZE_OPTION_DISABLE, RESIZE_OPTION_FREE, RESIZE_OPTION_KEEP_RATIO, SPEN_INFINITY_FLOAT, SPEN_INFINITY_INT, TYPE_CONTAINER, TYPE_IMAGE, TYPE_LINE, TYPE_NONE, TYPE_SHAPE, TYPE_STROKE, TYPE_TEXT_BOX| Constructor and Description |
|---|
SpenObjectStroke()
Creates an SpenObjectStroke instance.
|
SpenObjectStroke(boolean isTemplateObject)
Creates an SpenObjectStroke instance with the specified template status.
|
SpenObjectStroke(String penName)
Creates an SpenObjectStroke instance with the specified pen.
For more details on penName, see setPenName(String). |
SpenObjectStroke(String penName,
boolean isTemplateObject)
Creates an SpenObjectStroke instance with the specified pen and template status.
For more details on penName, see setPenName(String). |
SpenObjectStroke(String penName,
PointF[] points,
float[] pressures,
int[] timestamps)
Creates an SpenObjectStroke instance with the specified pen, stroke points, pressures, and time-stamps.
For more details on penName, see setPenName(String). |
SpenObjectStroke(String penName,
PointF[] points,
float[] pressures,
int[] timestamps,
boolean isTemplateObject)
Creates an SpenObjectStroke instance with the specified pen, stroke points, pressures, timestamps and template
status.
For more details on penName, see setPenName(String). |
SpenObjectStroke(String penName,
PointF[] points,
float[] pressures,
int[] timestamps,
float[] tilts,
float[] orientations)
Creates an SpenObjectStroke instance with the specified pen, stroke points, pressures, time-stamps, pen tilts and
pen orientations
For more details on penName, see setPenName(String). |
SpenObjectStroke(String penName,
PointF[] points,
float[] pressures,
int[] timestamps,
float[] tilts,
float[] orientations,
boolean isTemplateObject)
Creates an SpenObjectStroke instance with the specified pen, stroke points, pressures, time-stamps, pen tilts,
pen orientations and template status.
For more details on penName, see setPenName(String). |
| Modifier and Type | Method and Description |
|---|---|
void |
addPoint(PointF pos,
float pressure,
int timestamp)
Add the specified point, pressure and timestamp in the last position.
If pressure or timestamp has not been set, pressure or timestamp will be ignored.If the tilt and orientation have been set, it should throw an exception. |
void |
addPoint(PointF pos,
float pressure,
int timestamp,
float tilt,
float orientation)
Add the specified point, pressure, timestamp, tilt, and orientation in the last position.
If pressure, timestamp, tilt or orientation has not been set, it will be ignored. |
void |
copy(SpenObjectBase source)
Copy data from the specified object.
|
String |
getAdvancedPenSetting()
Get the advanced pen settings.
Use this method for getting pen advanced settings. |
int |
getColor()
Get the stroke color.
|
float[] |
getOrientations()
Get the pen orientations.
The length of the orientations array is equal to the length of the points array. |
String |
getPenName()
Get the pen name.
|
float |
getPenSize()
Get the stroke line width
|
PointF[] |
getPoints()
Get the stroke points.
|
float[] |
getPressures()
Get the stroke pressures.
The length of the pressures array is equal to the length of the points array. |
float[] |
getTilts()
Get the pen tilts.
The length of the tilts array is equal to the length of the points array. |
int[] |
getTimeStamps()
Get the stroke timestamps.
The length of the timestamps array is equal to the length of the points array. |
int |
getToolType()
Get the stroke tool type.
|
boolean |
isCurveEnabled()
Check if curved lines are enabled for this instance.
|
void |
setAdvancedPenSetting(String penStyle)
Set the advanced pen settings.
Use this method for setting pen advanced settings. |
void |
setColor(int color)
Set the specified stroke color.
|
void |
setCurveEnabled(boolean enable)
Enable or disable curved lines.
|
void |
setPenName(String penName)
Set the specified name for the pen.
penName is the pen ID for a stroke. |
void |
setPenSize(float size)
Set the stroke line width.
|
void |
setPoints(PointF[] points,
float[] pressures,
int[] timestamps)
Set the specified stroke coordinate points.
|
void |
setPoints(PointF[] points,
float[] pressures,
int[] timestamps,
float[] tilts,
float[] orientations)
Set the specified stroke coordinate points.
|
void |
setRect(RectF rect,
boolean regionOnly)
CAUTION : If you use setRect API with
regionOnly is true and rect not cover all stroke's points,
the canvas may not be updated correctly! |
void |
setRotation(float degree)
Set the specified rotation angle.
|
void |
setToolType(int toolType)
Set the specified stroke tool type.
|
attachFile, clearChangedFlag, detachFile, equals, getAttachedFile, getDrawnRect, getExtraDataByteArray, getExtraDataInt, getExtraDataString, getExtraDataStringArray, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getRect, getResizeOption, getRotation, getRuntimeHandle, getSorDataInt, getSorDataString, getSorInfo, getSorPackageLink, getTemplateProperty, getType, getUserId, hasExtraDataByteArray, hasExtraDataInt, hasExtraDataString, hasExtraDataStringArray, hashCode, hasSorDataInt, hasSorDataString, isChanged, isFlipEnabled, isMovable, isOutOfViewEnabled, isRecorded, isRotatable, isSelectable, isVisible, removeExtraDataByteArray, removeExtraDataInt, removeExtraDataString, removeExtraDataStringArray, removeSorDataInt, removeSorDataString, setExtraDataByteArray, setExtraDataInt, setExtraDataString, setExtraDataStringArray, setFlipEnabled, setMaxSize, setMinSize, setMovable, setOutOfViewEnabled, setRecorded, setResizeOption, setRotatable, setSelectable, setSorDataInt, setSorDataString, setSorInfo, setSorPackageLink, setUserId, setVisibilitypublic static final int TOOL_TYPE_UNKNOWN
public static final int TOOL_TYPE_FINGER
public static final int TOOL_TYPE_SPEN
public static final int TOOL_TYPE_MOUSE
public static final int TOOL_TYPE_ERASER
public SpenObjectStroke()
public SpenObjectStroke(boolean isTemplateObject)
isTemplateObject - Set to true to create a template object, set to false to create a non-template object.public SpenObjectStroke(String penName)
penName, see setPenName(String).penName - The name of the pen.setPenName(String)public SpenObjectStroke(String penName, boolean isTemplateObject)
penName, see setPenName(String).penName - The name of the pen.isTemplateObject - Set to true to create a template object, set to false to create a non-template object.setPenName(String)public SpenObjectStroke(String penName, PointF[] points, float[] pressures, int[] timestamps)
penName, see setPenName(String). And, for more details on points,
pressures, and timestamps, see setPoints(PointF[], float[], int[]).penName - The name of the pen.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.IllegalArgumentException - Thrown if any element of points is null. IndexOutOfBoundsException - Thrown if the array size is over 65535.setPenName(String),
setPoints(PointF[], float[], int[])public SpenObjectStroke(String penName, PointF[] points, float[] pressures, int[] timestamps, boolean isTemplateObject)
penName, see setPenName(String). And, for more details on points,
pressures, and timestamps, see setPoints(PointF[], float[], int[]).penName - The name of the pen.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.isTemplateObject - Set to true to create a template object, set to false to create a non-template object.IllegalArgumentException - Thrown if any element of points is null.
Thrown if the lengths of points, pressures, timestamps are not equal.IndexOutOfBoundsException - Thrown if the array size is over 65535.setPenName(String),
setPoints(PointF[], float[], int[])public SpenObjectStroke(String penName, PointF[] points, float[] pressures, int[] timestamps, float[] tilts, float[] orientations)
penName, see setPenName(String). And, for more details on points,
pressures, timestamps, tilts, and orientations, see
setPoints(PointF[], float[], int[], float[], float[]).penName - The name of the pen.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.tilts - The array of pen tilts.orientations - The array of pen orientations.IllegalArgumentException - Thrown if any element of points is null.
Thrown if the lengths of points, pressures, timestamps are not equal.
Thrown if the array of tilts is NULL and the array of orientations is not NULL.
Thrown if the array of tilts is not NULL and the array of orientations is NULL.
Thrown if the arrays of tilts and orientations are not NULL and the lengths of points, tilts,
orientations are not equal.IndexOutOfBoundsException - Thrown if the array size is over 65535.setPenName(String),
setPoints(PointF[], float[], int[], float[], float[])public SpenObjectStroke(String penName, PointF[] points, float[] pressures, int[] timestamps, float[] tilts, float[] orientations, boolean isTemplateObject)
penName, see setPenName(String). And, for more details on points,
pressures, timestamps, tilts, and orientations, see
setPoints(PointF[], float[], int[], float[], float[]).penName - The name of the pen.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.tilts - The array of pen tilts.orientations - The array of pen orientations.isTemplateObject - Set to true to create a template object, set to false to create a non-template object.IllegalArgumentException - Thrown if any element of points is null.
Thrown if the lengths of points, pressures, timestamps are not equal.
Thrown if the array of tilts is NULL and the array of orientations is not NULL.
Thrown if the array of tilts is not NULL and the array of orientations is NULL.
Thrown if the arrays of tilts and orientations are not NULL and the lengths of points, tilts,
orientations are not equal.IndexOutOfBoundsException - Thrown if the array size is over 65535.setPenName(String),
setPoints(PointF[], float[], int[], float[], float[])public void setPenName(String penName)
penName is the pen ID for a stroke.
If penName is not null and the default pen name is null, then the default pen name will
be set as penName.
When a SpenPageDoc undo or redo and the pen name is changed, if default pen name is null, then
the default pen name will be set as the same as the pen name.
If (@code penName} is not an old pen name (pen name that used from SDK 3.0 and before), the default pen name must
be set an old pen name because of backward compatibility.penName - The name for the pen.getPenName()public String getPenName()
setPenName(String)public void setAdvancedPenSetting(String penStyle)
penStyle - The pen style.getAdvancedPenSetting()public String getAdvancedPenSetting()
setAdvancedPenSetting(String)public void setPoints(PointF[] points, float[] pressures, int[] timestamps)
null into element of pressures or element of timestamps to remove
the information. But you can not set pressures and timestamps to null.setRect(RectF,boolean) method for the region.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.IllegalArgumentException - Thrown if any element of points is null.
Thrown if the lengths of points, pressures, timestamps are not equal.IndexOutOfBoundsException - Thrown if the array size is over 65535.getPoints()public void setPoints(PointF[] points, float[] pressures, int[] timestamps, float[] tilts, float[] orientations)
pressures and timestamps to null.setRect(RectF,boolean) method for the region.points - The array of stroke points.pressures - The array of stroke pressures.timestamps - The array of stroke timestamps.tilts - The array of pen tilts.orientations - The array of pen orientations.IllegalArgumentException - Thrown if any element of points is null. IndexOutOfBoundsException - Thrown if the array size is over 65535.getPoints()public PointF[] getPoints()
setPoints(PointF[], float[], int[], float[], float[])public float[] getPressures()
setPoints(PointF[], float[], int[], float[], float[])public int[] getTimeStamps()
setPoints(PointF[], float[], int[], float[], float[])public float[] getTilts()
setPoints(PointF[], float[], int[], float[], float[])public float[] getOrientations()
setPoints(PointF[], float[], int[], float[], float[])public void addPoint(PointF pos, float pressure, int timestamp)
pressure or timestamp has not been set, pressure or timestamp will be ignored.pos - The stroke point coordinates.pressure - The stroke pressure.timestamp - The timestamp.IllegalArgumentException - Thrown if the tilt and orientation have been set.IndexOutOfBoundsException - Thrown if the size of current points is 65535.setPoints(PointF[], float[], int[])public void addPoint(PointF pos, float pressure, int timestamp, float tilt, float orientation)
pressure, timestamp, tilt or orientation has not been set, it will be ignored.pos - The stroke point coordinates.pressure - The stroke pressure.timestamp - The timestamp.tilt - The pen tilt.orientation - The pen orientation.IllegalArgumentException - Thrown if tilt and orientation is not set until now.IndexOutOfBoundsException - Thrown if the size of current points is 65535.setPoints(PointF[], float[], int[], float[], float[])public void setRect(RectF rect, boolean regionOnly)
regionOnly is true and rect not cover all stroke's points,
the canvas may not be updated correctly!setRect in class SpenObjectBaserect - The rectangle of region.regionOnly - Set to true to not allow the internal data to be changed, set to false to let rectangle change the
internal data.public void setColor(int color)
color - The ARGB8888 format color.getColor()public int getColor()
setColor(int)public void setPenSize(float size)
size - The line width in pixelsIllegalArgumentException - Thrown if the size passed is less than 0.getPenSize()public float getPenSize()
setPenSize(float)public void setCurveEnabled(boolean enable)
enable - Set to true to enable curves, set to false to disable curves.
The default property is true. If you set this to false, this stroke line is drawn as a
straight line.isCurveEnabled()public boolean isCurveEnabled()
true, if curves are enabled.false, if curves are not enabled.setCurveEnabled(boolean)public void setToolType(int toolType)
toolType - The stroke tool type.TOOL_TYPE_FINGER, TOOL_TYPE_SPEN, TOOL_TYPE_MOUSE,
TOOL_TYPE_ERASER.IllegalArgumentException - Thrown if the toolType passed is invalid.TOOL_TYPE_FINGER,
TOOL_TYPE_SPEN,
TOOL_TYPE_MOUSE,
TOOL_TYPE_ERASER,
getToolType()public int getToolType()
TOOL_TYPE_FINGER, TOOL_TYPE_SPEN, TOOL_TYPE_MOUSE,
TOOL_TYPE_ERASER.TOOL_TYPE_FINGER,
TOOL_TYPE_SPEN,
TOOL_TYPE_MOUSE,
TOOL_TYPE_ERASER,
setToolType(int)public void setRotation(float degree)
SpenObjectBasesetRotation in class SpenObjectBasedegree - The angle to rotate.public void copy(SpenObjectBase source)
SpenObjectBasecopy in class SpenObjectBasesource - The source object.