Generating C++ Modules
The Command Shell
Pixels and Images
Graphics: plots, profiles
Image file I/O
Creating New Modules
Reading/writing image files
Three image file formats are supported for reading: jpeg, tiff, and ppm; mpeg images are read via a server-client architecture.
For each image encoding, there are two read functions: one function that creates a new TBitmapABGR, one function to replace the image inside an existing TBitmapABGR object.
The function screen-copy(nam)creates file nam with a copy of the current imalab-screen, according to the suffix of nam, which must be .jpg or .ppm ; for jpeg-format, an optional second parameter may specify compression (percentage: integer value between 1 and 100). Caution: with some versions of X11 the screen-window must be entirely visible on your display, otherwise a fatal X-error will show up... (should be corrected)
The function write-ABGR(nam,bmp)writes TBitmapABGR bmp into file nam, according to the suffix of nam, which must be .jpg or .ppm ;
The function new-tiff(nam) creates a TBitmapABGR object with the image read from file nam.
The function tiff-load(nam,bmp) loads the image from file nam into the existing TBitmapABGR object bmp, resizing if necessary.
If you want to just have a look at a tiff-image, use the function show-tiff(nam) that displays the tiff-image in file nam on Imalab's screen (and creates the screen if necessary).
Writing tiff files
The function write-ABGR(bmp,nam)writes the TBitmapABGR-image in tiff-format to file nam. A copyright message appears, coming from the tiff-library functions.
April 2003: writing tiff images no longer works because of patent problems (can we still write uncompressed tiff??).
Two functions are analogous to the tiff-functions: new-jpeg(nam) creates a new TBitmapABGR with the image in file nam. jpeg-load(nam,bmp) load image from file nam into the existing TBitmapABGR, resizing when necessary.
Writing jpeg-files will be implemented on demand (needs just to interface the corresponding function in the jpeg-library).
Two functions are analogous to the tiff-functions: new-ppm(nam) creates a new TBitmapABGR with the image in file nam. ppm-load(nam,bmp) load image from file nam into the existing TBitmapABGR, resizing when necessary.
Writing ppm files is implemented via a specific class - example:
tfd = new TBitmapFileDest("filename.ppm");
tfd << bmp:
Details for screen copy
We've tried several X11 functions - and encountered errors we've never understood entirely. The current version of screen-copy just is a compromise that has the advantage to work correctly (though it probably is inefficient).
screen.MakeCopy(0,0); // parameters: border width
copy = new TBimapABGR(screen-width, screen-height,screen.GetCopy());
copy = new TBimapABGR(screen-width, screen-height,screen.CopyData());
We cannot write
because there is no such method.