File: devguide-2.html

package info (click to toggle)
skencil 0.6.17-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,136 kB
  • ctags: 8,589
  • sloc: python: 36,672; ansic: 16,571; sh: 151; makefile: 92
file content (96 lines) | stat: -rw-r--r-- 4,440 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<html>
<head>
<title>Developer's Guide: The Design of Skencil</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-1.html">Introduction</A></TD>
<TD ALIGN="center"><A HREF="devguide.html">Developer's Guide</A></TD>
<TD ALIGN="right"><A HREF="devguide-3.html">General Remarks</A></TD>
</TR>
</TABLE>
<HR NOSHADE>
<H1><FONT face="Helvetica,Arial"><A NAME="N1"></A>The Design of Skencil</font></H1>
<P>Skencil is written almost completely in Python, an object oriented
interpreted programming language. Python can easily be extended by
modules written in C to increase performance and Skencil uses this fact
to implement some time critical functions and Python objects in C.</P>
<P>The source code of Skencil can be divided roughly into these parts:
<DL>
<DT><B>User Interface</B><DD>
<P>Skencil currently uses the Tk Toolkit via
the Tkinter module from the standard Python library. Skencil
only uses some generic widgets like buttons, menus and
scrollbars and none of the more sophisticated widgets like Tk's
Text or Canvas widgets. The main widget where the drawing is
displayed is a Tk widget that is almost entirely implemented in
Python using a C-module that provides GCs, Pixmaps, Fonts etc as
Python objects (This module is heavily based on the Xt module).</P>
<P>Skencil also has some classes that provide a more abstract
interface to generic GUI elements like buttons and menus that
hopefully make it relatively simple to switch to another
toolkit. In fact I already switched toolkits once, from
Xt/Athena to Tk, which was simpler than I had expected...</P>

<DT><B>Graphics Devices</B><DD>
<P>Skencil defines several classes for
drawing into a window or into a PostScript file that share a
common, generic interface. This allows us to use the same code
for drawing on the screen and for printing.</P>

<DT><B>Document- and Graphics Objects</B><DD>
<P>These objects represent
entire documents and the parts thereof in an abstract way. This
representation is independent of any particular output device or
operating system.</P>

<DT><B>File IO</B><DD>
<P>Skencil has classes and functions for reading
drawings in several formats (well, just three as of this
writing). Skencil of course defines its own special format and
can read and write this. In addition, there is currently partial
support for reading and writing SVG and Adobe Illustrator (AI)
files, just to name a few.</P>
<P>For reading bitmap graphics Skencil uses the Python Imaging
Library so that it should be able to read everything that this
library can read.</P>

<DT><B>Miscellaneous</B><DD>
<P>There are a variety of support modules that provide objects
representing 2D points/vectors, rectangles, affine
transformations, fonts and font-metrics, or code to handle
postscript files and a generic <A HREF="devguide-26.html">method
passing mechanism</A>.</P>

</DL>
</P>
<P>Skencil uses a variation of the model/view/controller concept. The
document and graphics object classes form the model which represents the
drawing in a device independent way and which can be manipulated through
a specific set of methods. The class <tt>SketchCanvas</tt>
serves both as the main view and controller. It manages a window
graphics device that is used to display that drawing and it accepts user
input in the form of mouse and keyboard events and translates them into
method invocations on the document object.</P>

<HR NOSHADE>
<TABLE WIDTH="100%">
<TR>
<TD ALIGN="left"><A HREF="devguide-1.html">Introduction</A></TD>
<TD ALIGN="center"><A HREF="devguide.html">Developer's Guide</A></TD>
<TD ALIGN="right"><A HREF="devguide-3.html">General Remarks</A></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>