The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

JOT - Parses the JOT specification for Ink Storage and Interchange Format

SYNOPSIS

use JOT;

$jot = JOT->new();
$jot->parse_file( $ARGV[0] );

@array = $jot->coords();
while ( @array ) {
	printf("(%d, %d)\n", shift @array, shift @array );
}

DESCRIPTION

JOT is a specification for ink storage. JOT was the proposed standard to use when a browser implements the scribble input field ( <input type="scribble"> ). The JOT specification did not make it into the definitive HTML3 spec, but you can still find some references to it in the proposed HTML3 standard from the W3C.

The only broser I'm aware of that implements this format is Xmosaic.

Because JOT is a lightweight format, it is very interesting to use it on small devices like a PDA. The Avantgo browser for the PalmPilot implements the scribble input tag.

JOT is also interesting because it stores an image as a 2D vector format with timely information. It does not only record the coordinates of the lines that a person draws on a tablet, but also records the speed, pressure, etc .... of the pen on the tablet. This can come handy in recognizing signatures or handwrite recognition.

COMPATIBILITY

This implementation only supports INK_BUNDLE_RECORD, INK_PENDATA_RECORD and INK_END_RECORD. It also does not use any of the Bundle Flags and assumes a compaction type of 1. This is sufficient to parse the Avantgo implementation of JOT.

USAGE

parse_file $file

Parses a JOT file, returns an reference to an array that contains the records:

$struct = $jot->parse_file( "./test.jot" );
# $struct->[0] contains the INK BUNDLE RECORD
# $struct->[1..n-1] contains the INK PENDATA RECORDS
# $struct->[n] contains the INK END RECORD

INK BUNDLE RECORD:
	$struct = {};
	$struct->{"TYPE"} 				= INK_BUNDLE_RECORD;
	$struct->{"LENGTH"}
	$struct->{"VERSION"}
	$struct->{"COMPACTIONTYPE"}
	$struct->{"PEN_UNITS_PER_X"}
	$struct->{"PEN_UNITS_PER_Y"}

INK PENDATA RECORD
	$struct = {};
	$struct->{"TYPE"}
	$struct->{"LENGTH"}
	$struct->{"ORIGIN_X"}
	$struct->{"ORIGIN_Y"}
	$struct->{"WIDTH"}
	$struct->{"HEIGHT"}
	$struct->{"DATA_X"}	= [];
	$struct->{"DATA_Y"}	= [];

INK END RECORD
	$struct = {};
	$struct->{"TYPE"}	= INK_END_RECORD;
	$struct->{"LENGTH"}	= 0;

parse_string $string

Parses a JOT stream in a string. Handy for doing JOT parsing from a submit. Please note: Avantgo submits the scribble field as Base64 encoded.

coords

Returns the all the coordinates from a JOT file. This is a convenience function and can be used to easily implement a JOT to PNG tool.

HISTORY

8 November 2000 : First release 30 May 2001 : Adapted for release on CPAN

THANKS

Thanks go to Avantgo, http://www.avantgo.com for supporting the scribble field. Thanks go to David Williams, who was kind enough to tell me Avantgo uses. JOT as their scribble format.

AUTHOR AND COPYRIGHT

Johan Van den Brande <johan@vandenbrande.com>, http://www.vandenbrande.com/

Copyright (c) 2000-2001 Johan Van den Brande. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License, distributed with Perl.

VERSION

VERSION 0.01