Tip:
Highlight text to annotate it
X
Hi. I'm Jon from Samsung. In this video I'm going to introduce you to
some of the great features of S Pen and show you how you can use the S Pen SDK to build
these features into your S Pen enabled apps.
We use version 2.2 of the S Pen SDK in this video, which works on the Galaxy Note range
of devices. Now if you want to make use of all the features we talk about, you need to
at least be running the Ice Cream Sandwich version of Android.
We've become used to controlling our smart phones via touch, but this often doesn't provide
an accurate enough drawing method. To overcome this problem, we introduced S Pen.
The S Pen tip allows user interface scenarios featuring both pressure sensitivity and precision,
while the intuitive side button provides measurable press & release events. These can be combined
to create innovative new user control interfaces.
You can simulate a "back" button event, like this. Or an "option" key event, like this.
The S Pen SDK contains various components, that you can use to create feature rich applications.
These might include a graphics app supporting free hand drawing, a precision controlled
game or a social networking app.
S Pen can also be used in a wide range of educational and B2B environments, features
such as gestures and signature recognition open up a huge range of opportunities.
The S Pen APIs and components are designed in a logical and easy to follow way.
The Drawing engine is responsible for all drawing related functions such as drawing
on the canvas, choosing the various Pen settings or adding text. Also provided is the option
to save a foreground drawing as an image, or both the foreground and background images
together, which is useful for notation, or sketching ideas.
The S Pen Event manager provides event handling classes which allow you to pickup notifications
for touch, hover or side button press events.
Using Image Processing API's you can easily apply several image filters to an image such
as Pen sketch, vintage or retro for example.
Using the multimedia object manager allows you to provide cool effects like playing an
animation or inserting and manipulating an image object.
The Signature API's provide registration & verification of signature information. You can also set
the verification level as low, medium or high as per your apps or your clients security
requirements.
With S Pen verification, your app can actually detect whether a finger of the Pen is touching
the screen.
Taking both touch point co-ordinates and pen pressure measurements, your app can draw variable
lines or utilise it's own innovative drawing system.
Interacting with the Side button can add a whole new dynamic to your app's user experience.
Even in the non-contact state, you can get side button & coordinate information from
pen hovering events.
Let's have a look S Pen's drawing functionality. The CanvasView, which is part of the sdraw
package, allows you to set the background image for the canvas and also access the Pen
setting view.
The CanvasView class allows you to choose one of 5 pen types, and change the thickness,
colour, and opacity. The Eraser SettingView allows you to change the thickness of the
eraser and even clear the entire canvas.
Undo & redo for user drawing is very easy to support. The Canvasview also provides a
zooming & panning feature, and you can set the background image or colour for the drawing
canvas. Images and text objects can be added to the canvas and these objects can be resized,
moved and deleted.
The S Pen SDK contains the Samsung animated multimedia messaging library or SAMM for short.
You can use SAMM to create animations from user drawings, you can send these as attachments
or add background music.
In this animation example, a user draws on the canvas and the stroke information is stored
in the SAMM storage format which can be played back as a step-by-step animation.
Another S Pen feature is image conversion. The S Pen SDK contains 33 image conversion
filters. Let's have a look at these in action.
Applying the: grey, pencil, pop art & magic pen filters, with a filter level of medium,
to the original image on the left provides interesting image processing possibilities.
Another cool feature is the Scratch effect. You can set the scratch cover - which is a
top level image and an intermediate background image which will be revealed after you've
scratched back the cover.
In this example we have two scratch covers, with and without a background image. Scratching
off the first cover reveals nothing, while scratching off the second reveals the background
image.
Combining multiple effects can produce some interesting results. In this example we apply
a pencil sketch filter to the original image and then use the resulting image as a scratch
cover. Scratching on the cover reveals the original image as the background & we can
play this as a scratch animation.
Signature recognition is a very useful feature and there are simple APIs provided to allow
you to register, compare and manage signatures on the device.
There are three levels of signature verification: Low, medium and high. You can set the level
according to the requirements of your app. In our example, first the signature is not
verified and an error message is shown. At the next attempt, the signature is verified,
and a success message is shown.
The S Pen SDK includes the S Pen Java Library - called Libspen22.jar, a developer guide
& sample apps. To add the JAR file into your project, you first go into your project's
properties, go to java build path, then libraries, click on add external JAR and add the libspen22.JAR
file.
Our simple demo app will show you how to render drawing on the canvas, set any image as a
canvas background and perform simple operations like undo & redo. You'll also be able choose
the Pen or Eraser and modify settings.
First open the layout.xml file and add the SCanvasView into it. We can see 5 buttons
at the top of the window and below that is the canvasview.
In our demo app, we have imported 2 packages, which you'll see on the screen now. To make
full use of the S Pen features, you'll need to import further packages.
Now, we need to initialise the controls. We create a member, which we'll call mSCanvas,
of the SCanvasView class and we assign the canvas view, which we created in layout.xml,
to the mSCanvas member.
Next we need to add the image button handler by overriding the onClick method of the OnClickListener.
In the onClick method, we launch the gallery activity to choose the background image. In
the onactivityresult method, we set this image to the canvas background by using the setBackgroundImage
method.
In our app we let the user draw with the pen and use the eraser. You've got control of
both pen and eraser settings, including pen width and colour.
We used the CanvasView API's showSettingView() and toggleShowSettingView() to achieve this.
For Undo & redo operations, we've used the undo() & redo() methods of the canvasview
and the isUndoable() or isRedoable() methods to set the enable or disable states of the
Undo and Redo buttons.
Here is the demo app in action. First we select the background image, and we change the pen
and eraser settings while we go.
In this video we introduced S Pen, showed you some of the features provided by the SDK
and explained how easy it is for you to add S Pen functionality to your apps.
So why not head over to developer.samsung.com and
download the S Pen SDK today, and start developing innovative pen driven apps? Thanks for watching.