public class SpenSimpleSurfaceView extends SurfaceView implements SpenSimpleViewInterface
SpenSimpleView instead of this class on low-end devices which don't support OpenGL ES 2.0 or above and extensions GL_EXT_unpack_subimage, GL_EXT_blend_minmaxSpenSettingViewPenInterface.SpenBackgroundColorChangeListenerACTION_COLOR_PICKER, ACTION_ERASER, ACTION_GESTURE, ACTION_NONE, ACTION_RECOGNITION, ACTION_SELECTION, ACTION_STROKE, ACTION_STROKE_REMOVER, ACTION_TEXT, TOOL_ERASER, TOOL_FINGER, TOOL_MOUSE, TOOL_MULTI_TOUCH, TOOL_PEN_BUTTON, TOOL_SPEN, TOOL_UNKNOWN| Constructor and Description |
|---|
SpenSimpleSurfaceView(Context context)
Creates an SpenSimpleSurfaceView instance.
|
SpenSimpleSurfaceView(Context context,
AttributeSet attrs)
Creates an SpenSimpleSurfaceView instance with the specified XML attributes.
|
SpenSimpleSurfaceView(Context context,
AttributeSet attrs,
int defStyleAttr)
Creates an SpenSimpleSurfaceView instance with the specified XML attributes and a class-specific default
style.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancelStroke()
Cancel the drawing stroke.
|
Bitmap |
captureCurrentView(boolean includeBlank)
Get the bitmap of the current view.
|
void |
close()
Close the canvas view.
|
void |
closeControl()
Exits the Base Control.
|
int |
getBlankColor()
Get the blank color.
|
int |
getCanvasHeight()
Get the current canvas width.
|
int |
getCanvasWidth()
Get the current canvas height.
|
SpenControlBase |
getControl()
Get the current control.
|
SpenSettingEraserInfo |
getEraserSettingInfo()
Get the eraser settings information.
|
PointF |
getFrameStartPosition()
Get the position of real View
|
float |
getMaxZoomRatio()
Get the maximum zoom ratio of the view.
|
float |
getMinZoomRatio()
Get the minimum zoom ratio of the view.
|
PointF |
getPan()
Get the current pan position.
|
SpenSettingPenInfo |
getPenSettingInfo()
Get the Pen settings information.
|
SpenSettingRemoverInfo |
getRemoverSettingInfo()
Get the Remover settings information.
|
SpenSettingSelectionInfo |
getSelectionSettingInfo()
Get the selection settings information.
|
int |
getToolTypeAction(int toolType)
Get the action of the specified tool type.
|
float |
getZoomRatio()
Get the zoom ratio of the view.
|
boolean |
isScrollBarEnabled()
Check if the scroll bar is enabled.
|
boolean |
isToolTipEnabled()
Check if tool tips are enabled.
|
boolean |
isZoomable()
Check if zoom mode is enabled for the view.
|
protected void |
onAttachedToWindow() |
boolean |
onHoverEvent(MotionEvent event) |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
boolean |
onTouchEvent(MotionEvent event) |
void |
setBackgroundColorChangeListener(Object object,
SpenSettingViewPenInterface.SpenBackgroundColorChangeListener listener)
Sets the background color changed event listener.
|
void |
setBlankColor(int color)
Set the specified blank color.
|
void |
setColorPickerListener(SpenColorPickerListener listener)
Sets the specified SpenColorPickerListener instance to receive color picker events.
|
void |
setControl(SpenControlBase control)
Set the specified control to the canvas.
|
void |
setControlListener(SpenControlListener listener)
Set the specified SpenControlListener instance to receive canvas control events.
|
void |
setEraserChangeListener(SpenEraserChangeListener listener)
Sets the eraser change event listener
|
void |
setEraserSettingInfo(SpenSettingEraserInfo info)
Set the specified eraser settings information.
|
void |
setLongPressListener(SpenLongPressListener listener)
Sets the long press listener for LongPressListener.
|
boolean |
setMaxZoomRatio(float ratio)
Set the specified maximum zoom ratio of the view.
|
boolean |
setMinZoomRatio(float ratio)
Set the specified minimum zoom ratio of the view.
|
boolean |
setPageDoc(SpenPageDoc pageDoc,
boolean isUpdate)
Set the specified PageDoc instance to the current view.
|
void |
setPan(PointF position)
Set the specified pan position and move to the position in the view.
|
void |
setPenChangeListener(SpenPenChangeListener listener)
Set the specified SpenPenChangeListener instance to receive Pen settings events.
|
void |
setPenDetachmentListener(SpenPenDetachmentListener listener)
Sets the pen detachement listener.
|
void |
setPenSettingInfo(SpenSettingPenInfo info)
Set the specified Pen settings information for the specified user.
|
void |
setPreTouchListener(SpenTouchListener listener)
Set the specified SpenTouchListener instance to receive pre-touch events.
|
void |
setRemoverChangeListener(SpenRemoverChangeListener listener)
Set the specified SpenRemoverChangeListener instance to receive Remover events.
|
void |
setRemoverSettingInfo(SpenSettingRemoverInfo info)
Set the specified Remover settings information.
|
void |
setScrollBarEnabled(boolean enable)
Enable or disable the canvas view scrollbar.
|
void |
setSelectionChangeListener(SpenSelectionChangeListener listener)
Sets the selection change event listener
|
void |
setSelectionSettingInfo(SpenSettingSelectionInfo info)
Set the specified selection settings information.
|
void |
setToolTipEnabled(boolean enable)
Enable or disable tool tips.
|
void |
setToolTypeAction(int toolType,
int action)
Set the specified action for the specified tool type.
|
void |
setTouchListener(SpenTouchListener listener)
Set the specified SpenTouchListener instance to receive touch events.
|
void |
setZoom(float centerX,
float centerY,
float ratio)
Set the specified zoom ratio of the view.
|
void |
setZoomable(boolean enable)
Enable or disable the zoom mode of the view.
|
void |
setZoomListener(SpenZoomListener listener)
Sets the zoom event listener.
|
void |
update()
Update the canvas.
|
void |
updateRedo(SpenPageDoc.HistoryUpdateInfo[] userDataList)
Update the screen after executing the redo command.
|
void |
updateUndo(SpenPageDoc.HistoryUpdateInfo[] userDataList)
Update the screen after executing the undo command.
|
public SpenSimpleSurfaceView(Context context)
context - The Context for your application. The context should not be nullNullPointerException - Thrown if the context is set null.SpenSimpleSurfaceView(Context, AttributeSet),
SpenSimpleSurfaceView(Context, AttributeSet, int)public SpenSimpleSurfaceView(Context context, AttributeSet attrs)
context - The Context for your application. The context should not be nullattrs - The XML attributes for the view.NullPointerException - Thrown if the context is set null.SpenSimpleSurfaceView(Context),
SpenSimpleSurfaceView(Context, AttributeSet, int)public SpenSimpleSurfaceView(Context context, AttributeSet attrs, int defStyleAttr)
context - The Context for your application. The context should not be nullattrs - The XML attributes for the view.defStyleAttr - The default style to apply to this view.
Set to 0 to apply no style beyond what is included in the theme.
This can be an attribute resource value retrieved from the current theme or an explicit style
resource.NullPointerException - Thrown if the context is set null.SpenSimpleSurfaceView(Context),
SpenSimpleSurfaceView(Context, AttributeSet)public void close()
close in interface SpenSimpleViewInterfacepublic void setPenSettingInfo(SpenSettingPenInfo info)
setPenSettingInfo in interface SpenSettingViewPenInterfaceinfo - The Pen settings information object.SpenSettingPenInfopublic SpenSettingPenInfo getPenSettingInfo()
getPenSettingInfo in interface SpenSettingViewPenInterfaceSpenSettingPenInfopublic void setRemoverSettingInfo(SpenSettingRemoverInfo info)
setRemoverSettingInfo in interface SpenSettingViewRemoverInterfaceinfo - The Remover settings information object.SpenSettingRemoverInfopublic SpenSettingRemoverInfo getRemoverSettingInfo()
getRemoverSettingInfo in interface SpenSettingViewRemoverInterfaceSpenSettingRemoverInfopublic void setToolTypeAction(int toolType,
int action)
SpenSettingViewInterfacesetToolTypeAction in interface SpenSettingViewInterfacetoolType - toolType of motion event SpenSettingViewInterface.TOOL_UNKNOWN, SpenSettingViewInterface.TOOL_FINGER, SpenSettingViewInterface.TOOL_SPEN,
SpenSettingViewInterface.TOOL_MOUSE, SpenSettingViewInterface.TOOL_ERASERaction - action of tool SpenSettingViewInterface.ACTION_NONE, SpenSettingViewInterface.ACTION_GESTURE, SpenSettingViewInterface.ACTION_STROKE,
SpenSettingViewInterface.ACTION_ERASER, SpenSettingViewInterface.ACTION_STROKE_REMOVER, SpenSettingViewInterface.ACTION_COLOR_PICKER,
SpenSettingViewInterface.ACTION_SELECTIONpublic int getToolTypeAction(int toolType)
SpenSettingViewInterfacegetToolTypeAction in interface SpenSettingViewInterfacetoolType - toolType of motion event SpenSettingViewInterface.TOOL_UNKNOWN, SpenSettingViewInterface.TOOL_FINGER, SpenSettingViewInterface.TOOL_SPEN,
SpenSettingViewInterface.TOOL_MOUSE, SpenSettingViewInterface.TOOL_ERASERSpenSettingViewInterface.ACTION_NONE, SpenSettingViewInterface.ACTION_GESTURE, SpenSettingViewInterface.ACTION_STROKE,
SpenSettingViewInterface.ACTION_ERASER, SpenSettingViewInterface.ACTION_STROKE_REMOVER, SpenSettingViewInterface.ACTION_COLOR_PICKER,
SpenSettingViewInterface.ACTION_SELECTIONpublic int getCanvasWidth()
SpenSettingViewInterfacegetCanvasWidth in interface SpenSettingViewInterfacepublic int getCanvasHeight()
SpenSettingViewInterfacegetCanvasHeight in interface SpenSettingViewInterfacepublic void closeControl()
SpenSettingViewInterfacecloseControl in interface SpenSettingViewInterfacepublic void setBackgroundColorChangeListener(Object object, SpenSettingViewPenInterface.SpenBackgroundColorChangeListener listener)
SpenSettingViewPenInterfacesetBackgroundColorChangeListener in interface SpenSettingViewPenInterfaceobject - Object layout which changed background color.listener - The callback listener for Changed BackgroundColorpublic boolean setPageDoc(SpenPageDoc pageDoc, boolean isUpdate)
setPageDoc in interface SpenSimpleViewInterfacepageDoc - The PageDoc instance that you want to set.isUpdate - Set to true to update the screen, set to false to not update the screen.OutOfMemoryError - Thrown if there is insufficient memory available.public void setZoomable(boolean enable)
setZoomable in interface SpenSimpleViewInterfaceenable - Set to true to enable the zoom mode, set to false to disable the zoom mode.public boolean isZoomable()
isZoomable in interface SpenSimpleViewInterfacepublic void setZoom(float centerX,
float centerY,
float ratio)
setZoom in interface SpenSimpleViewInterfacecenterX - The X coordinate in pixels for the center.centerY - The Y coordinate in pixels for the center.ratio - The zoom ratio.public float getZoomRatio()
getZoomRatio in interface SpenSimpleViewInterfacepublic boolean setMaxZoomRatio(float ratio)
setMaxZoomRatio in interface SpenSimpleViewInterfaceratio - The maximum zoom ratio.public float getMaxZoomRatio()
getMaxZoomRatio in interface SpenSimpleViewInterfacepublic boolean setMinZoomRatio(float ratio)
setMinZoomRatio in interface SpenSimpleViewInterfaceratio - The minimum zoom ratio.public float getMinZoomRatio()
getMinZoomRatio in interface SpenSimpleViewInterfacepublic void setPan(PointF position)
setPan in interface SpenSimpleViewInterfaceposition - The pan position.NullPointerException - If position is set nullpublic PointF getPan()
getPan in interface SpenSimpleViewInterfacepublic void setBlankColor(int color)
setBlankColor in interface SpenSimpleViewInterfacecolor - The blank color.public int getBlankColor()
getBlankColor in interface SpenSimpleViewInterfacepublic void setPenChangeListener(SpenPenChangeListener listener)
setPenChangeListener in interface SpenSimpleViewInterfacelistener - The SpenPenChangeListener instance to receive Pen settings events.public void setRemoverChangeListener(SpenRemoverChangeListener listener)
setRemoverChangeListener in interface SpenSimpleViewInterfacelistener - The SpenRemoverChangeListener instance to receive Remover events.public boolean onTouchEvent(MotionEvent event)
onTouchEvent in class Viewprotected void onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
protected void onAttachedToWindow()
onAttachedToWindow in class SurfaceViewpublic void update()
update in interface SpenSimpleViewInterfacepublic void updateUndo(SpenPageDoc.HistoryUpdateInfo[] userDataList)
updateUndo in interface SpenSimpleViewInterfaceuserDataList - The data list for the previous state.public void updateRedo(SpenPageDoc.HistoryUpdateInfo[] userDataList)
updateRedo in interface SpenSimpleViewInterfaceuserDataList - The data list for the previous state.public void setScrollBarEnabled(boolean enable)
setScrollBarEnabled in interface SpenSimpleViewInterfaceenable - Set to true to enable the scroll bar, set to false to disable the scroll bar.public boolean isScrollBarEnabled()
isScrollBarEnabled in interface SpenSimpleViewInterfacepublic void setColorPickerListener(SpenColorPickerListener listener)
setColorPickerListener in interface SpenSimpleViewInterfacelistener - The SpenColorPickerListener instance to receive color picker events.public void setPreTouchListener(SpenTouchListener listener)
setPreTouchListener in interface SpenSimpleViewInterfacelistener - The SpenTouchListener instance to receive pre-touch events.public void setTouchListener(SpenTouchListener listener)
setTouchListener in interface SpenSimpleViewInterfacelistener - The SpenTouchListener instance to receive touch events.public Bitmap captureCurrentView(boolean includeBlank)
captureCurrentView in interface SpenSimpleViewInterfaceincludeBlank - Set to true to include a blank in the captured bitmap, set to false to capture only the screen without
the blank.OutOfMemoryError - Thrown if device run out of memorypublic void setToolTipEnabled(boolean enable)
setToolTipEnabled in interface SpenSimpleViewInterfaceenable - Set to true to enable tool tips, set to false to disable tool tips.public boolean isToolTipEnabled()
isToolTipEnabled in interface SpenSimpleViewInterfacepublic void cancelStroke()
cancelStroke in interface SpenSimpleViewInterfacepublic void setSelectionChangeListener(SpenSelectionChangeListener listener)
setSelectionChangeListener in interface SpenSimpleViewInterfacelistener - The callback listener for selection datapublic void setLongPressListener(SpenLongPressListener listener)
setLongPressListener in interface SpenSimpleViewInterfacelistener - The callback listener for LongPressListenerpublic void setZoomListener(SpenZoomListener listener)
setZoomListener in interface SpenSimpleViewInterfacelistener - The callback listener for zoom eventpublic void setPenDetachmentListener(SpenPenDetachmentListener listener)
setPenDetachmentListener in interface SpenSimpleViewInterfacelistener - The callback listener for pen detachement listenerpublic void setSelectionSettingInfo(SpenSettingSelectionInfo info)
setSelectionSettingInfo in interface SpenSettingViewSelectionInterfaceinfo - The selection settings information object.SpenSettingSelectionInfopublic SpenSettingSelectionInfo getSelectionSettingInfo()
getSelectionSettingInfo in interface SpenSettingViewSelectionInterfaceSpenSettingSelectionInfopublic void setControl(SpenControlBase control)
setControl in interface SpenSimpleViewInterfacecontrol - The control instance.IllegalArgumentException - Thrown if control is null.public SpenControlBase getControl()
getControl in interface SpenSimpleViewInterfacepublic void setControlListener(SpenControlListener listener)
setControlListener in interface SpenSimpleViewInterfacelistener - The SpenControlListener instance to receive canvas control events.public boolean onHoverEvent(MotionEvent event)
onHoverEvent in class Viewpublic void setEraserSettingInfo(SpenSettingEraserInfo info)
setEraserSettingInfo in interface SpenSettingViewEraserInterfaceinfo - The eraser settings information object.SpenSettingEraserInfopublic SpenSettingEraserInfo getEraserSettingInfo()
getEraserSettingInfo in interface SpenSettingViewEraserInterfaceSpenSettingEraserInfopublic void setEraserChangeListener(SpenEraserChangeListener listener)
listener - The callback listener for eraser datapublic PointF getFrameStartPosition()