Pocket Notes file handler PHP library

The latest version of this library is 0.1, it can handle apn file format version 1, 2 and 3.
The library can be downloaded at the Downloads section.

The library contains one file only: PocketNotes.php. To install it, simply copy this file into the directory of the script from where you want to use it from. You have to load it into every script from where you want to use it from:

require_once("PocketNotes.php");

The format of the loaded notes:

The library stores a loaded note in an array, which array has elements which are also arrays. From now the $note array will be a note:

$note["parameters"] - The parameters of the note. This is an array. It's elements are:

$note["parameters"]["width"] - The width of the note

$note["parameters"]["height"] - The height of the note

$note["parameters"]["paper_color"] - The color of the paper

$note["parameters"]["pattern_color"] - The color of the patterns

$note["parameters"]["pattern_size"] - The vertical distance of the patterns

$note["parameters"]["pattern_width"] - The horizontal distance of the patterns

$note["parameters"]["paper_type"] - The type of the paper

$note["properties"] - The Properties of the note. This is an array.

The keys of the array are the Property names, the values are the Property values.

$note["elements"] - Draw elements of the note (currently only inks). This is an array, the elements are the graphic elements of the note. Each element is an array, it's elements are:

$element["type"] - The type of the element (a string, see possible values below)

$element["data"] - The type specific data of the element

$element["pen_width"] - The line-width of the element

$element["color"] - The color of the element. See color format below

$element["marker"] - Was it drawn with a marker pen or not

$element["year"] - The year the element was drawn

$element["month"] - The month the element was drawn

$element["day"] - The day the element was drawn

$element["hour"] - The hour the element was drawn

$element["minute"] - The minute the element was drawn


Possible element types:

"ink" - An ink. The "data" part is an array, which contains the control points of the ink. Each element of the "data" array is 2D point. See 2D point format below.



Format of the colors

A color is an array (from now $color will be a color):

$color["r"] - The red component of the color

$color["g"] - The green component of the color

$color["b"] - The blue component of the color

The components can be 0..255.
You can create a color with the apn_color($r, $g, $b) function.


Format of the 2D points

A point is an array (from now $point will be a point):

$point["x"] - The x coordinate of the point

$point["y"] - The y coordinate of the point

You can create a point with the apn_point($x, $y) function.


Available functions

function apn_load_file($filename)

The $filename is the name of the file to load in the local filesystem. The function loads the note and returns an array described above, or an empty array if there was an error.

function apn_save_file($filename, $note[, $version])

The $filename is the name of the file to save the note in $note to in the local filesystem. The $version parameter is optional, if it is not set, the latest supported version will be used. The functions returns a boolean value which is true if saving was successful.

function apn_save_resource($resource, $note[, $version])

The same as apn_save_file. The difference is that it takes a file handler (eg. the return value of a fopen call) instead of a file name, and it doesn't close this file at the end.

function apn_color($r, $g, $b)

The function creates a color array described above. The $r, $g and $b parameters are the red, green and blue components of the color.

function apn_point($x, $y)

The function creates a 2D point array described above. The $x and $y parameters are the x and y coordinates of the point.



Return to the contents

Valid XHTML 1.0 Transitional Valid CSS! This page was written by Abel Sinkovics up-to-down Magyar Honlap Linkek

Made in Hungary