iRex DR1000 Merger v0.3

it.andynaz.irex.dr1000.scribble
Class Page

java.lang.Object
  extended by it.andynaz.irex.dr1000.scribble.Page

public class Page
extends Object

Represent a page of scribbles. The scribbles are organized as a list of Stroke objects, which have a list of Stroke.Point objects.

Scribbles are stored in the annotations.data column (see documentation of class ScribbleMgr), as a binary blob with the following structure. The not-used parts are represented in gray (in this case the meaning is not sure) and the bytes in the examples are represented as a couple of hexadecimal digits. Note that the bytes are stored in a reversed order, so that the pair of bytes "01 00" represent the integer 1 (and not 256)

The first 40 bytes are the ones related to the page data:

length type meaning example
2 version 01 00
4 orientation 00 00 00 00
8 page_pixel 00 00 00 00 00 00 00 00
2 page_r 00 00
2 page_g 00 00
2 page_b 00 00
4 ul_x 00 00 00 00
4 ul_y 00 00 00 00
4 lr_x D7 04 00 00
4 lr_y DA 06 00 00
4 int number of strokes A3 00 00 00

Only the last one is actually used, as it indicates the number of strokes in the page.

After that 40 bytes, there is a sequence of 24 bytes representing the properties of a stroke, according to the following schema.

length type meaning example
4 color 03 00 00 00
4 float zoom D7 A0 89 42
4 layer 00 00 00 00
4 shape 00 00 00 00
4 int width 01 00 00 00
4 int number of points 35 00 00 00

After that part, there is a sequence of 12-bytes blocks, each representing a point, according to the following schema.

length type meaning example
4 int x coordinate 48 00 00 00
4 int y coordinate 6C 00 00 00
4 pressure 00 00 00 00

After the sequence of points, another stroke begins (or the end of the blob is reached).

To create a Page object from a blob, use the createSCribblePage method.

Version:
2013-02-22
Author:
andynaz

Field Summary
private  List<Stroke> lStroke
          List of strokes.
 
Constructor Summary
Page()
          Creates a new Page object.
 
Method Summary
 void addStroke(Stroke s)
          Add a stroke.
static Page createSCribblePage(List<Integer> l)
          Create a Page from the blob.
 void drawStrokes(com.lowagie.text.pdf.PdfContentByte cb, float xAdjust, float yAdjust)
          Draw all the strokes of this page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lStroke

private List<Stroke> lStroke
List of strokes. Contains all the strokes in the page.

Constructor Detail

Page

public Page()
Creates a new Page object.

Method Detail

addStroke

public void addStroke(Stroke s)
Add a stroke. The stroke is added only if it is not null.

Parameters:
s - the stroke to add

drawStrokes

public void drawStrokes(com.lowagie.text.pdf.PdfContentByte cb,
                        float xAdjust,
                        float yAdjust)
Draw all the strokes of this page.

Parameters:
cb - the content of the PDF
xAdjust - the parameter to adjust the 'x' coordinates of the strokes
yAdjust - the parameter to adjust the 'y' coordinates of the strokes

createSCribblePage

public static Page createSCribblePage(List<Integer> l)
Create a Page from the blob. This method also creates all the Stroke objects inside the Page.

Parameters:
l - the blob
Returns:
a Page with all the scribbles in the blob, or null if the list l is empty

iRex DR1000 Merger v0.3

© 2013 andynaz - http://andynaz.altervista.org