Home | David | Projects | Sketch Plugins and Tools |
---|---|---|---|
Updated: 2003-06-23 |
The Sketch vector drawing application is a capable design tool, combining a familiar user interface with the flexibility of allowing extensions and plugins to be written in the Python language. This latter facility is very useful when extending the application's abilities to read information encoded in peculiar file formats through import filters as it allows rapid prototyping and experimentation, generating visible results quickly. Once the information is available to Sketch, the drawings and documents can then be manipulated or stored in convenient formats for future use.
Although the plugin facilities of Sketch are generally useful for interoperability with common document formats, I have a particular interest in reading documents stored in legacy or proprietary formats. This began because I required a degree of interoperability with various closed source applications but was also inspired by a realisation that, should my workstation cease to function, I would be unable to read many of my files on nearby incompatible workstations. Once the immediate danger of that possibility had diminished, and as development of the necessary import filters had reached a level of capability sufficient for my needs, I turned my attention to other formats in which my data was stored.
Two of the most common file formats in the RISC OS world are Drawfiles and Spritefiles. Because these file formats were well supported by their creator through various operating system facilities, many other applications (past and present) rely on data in these formats for display and storage purposes. The use of such file formats as "common currency" conveniently allows us to interpret data from more complex file formats through reuse of appropriate import filters and support libraries.
A good example of a more complex file format, in which some data is stored in its original format within a larger file, is the single file version of the Impression document format. This appears to provide support for only two types of picture format: Drawfiles and Artworks files. Since the Drawfile format allows Spritefiles to be embedded within drawings, they too can be imported into Impression's graphic frames using intermediate Drawfiles created to contain them. More information on the Impression document format, both the single file and directory versions, and their variations, is available on the Impression Documents and Tools page.
At the time of writing there are three filters available for extracting data from RISC OS native document formats: drawinput (for Drawfiles), spriteinput (for Spritefiles) and impressioninput (for various Impression document formats). These filters depend on various libraries for extracting data from common file formats, particularly the drawfile and spritefile modules.
Figure 1 shows an example of the output produced by the drawinput filter for a file containing simple use of text and graphics. Since the underlying feature sets of Sketch and Draw overlap to a great extent, many of the graphics primitives used in Drawfile are relatively straightforward to convert to their Sketch equivalents. However, the use of more complex and less well-documented features such as scaled sprites and text areas will no doubt require more attention and therefore there is room for improvement in the conversion process.
The filter supports the following Drawfile objects:
Figure 1:
A Drawfile containing a number of Sprites of various sizes and colour
depths is rendered by a development version of Sketch (0.7.12).
[Click on the image to see it in more detail.] Linked from: [*] |
Since Sketch is a vector graphics drawing package and cannot perform editing on bitmap images, this filter is of limited use. However, it does perform the useful function of being able to unpack Spritefiles containing multiple images into a single document; this property of Spritefiles can be problematic when working with editors which assume that there is only one image per file.
Figure 2 shows the result of importing a Spritefile into Sketch using the spriteinput filter. The file contains many small images which would be annoying to have to convert and manage individually. At the moment, the spriteinput filter uses a simple tiling algorithm to place as many images on the page while trying to keep the area used a small as possible. In the future, when other more useful tools for manipulating Spritefiles appear, this filter may instead render a sheet of thumbnail images and image names.
Like Drawfiles, the Spritefile format allows for extensions and variations in the description of images. However, where the Drawfile format lends itself to fairly accurate and complete description, the Spritefile format has been modified and extended many times by many parties. It is likely that there are numerous Spritefiles inexistence which will not be interpreted correctly by this filter and its supporting libraries. However, the following features are supported:
Figure 2:
A Spritefile containing several images is rendered by a development
version of Sketch (0.7.12). Since later versions in Sketch's development
branch support image transparency, the sprites retain their masks.
[Click on the image to see it in more detail.] Linked from: [*] |
Because Sketch is a drawing package, mostly oriented around single page documents containing mainly paths and images, rather than formatted text, it is an odd choice as a target platform for multipage desktop publishing documents. However, it is quite straightforward to write import filters for Sketch so, after Draw, it provided me with a convenient focus for experimentation and development of conversion tools. In the longer term, it may be necessary to adapt the import filter to more appropriate software platforms but, for browsing purposes, Sketch is usually adequate.
Due to the substantially more complex nature of Impression documents and the peculiar mixture of high level and low level information they contain, this filter is necessarily less complete than the other filters mentioned above. Without wishing to imply that the majority of features required to accurately render Impression documents are present in this filter, it is perhaps instructive to list the prominent features that are not supported and some restrictions which occur as a result:
Despite all these problems with the filter, a reasonable number of documents can be displayed successfully with Sketch, although there do not appear to be many freely available Impression documents online to test the filter with. Figure 3 shows a page from the book, "First Steps in Programming RISC OS Computers" demonstrating that documents with simple formatting can at least be browsed, even if the conversion to the display format was not completely accurate.
Figure 3:
A page from an Impression document is rendered by a development version
of Sketch (0.7.12). Many features of Impression documents are not yet
supported.
[Click on the image to see it in more detail.] Linked from: [*] |
1.
Martyn Fox, 1993, 2001 (second edition)
Linked from:
[*]