Get a Jumpstart with our Sample Apps
Results 1 to 13 of 13

Thread: Ink Control Capabilities

  1. #1
    Member jhackney's Avatar
    Real Name
    James S. Hackney
    Join Date
    Oct 2006
    Location
    Houston
    Posts
    111

    Default Ink Control Capabilities

    Does anyone know or can someone from the Alpha Development team comment on the following:


    1. My guess is the ink that is displayed is SVG and not canvas. I am interested in capturing the actual svg data using the onChange event. Is there a variable I can currently access with the svg data or does Alpha plan on releasing a method to access this data?
    2. Once I grab the svg data, I plan on manipulating it using javascript and would like to post back to the editor or the view with the changes. Does Alpha have or plan on releasing a method to achieve this?
    3. Is it possible or does Alpha plan on providing the ability to generate the background of the editor or page via javascript?


    Sample Usage

    • User draws a circle, line, triangle, or whatever.
    • SVG data is retrieved and manipulated to return a perfect geometrical circle, line, or triangle.
    • User draws a line up, lifts pen, draws another line to the left.
    • SVG data is retrieved and manipulated to return a joined line at a right angle or closest angle + or - 5 degrees.
    • User draws a single line up and curved to the left.
    • SVG data is retrieved and manipulated to return a right angle with a perfect geometrical curve or closest angle + or - 5 degrees.
    Thanks,
    James

  2. #2
    Member
    Real Name
    Ken Carroll
    Join Date
    Nov 2012
    Location
    San Jose CA
    Posts
    27

    Default Re: Ink Control Capabilities

    James,

    You have expressed my thoughts exactly, snapping to grid when within x number of pixels, to make a straight line, to line up with the background graph, like I use in iPocketDraw and other apps on my iPad, to import as an image...It would be handy to have all of this available right there in my app, without having to use 3rd party apps to make my drawing (foundation sketch) on my termite report (required in California Wood Destroying Organisms). I really hope this is in the plan too. I did some of this type of programming years ago in Visual Basic and came up with a program I run from my desktop when using MS Word and VBA to generate termite reports...but to have all of the features I need available on my iPad is the goal.

    Ken

  3. #3
    Alpha Software Employee Eavan Chambliss's Avatar
    Real Name
    Eavan Chambliss
    Join Date
    Aug 2005
    Posts
    23

    Default Re: Ink Control Capabilities

    Ink is not SVG - it is a terse format that allows the storing of large numbers of points in a compact way. This allows us to capture handwriting at high fidelity, and make the ink behave well with two important features - erase and undo. Ink can be thought of as a little bit of a mix between raster and vector - in that it captures a lot of points (pretty much one per every one or two pixels) like raster, but stores them as vectors. There are some (currently unexposed) features in the Ink control that will allow you to draw uniform lines, arrows, etc. - but these are still experimental. The issues above have been thought about a little here at Alpha, and the solutions we are looking at are these:

    - add a line tool to Ink: this would allow the user to quickly draw uniform ink lines and could include point and angle snapping, however, the line would be made up of many points (allowing it to be partially erasable like freehand Ink - so it would behave in the same way and not confuse the user).
    - add the ability to have SVG stencils: basically allow for a transformable SVG path to be used as a guide for drawing (like a stencil in real drawing - it would snap Ink points to nearest point on SVG stencil) - basic forms like line, arc, ellipse, and rectangle could be allowed, and custom paths like a french curve could be added as well. Handles would make them quick to move, scale and rotate.

    But there is another aspect to this issue - format. Ink was created to be very good at handwriting. It is not the best format for CAD. To that end, we have been thinking (nothing developed yet) about the ability to have a CAD like format and editor that could produce highly accurate vectors with fewer points - something that could even be exported to a CAD format like DXF and be usable right from loading in a CAD program. However, we'd have to look at the user benefits of spending time on this new control and format (how many users actually need a CAD level of detail - as opposed to the large number that might be fine with an Ink "sketch" - something that would be close to useless in a CAD program).

    Because of the way the Ink control is built adjusting a stroke after it has already been made (besides erasing) is currently troublesome. However, it would be relatively easy to add a mode in which we scribble a placeholder stroke to the Ink while the user is drawing it, and then pass the collected points to a custom function to handle the generation of the desired Ink stroke after the fact... however, the line tool and stencil features might remove the necessity.

    On the generated background question - we support grid and lined "paper" - and have a currently unexposed signature line background - all of these are written through an internal Ink api so a custom background could be done. What is the background you want? If it is more image then vector we do support custom image backgrounds.

    It would be nice to know what specific use cases for ink beyond handwriting/sketching you are thinking of.

    Eavan Chambliss
    Last edited by Eavan Chambliss; 12-19-2015 at 04:52 PM.

  4. #4
    Member jhackney's Avatar
    Real Name
    James S. Hackney
    Join Date
    Oct 2006
    Location
    Houston
    Posts
    111

    Default Re: Ink Control Capabilities

    Eavan, thanks for your response. When I first tried out the ink control all sorts of ideas popped into my head besides it's intended purpose. For it's intended purpose, as is, I will probably never use. Below are a couple of cases I could think of for sketching:
    1. Reviewing someone else's drawing/mock-up in SVG or whatever graphical format they export it as from the authoring application. The graphic would be dynamically populated in the background (why SVG would work best) and then the user could approve or mark-up the graphic (foreground) were changes should be made. The original graphic plus the markup could then be merged and either saved or emailed to author.
    2. As a general stencil/diagram control for creating documents like an organization chart where the shapes are simple and uniform.
    3. As a general stencil/diagram control for creating documents like a football, soccer, or basketball play. Being able to manipulate the drawing programmatically would be key to producing professional results since you could ensure the shapes conformed to specific rule set.
    4. As a tool that teaches children to write letters or words were the letter/word is programmatically drawn for the child and the child uses the control to trace the letter/word. Data out would determine if the child successfully traced the letter/word.


    Anyway those are my thoughts. The most important aspect to me would be to retrieve the drawing data no matter what form it is in so the points can be manipulated, converted, analyzed, or utilized in some other manner. FYI, every graphic I use in my web applications are SVG unless there is a good reason not to.
    Thanks,
    James

  5. #5
    Alpha Software Employee Eavan Chambliss's Avatar
    Real Name
    Eavan Chambliss
    Join Date
    Aug 2005
    Posts
    23

    Default Re: Ink Control Capabilities

    James,

    Thanks for the input. For 1 and 4 I think that should be able to be done with Ink with a SVG background (which should currently work). For 1 you can convert the Ink into SVG to overlay the document that has been marked up. For 4 the ink point data could be inspected directly to get the strokes. For 2 and 3 the question becomes if Ink wants to be used at all, or whether something more CAD like would be useful. Ink could be made to include "stamps" - paths that get stamped down at a given location and then get turned into many point strokes - this would allow for freehand drawing to be done around these stamps. The other option would be a CAD like format where the diagram parts (shapes in a flow chart for example) are nothing more then a location, scale, rotation and assorted symbol data (like draw a diamond with a circle inside it at that location). If you don't need the freehand, this would be the better solution, as the data could be both terse and more accurate (Ink is integer based so you can't have a decimal ink location) - also the option for real world coors.

    Eavan

  6. #6
    Member CarlMPearson's Avatar
    Real Name
    Carl M. Pearson
    Join Date
    Nov 2009
    Location
    Dallas, TX
    Posts
    270

    Default Re: Ink Control Capabilities

    I'm trying to determine if an INK is empty or has been signed.
    Then I can lock down some values that can no longer be modified without erasing the signature.

    A getValue on the control does not return characters, nor can I determine its length or size.
    How best to determine if the control is occupied?
    Ink_Signature is Control Type INK and a type of Character.

    These return a zero length string and a len of zero.
    Think: signatureIsEmpty for Ink.

    var ink = {dialog.Object}.getValue('Ink_Signature');
    var len = ink.length;

    alert('Ink:' + len + ' ('+ink+')');

    ================ Revised ========================

    AutoCommit Checked.

    Now I get a few hundred characters when empty, but a lot more when signed. I can pick an arbitrary length above the "null" length of 273 characters (for my config of ink) and do what I need, but this is less than clean.

    How about an "inkIsEmpty" function?
    Last edited by CarlMPearson; 01-07-2016 at 07:19 PM. Reason: Check AutoCommit
    Carl ~ Dallas, TX
    I'm so old that pool balls came with Roman Numerals

  7. #7
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    385

    Default Re: Ink Control Capabilities

    Quote Originally Posted by CarlMPearson View Post
    I'm trying to determine if an INK is empty or has been signed.
    Then I can lock down some values that can no longer be modified without erasing the signature.

    A getValue on the control does not return characters, nor can I determine its length or size.
    How best to determine if the control is occupied?
    Ink_Signature is Control Type INK and a type of Character.

    These return a zero length string and a len of zero.
    Think: signatureIsEmpty for Ink.

    var ink = {dialog.Object}.getValue('Ink_Signature');
    var len = ink.length;

    alert('Ink:' + len + ' ('+ink+')');

    ================ Revised ========================

    AutoCommit Checked.

    Now I get a few hundred characters when empty, but a lot more when signed. I can pick an arbitrary length above the "null" length of 273 characters (for my config of ink) and do what I need, but this is less than clean.

    How about an "inkIsEmpty" function?
    Hello Carl!

    With AutoCommit checked, the ink control should be flagged as dirty whenever edits have been made to the control. You can call {dialog.object}.getControlDirty('NAME_OF_INK_CONTROL') to determine if there have been edits.

    Is this sufficient for your needs?
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  8. #8
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    385

    Default Re: Ink Control Capabilities

    Quote Originally Posted by CarlMPearson View Post
    I'm trying to determine if an INK is empty or has been signed.
    Then I can lock down some values that can no longer be modified without erasing the signature.

    A getValue on the control does not return characters, nor can I determine its length or size.
    How best to determine if the control is occupied?
    Ink_Signature is Control Type INK and a type of Character.

    These return a zero length string and a len of zero.
    Think: signatureIsEmpty for Ink.

    var ink = {dialog.Object}.getValue('Ink_Signature');
    var len = ink.length;

    alert('Ink:' + len + ' ('+ink+')');

    ================ Revised ========================

    AutoCommit Checked.

    Now I get a few hundred characters when empty, but a lot more when signed. I can pick an arbitrary length above the "null" length of 273 characters (for my config of ink) and do what I need, but this is less than clean.

    How about an "inkIsEmpty" function?
    Hello Carl!

    I spent some more time on this for you. Checking if the control is dirty doesn't exactly tell you if the ink control contains any strokes.

    If there are any strokes in the ink control, the getValue() method returns them listed at the end of the ink value after the json settings. You can parse this value to determine if the these strokes exist:

    Code:
    function isInkEmpty (inkCtrl) {
        var empty = true;
    
        // get ink value
        var ink = {dialog.object}.getValue(inkCtrl);
    
        if (!ink) {
            // no data from getValue; return empty
            // could also return something else to indicate than the inkCtrl didn't exist...
            return empty;
        }
        // find starting position where ink stroke data should be if it exists
        var pos = ink.lastIndexOf("%json%") + 6;
    
        // get the stroke information - could be empty
        var strokes = ink.substr(pos);
    
        // remove all whitespace (empty state could have a newline character in it)
        strokes = strokes.replace(/\s/g,"");
    
        // get the length; will be zero if no strokes.
        var hasStrokes = strokes.length > 0;
        
        if (hasStrokes) {
            empty = false;
        }
    
        return empty;
    }
    For the ink data itself, the ink control has a data property. You can get the ink control using the {dialog.object}.getControl('CONTROL_NAME'). Inside the data property are several member items that contain information such as the state (data.state), points (data.pts), and strokes (data.strokes) in the ink control.

    Code:
    var inkCtrl = {dialog.object}.getControl('INK_CTRL');
    
    // dump ink data to the console window
    console.log(inkCtrl.data);
    If auto commit is turned off, you will need to check the length of the data.strokes property to determine if the ink control is empty rather than using the getValue() method of the UX component.



    A question for you:

    What is your use case for using the ink control that you need to know if it contains any strokes? From the way you phrased your question, it sounds like you're trying to get signatures? Why are you using the ink control rather than the signature capture control?
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  9. #9
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    385

    Default Re: Ink Control Capabilities

    Hello Everyone!

    A new method has been added in the next release of the Beta:

    {dialog.object}.inkIsEmpty(ControlName)

    This method will return a boolean true/false value indicating whether or not an ink control is empty. Example

    Code:
    var empty = {dialog.object}.inkIsEmpty('Ink1');
    if (empty) {
        alert("Ink1 is empty.");
    } else {
        alert("Ink1 is not empty.");
    }
    The inkIsEmpty method will be available in tomorrow's build.
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  10. #10
    Member CarlMPearson's Avatar
    Real Name
    Carl M. Pearson
    Join Date
    Nov 2009
    Location
    Dallas, TX
    Posts
    270

    Default Re: Ink Control Capabilities

    I wanted to get comfortable with INK as I eventually intend to use it for annotation of photos and drawings.
    Signature capture is a byproduct or alternate use.

    Once a signature is captured, I lock important controls whose value should never change once approved.
    Right now a length over/under 300 length is good enough. Crude, but effective.

    Next challenge ... showing the INK in a grid or PDF report.

    I'm using the last release with Feature Pack numbers I got when I was at the Conference in Boston so I'm not totally legit.

    I'm looking forward to the next release with the cool stuff for tablets.
    Last edited by CarlMPearson; 01-15-2016 at 12:26 PM.
    Carl ~ Dallas, TX
    I'm so old that pool balls came with Roman Numerals

  11. #11
    Member CarlMPearson's Avatar
    Real Name
    Carl M. Pearson
    Join Date
    Nov 2009
    Location
    Dallas, TX
    Posts
    270

    Default Re: Ink Control Capabilities - INK in a LIST?

    I have latest developer and server installed. 2999_ 4519 and the license is current.

    I need to put an INK control in a LIST on a Web UX.

    Selwyn has a video that shows an INK control, but my developer does not. See images.

    http://www.ajaxvideotutorials.com/V1...mview_ink2.swf

    I have INK as a control and using it on tablets, but not in the List_Builder. I have collected 1,000s of inks and now time to display them.

    Is this a feature only in the yet-to-be-released TABLET version? Am I missing a Feature Pack? I have a Feature Pack for the Ink control installed.
    Attached Images Attached Images
    Carl ~ Dallas, TX
    I'm so old that pool balls came with Roman Numerals

  12. #12
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    385

    Default Re: Ink Control Capabilities - INK in a LIST?

    Quote Originally Posted by CarlMPearson View Post
    I have latest developer and server installed. 2999_ 4519 and the license is current.

    I need to put an INK control in a LIST on a Web UX.

    Selwyn has a video that shows an INK control, but my developer does not. See images.

    http://www.ajaxvideotutorials.com/V1...mview_ink2.swf

    I have INK as a control and using it on tablets, but not in the List_Builder. I have collected 1,000s of inks and now time to display them.

    Is this a feature only in the yet-to-be-released TABLET version? Am I missing a Feature Pack? I have a Feature Pack for the Ink control installed.
    Hello Carl,

    The Ink control is part of the feature set available in the Tablet Beta, which was first introduced about the same time as Build 2999_4519. Beta features are constantly under development and improvements are being made daily. These beta features include rich data including ink, audio and video; ViewBoxes; FormViews; and Editors and Editor Sets.

    The Ink data type for Lists was introduced in a beta build released sometime after Build 2999_4519.

    You can download the install for the current beta version of Alpha Anywhere here: http://www.alphasoftware.com/tablet/beta/install.asp
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  13. #13
    Member CarlMPearson's Avatar
    Real Name
    Carl M. Pearson
    Join Date
    Nov 2009
    Location
    Dallas, TX
    Posts
    270

    Default Re: Ink Control Capabilities - INK in a LIST?

    I was at DevCon 2015 and put in a Feature Pack for Ink and it came alive (but apparently just partially) on 2999-4519.

    Tablet was to be a release version "Shortly" and it is 5-6 months later and still in Beta. Grrr.

    The customer won't allow a Beta as the system is very much in use ... and I agree.

    But the question is answered, nonetheless. Thanks.
    Carl ~ Dallas, TX
    I'm so old that pool balls came with Roman Numerals

Similar Threads

  1. Displaying and Capturing Ink using the Ink Control
    By Beta Spark in forum Tablet-Optimized Form Capabilities Beta
    Replies: 2
    Last Post: 10-06-2016, 09:58 AM
  2. Ink Control Background Color and image not working?
    By pcaspa in forum Tablet-Optimized Form Capabilities Beta
    Replies: 1
    Last Post: 11-10-2015, 04:46 PM
  3. Ink Editor Overlay Not Populating
    By WebDesignShop in forum Mobile & Browser Applications
    Replies: 0
    Last Post: 10-16-2015, 11:04 AM
  4. Introduction to the Ink Control
    By Beta Spark in forum Tablet-Optimized Form Capabilities Beta
    Replies: 0
    Last Post: 09-15-2015, 04:26 PM
  5. ActiveX, Ink Paint.
    By wburchell in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 06-27-2011, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •