public class SpenPen extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SpenPen.ChangedListener
This listener interface provides callback methods for advanced setting attribute change event.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
PEN_ATTRIBUTE_ADVANCED_SETTING
Deprecated.
|
static int |
PEN_ATTRIBUTE_ALPHA
Pen transparency.
|
static int |
PEN_ATTRIBUTE_COLOR
Pen color.
|
static int |
PEN_ATTRIBUTE_CURVE
Pen curve.
|
static int |
PEN_ATTRIBUTE_SIZE
Pen stroke size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(MotionEvent event,
RectF rect)
Called to process the following events: ACTION_DOWN, ACTION_MOVE and ACTION_UP
|
String |
getAdvancedSetting()
Deprecated.
|
Bitmap |
getBitmap()
Get the pen bitmap.
|
int |
getColor()
Get the Pen color.
|
float |
getMaxSettingValue()
Get the maximum values for attributes on the SettingView.
|
float |
getMinSettingValue()
Get the minimum values for attributes on the SettingView.
|
boolean |
getPenAttribute(int attribute)
Check if Pen supports the specified attribute.
|
float |
getSize()
Get the Pen stroke size.
|
RectF |
getStrokeRect(SpenObjectStroke stroke)
Get the rectangle for the specified stroke.
|
void |
hideAdvancedSetting()
Deprecated.
|
boolean |
isCurveEnabled()
Check if curve drawing is enabled for Pen.
|
void |
redrawPen(MotionEvent event,
RectF rect)
Redraw a stroke.
|
void |
setAdvancedSetting(String advancedSetting)
Deprecated.
|
void |
setBitmap(Bitmap bitmap)
Set the specified bitmap for Pen.
|
void |
setColor(int color)
Set the specified Pen color.
|
void |
setCurveEnabled(boolean enable)
Enable or disable curve drawing for Pen.
|
void |
setDepthMapBitmap(Bitmap bitmap)
Set the depth map bitmap for Pen.
|
void |
setReferenceBitmap(Bitmap bitmap)
Set the reference bitmap for Pen.
|
void |
setSize(float size)
Set the specified Pen stroke size.
|
void |
showAdvancedSetting(SpenPen.ChangedListener listener,
ViewGroup viewGroup)
Deprecated.
|
public static final int PEN_ATTRIBUTE_SIZE
public static final int PEN_ATTRIBUTE_ALPHA
public static final int PEN_ATTRIBUTE_COLOR
public static final int PEN_ATTRIBUTE_CURVE
@Deprecated public static final int PEN_ATTRIBUTE_ADVANCED_SETTING
public void draw(MotionEvent event, RectF rect)
event - The event information.
The valid values are:
ACTION_DOWN
ACTION_MOVE
ACTION_UPrect - The output value of the internal rectangle that Pen draws.NullPointerException - Thrown if event is nullpublic void redrawPen(MotionEvent event, RectF rect)
event - The event information.
The valid values are:
ACTION_DOWN
ACTION_MOVE
ACTION_UP
The event's getX,getY is the last point and the historical point 0 becomes the first point and the rest become in-between points.rect - The output value of the internal rectangle that Pen draws.NullPointerException - Thrown if event is nullpublic void setBitmap(Bitmap bitmap)
bitmap - Bitmap for Pen.
For example:
Bitmap bitmap = Bitmap.createBitmap(300, 300, Config.ARGB_8888);
pen.setBitmap(bitmap);public Bitmap getBitmap()
public void setReferenceBitmap(Bitmap bitmap)
bitmap - The reference bitmap.public void setDepthMapBitmap(Bitmap bitmap)
bitmap - The depth map bitmap.public void setSize(float size)
size - The Pen size.public float getSize()
public float getMinSettingValue()
public float getMaxSettingValue()
public void setColor(int color)
color - The Pen color in ARGB8888 format.public int getColor()
public void setCurveEnabled(boolean enable)
enable - Set to true to enable curves to be drawn with Pen, set to false to disable the drawing of curves with Pen.
If it is set to false, Pen draws a straight line.public boolean isCurveEnabled()
@Deprecated public void setAdvancedSetting(String advancedSetting)
advancedSetting - The Pen advanced setting.showAdvancedSetting(com.samsung.android.sdk.pen.pen.SpenPen.ChangedListener, android.view.ViewGroup),
hideAdvancedSetting(),
SpenPen.ChangedListener@Deprecated public String getAdvancedSetting()
showAdvancedSetting(com.samsung.android.sdk.pen.pen.SpenPen.ChangedListener, android.view.ViewGroup),
hideAdvancedSetting(),
SpenPen.ChangedListener@Deprecated public void showAdvancedSetting(SpenPen.ChangedListener listener, ViewGroup viewGroup)
listener - The ChangedListener instance for receiving advanced settings change events.viewGroup - The parent view for the views created internally for advanced settings.IllegalArgumentException - Thrown if listener is nullUndeclaredThrowableException - Thrown if viewGroup is nullsetAdvancedSetting(java.lang.String),
getAdvancedSetting(),
SpenPen.ChangedListener@Deprecated public void hideAdvancedSetting()
setAdvancedSetting(java.lang.String),
getAdvancedSetting(),
SpenPen.ChangedListenerpublic boolean getPenAttribute(int attribute)
attribute - The Pen attribute.
Example:
getAttribute(pen.PEN_ATTRIBUTE_SIZE)
The valid values are:
PEN_ATTRIBUTE_SIZE
PEN_ATTRIBUTE_ALPHA
PEN_ATTRIBUTE_COLOR
PEN_ATTRIBUTE_CURVE
PEN_ATTRIBUTE_ADVANCED_SETTING
For more information, see Field Detail in this class reference.public RectF getStrokeRect(SpenObjectStroke stroke)
stroke - The strike object with point, size, and color information.
#SpenObjectStrokeNullPointerException - Thrown if stroke is null.