Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > 51f7de0838007e2876221e819c82d833 > files > 583

sketch-0.6.13-2mdk.ppc.rpm

<html>
<head>
<title>Developer's Guide: File Format</title>
</head>
<body bgcolor=white text=black link=blue vlink=navy alink=red>
<TABLE WIDTH="100%">
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
<TR>
<TD ALIGN="left"><A HREF="devguide-26.html">Message Passing</A></TD>
<TD ALIGN="center"><A HREF="devguide.html">Developer's Guide</A></TD>
<TD ALIGN="right"></TD>
</TR>
</TABLE>
<HR NOSHADE>
<H1><FONT face="Helvetica,Arial"><A NAME="N1"></A>File Format</font></H1>

<P>Sketch stores drawings in plain ASCII files using a line oriented
format. The main idea is that each line of an sk file looks like a
Python function call. Originally, this was just for convenience, as the
import filter just had to define all those functions in a dictionary,
and read and (r)eval each line.</P>
<P>That turned out to be quite slow, probably because each line is compiled
to bytecode and then executed just once. Sketch now uses a parser
written in C. This is much faster and doesn't have the potential
security problems of eval.</P>
<P>All function arguments are Python literals, ints, floats, strings
(delimited with single- or double-quotes, the usual \ escapes are
allowed, but no triple quoted strings or raw strings), tuples and lists.
Keyword arguments are also allowed. </P>
<P>Boolean values are represented as the ints 0 or 1.</P>
<P>Colors are represented by float triples describing the RGB values, each
in the range 0..1 (e.g. red (1.0, 0.0, 0.0)).</P>
<P>All sk files start with '##Sketch' followed by two numbers, the major
and minor version number of the file format.</P>
<P>Lines starting with # are comments, empty lines are ignored.</P>


<H2><FONT face="Helvetica,Arial"><A NAME="N2"></A>Overall structure</font></H2>

<P>The first function in an sk-file is always 'document()'. This function
takes no parameters.</P>
<P>The next part defines global parameters like the page layout and objects
like styles.</P>
<P>After this follow the layers from bottom to top.</P>

<H2><FONT face="Helvetica,Arial"><A NAME="N3"></A>Globals</font></H2>

<P>Functions for global parameters:</P>
<P>
<DL>
<DT><B>layout(<i>format</i>, <i>orientation</i>)</B><DD>
<P><i>format</i> is either the name of a predefined paper-format or
a tuple (<i>width</i>, <i>height</i>) in pt. See
Sketch/Lib/pagelayout.py for a list of predefined paper-formats.</P>
<P><i>orientation</i> is 0 for portrait or 1 for landscape.</P>


<DT><B>dstyle(<i>name</i>)</B><DD>
<P>Define the style named <i>name</i> (a string). The preceding
functions define the properties of this style. See the section
on <A HREF="#N8">properties</A> for details.</P>

</DL>
</P>

<H2><FONT face="Helvetica,Arial"><A NAME="N4"></A>Layers</font></H2>

<P>There are three kinds of layers, <EM>normal layers</EM>, <EM>grid layers</EM>
and <EM>guide layers</EM>.</P>
<P>Normal layers and guide layers can contain other objects. All objects
defined after a layer function are part of that layer. A layer is
implicitly closed by another layer function or the end of file.</P>
<P>The layer functions:</P>
<P>
<DL>
<DT><B>layer(<i>name</i>, <i>visible</i>, <i>printable</i>,
	<i>locked</i>, <i>outlined</i>, <i>outline_color</i>)</B><DD>
<P>Start a normal layer named <i>name</i> (a string). The booleans
<i>visible</i>,<i>printable</i>, <i>locked</i> and <i>outlined</i>
determine whether the layer is visible, printable, locked or
only shown outlined.</P>
<P><i>outline_color</i> defines the color used for the outlines of
the objects in the layer.</P>

<DT><B>grid(<i>geometry</i>)</B><DD>
<P>Define the grid-layer. The <i>geometry</i> is a tuple of the form
(<i>xorig</i>, <i>yorig</i>, <i>xwidth</i>, <i>ywidth</i>)</P>

<DT><B>guidelayer(<i>name</i>, <i>visible</i>, <i>printable</i>,
	<i>locked</i>, <i>outlined</i>, <i>outline_color</i>)</B><DD>
<P>Start the guide layer. The arguments are the same as for the
normal layer, but the arguments <i>printable</i> and
<i>outlined</i> will be ignored and set to 0 and 1 respectively.</P>

</DL>
</P>


<H2><FONT face="Helvetica,Arial"><A NAME="N5"></A>Objects</font></H2>


<H3><FONT face="Helvetica,Arial"><A NAME="N6"></A>Primitives</font></H3>

<P>Primitives </P>

<H3><FONT face="Helvetica,Arial"><A NAME="N7"></A>Compound Objects</font></H3>




<H2><FONT face="Helvetica,Arial"><A NAME="N8"></A>Properties
</font></H2>








<HR NOSHADE>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="left"><A HREF="devguide-26.html">Message Passing</A></TD>
<TD ALIGN="center"><A HREF="devguide.html">Developer's Guide</A></TD>
<TD ALIGN="right"></TD>
</TR>
<TR>
<TH ALIGN="left" WIDTH="33%"><img SRC="Images/arrow-left.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Prev"></TH>
<TH ALIGN="center" WIDTH="33%"><img SRC="Images/arrow-up.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Up"></TH>
<TH ALIGN="right" WIDTH="33%"><img SRC="Images/arrow-right.png" WIDTH="16" HEIGHT="16" ALIGN="top" ALT="Next"></TH>
</TR>
</TABLE>
</body>
</html>