Normalized Bitmap Representation -------------------------------- A set of tools for raster graphics have been developed at the C.U.I. of the university of Geneva. All these tools use "image" files that have a specific format for minimal hardware dependency. The idea is that the file should contain information on the number of images it contains, their respective sizes, the number of "planes" (for color images) , etc., so that a C.B.L. program could directly ask for an image without knowing the details of implementation ( the image will be drawn at the current position in the current GraphPort window). The C.B.L. coder should not have to deal with screen coordinates, pixels or so. For this purpose, anchor points can be associated with an image. An anchor point is a specific pixel in a raster image. One can get the position of each anchor point relative to the left-top corner of the image in world coordinates and, thus, easily add line drawing to the raster image without having to rely on pixel coordinates. Anchor points are referred to by a number (1..NbAnchors). Anchor points are supposed to be added in the header of an image file by an interactive tool with which the user can point to the image. Displaying images: ----------------- The tool used to read an existing image file and display images on screen is a unit called "Bitmap" (in bmUnit.text). This unit uses dynamic allocation to load images in memory. There is a procedure to free the memory used by an image that isn't needed anymore. A feature is provided to automaticaly test that an image variable contains a valid information (one cannot ask to display an image on screen before fetching it from disk). For more info on the primitives available in unit "Bitmap", please refer to the beginning of file "bmUnit.text". Adapting images for new machines: -------------------------------- Moving a C.B.L. program using this kind of raster graphics, from a machine to another, would only imply adapting the image files and the "Bitmap" unit to the characteristics of the new machine. For this purpose, a set of tools are needed, mainly: - a format modification tool (for this purpose, the "EdBlock" program developed at U.C.I. has been adapted to N.B.R., and allows modification of byte sex or bit ordering). - a fractional zoom utility (i.e. to transform a 80x40 image into a 64x32 image). This utility also adapts the anchor points to the new dimensions. - an editing facility to correct the rounding errors due to the zoom. Creation of new images: ---------------------- - from a program, by using the unit called "BitmapFiling" (in bfUnit.text). - by using "Picasso", a MS DOS program running on M24 (ATT 6300), using a mouse and very similar to the well known MacPaint program. A specific utility (picasso.code) allows transformation of picasso files to our Normalized Bitmap Representation. - by scanning a picture with the "Iris" software (a DOS program running on M24 connected to a scanner). A specific utility (tif.code) allows transformation of Iris files (when scanning, the user must choose the TIFF uncompressed format) to the NBR. - by creating a text file (i.e. with the standard editor) and browsing it with a dedicated program (shrink.code). For more info. please refer to the comments at the beginning of file Shrink.text. Adding Anchor points to an image: -------------------------------- For the moment, there are two ways of having an image with anchor points: 1) by preparing a text version of it and using the Shrink utility (please refer to Shrink.text for more info). 2) by using the (Edit.code) "bmEdit" utility (please refer to Edit.text for more info). Adaptation of old data files containing images: ---------------------------------------------- Images stored in a data file as a packed array of boolean (like those used in Tribbles) can be adapted to the new format by two utilities: - EdBlock (in EdBlock.code) has been adapted to N.B.R. but still accepts files in the old format. The user is then asked for the size of the images and their number. The output file (if any) is then in N.B.R. - UnShrink (in UnShrink.code) also accepts, as input, both N.B.R. files and old data files. The output file (.text) can be edited if one wants to add anchor points for instance and transformed to N.B.R. file by using the Shrink program. Please note that "UnShrink" cannot handle images larger than 250 pixels wide. Format of "image" files: ----------------------- - a header (512 bytes) containing the following information ( for more details refer to Header.text): . an identification, to make sure the file has the correct format. . the number of images in file . for each image, its width and height in pixels, the number of bits per pixel (i.e. number of bitmap planes), number of anchor points... . the anchor points of the images . the total number of anchor points - the images in a format adequate for the display primitive. For the IBM implementation, the format is the following: the lines of the images start on word boundaries, the first line of the first image starts on first word of the second block of the file (first block is for header). The lines are stored starting from the upmost one. The "planes" are stored one after the other. List of available tools: ----------------------- Units ----- Bitmap (in bmUnit.text): to read image files and display images. BitmapFiling (in bfUnit.text): to create image files BitmapTransformations (in btUnit.text): to modify (zoom...) images. ReadScreen (in rsUnit.text): inverse of DrawBlock, moves part of the screen in a Pascal variable. BitmapUtilities (in buUnit.text): miscelaneous primitives like giving the error message string corresponding to an error number. Programs -------- ConvertTextToBitmap (in Shrink.text): transforms a text representation of images to N.B.R. ConvertBitMapToText (in UnShrink.text): transforms an N.B.R. representation of images to text representation. PicassoFileConverter (in Picasso.text): transforms MS DOS files created by Picasso (these files have a .SCR extension) to N.B.R. EdBlock (in Ed.Pas.text): transforms packed array[ , ] of boolean files or N.B.R. files to N.B.R. files with optional byte flipping, word reversal, byte reversal... For N.B.R. input files, no information is needed. For packed arrays, the user is asked for the size of the images... bmEdit (in Edit.code): interactively picks images from input files and put them in an output file with optional zooming and addition of anchor points. TIFFileConverter (in Tif.text): transforms images files obtained by a scanner with "Iris" software to N.B.R. format. bmEditor (in Editor.text): it is an extension of the bmEdit program whith which the user can also make modifications to the image (e.g. to make slight modifications to an image that has been zoomed, in order to correct some rounding errors).