About me

Vladimir Nabokov

Books
Programming
Biochemistry
Aim | Communicate

Search
 


 
   
Letters from Terra - Life in water warmed by sunlight
 
 

     
 
 

     
Canvas 2.4 in action, editting a PCX file. Click to Download the image editor.
 
 
     

Canvas 2.4 and 2.6

One of ythe major obstacles that I encountered when starting my forrays into graphical programming was the difficulty of getting images into the engine, particularly from external sources such as the internet. The complete inpenetrability of most of the commonly used image formats, with BMP files being almost as complex as GIF and JPG, procludes the less experienced programmer, or even those with no knowledge of the established formats, of ever being able to include high quality images editted externally. One of my first projects, therefore, was the construction of an image editor that would store images in my own simple IMG format whilst allowing conversion from easily available fomats, in this case PCX files. The IMG format is simple in the extreme: it essentially consists of an identifyer byte, followed by the dimensions of the image, after which the data is stored in a continuous stream. PCX files can be loaded into the editor, converted to a different palette, and then saved in this format which contains no palette information. The advantage of this is that the all the images that are to be displayed together can be converted to a common palette with minimal loss of definition, and much of the complexity of dealing with different palettes at run time is abolished. The raw images can be editted, cut up, and new colours introduced in the editor, and the palette saved seperately as a PAL file. IMG files are then the basic currency of all my graphical units, including the 3D engine and most of my major projects; PAL files can be similarly loaded into the graphics unit as variables, and altered at will to allow fading and similar effects. The simplicity of the editor rather makes a detailed tutorial obselete, but a simple list of controls and demonstration is given with the downloadable archives. Canvas is one of my oldest programming tools, and has been invaluble for the four or so years I've been using it. Personally, I find the controls intuitive and easy to use, having optimised them over the years to allow greatest ease of use; you may beg to differ, but I maintain that Canvas is one of the simplest image editors around. The source is straitforward and can easily be editted by anyone proficient in Pascal, allowing the controls to be changed, the file format to be altered and even extra features to be reasonably easily added. The two versions of Canvas are for use at different resolution: Canvas 2.4 is used for editting images that are meant for display in MCGA (320x200x256) mode, where are version 2.6 caters for those that are meant to be shown at high resolution SVGA (640x480x256); this is purely to allow some sense of proportion to be maintained when the images are being manipulated: the formate used is exactly the same. The only current limitation on the format is the necessity of maintaining the iamge area below 65,536 pixels, in order to allow the image to be loaded into a single segment of memory: this is no obstacle in the case of version 2.4, but is something that must be borne in mind when the later version is employed. Both editors use the corresponding mouse unit, some simple fonts, but rely entirely upon conventional memory, making the code relievingly simple. Each editor is available for download with full source, and simple instructions. It would be very pleasing if my little creation could be of use to someone else- Jon

Download Canvas 2.4 (101 Kb, zipped) | Back to Units & Tools |
Download Canvas 2.6 (111 Kb, zipped)

 
 
Letters from Terra | Updated 15th December 2004 | By Jonathan Ayling