Introduction to Bit-Patterns.

Copyright (c) Susan Laflin. August 1999.

In the very simplest case, the raster terminal is black and white and the picture is defined as bit-pattern text.

Bit-pattern for a character

The binary representation for this character is shown below and, once again, you may compare the output with the bit-pattern in the above figure. If you don't remember the discussion about this type of text, it would be a good idea to re-read this section

		0 0 0 0 0 0 0 0 
		0 0 0 1 1 0 0 0 
		0 0 1 0 0 1 0 0 
		0 0 0 1 1 0 0 0 
		0 0 0 1 1 0 1 0 
		0 0 1 0 0 1 0 0 
		0 0 1 1 1 0 1 0 
		0 0 0 0 0 0 0 0 

However this chapter deals with the more general case where the array containing the bit-pattern is large enough to hold the whole screen (e.g. 1024 x 1024) and the picture is not restricted to a single character.

The next complication is to move to terminals with a larger number of colours. For eight colours there are three bit-planes, each 1024 x 1024 and each pixel position is assigned a number between 000 and 111 binary or between 0 and 7 decimal or octal. The figure below gives a diagrammatic representation of the way in which the value of a particular pixel is read, but this only affects the hardware design and very low-level programming. From now on, it will be treated as though the terminal had one 1024 x 1024 array holding integers in the given range. e.g. 0 to 7 or 0 to 15 or 0 to 255 for the various different terminals or microcomputers.

Pixel Planes.

One possible reason for using this function would be to get the effect of a grey scale picture on a black and white terminal. Here you would be trading a greater number of shades for a coarser resolution, since you would now use a 3x3 block of pixels instead of just one single pixel. There are several possible choices of pattern, but the one shown in the figure below is recommended since it avoids undesirable patterns in the output. There are many uses for this type of "halftoning" or "dot-density" output, especially when you are using a monochrome terminal or expecting output on a cheap black-and-white dot-matrix printer.

Since an array of 1024 x 1024 for each screenful of graphic data involves very large amounts of storage, much thought and ingenuity has gone into methods of compressing the data for long term storage or transmission between installations.

GKS Cell-array Output.

The Cell-array function is the means by which GKS offers a limited amount of image processing. Cell-array is quite satisfactary for an application such as heraldry, but less so for processing of colour photographs.

The parameters for cell-array are:

An array of integers describing the pattern and two integers defining the size of the array. Within the array, one integer value corresponds to each colour and the layout in the array gives the pattern.

World coordinates defining the area onto which the array will be mapped. The first coordinate defines the position of the lower left hand corner of the rectangle and the second the upper right hand corner. The rectangle can only be drawn with its sides parallel to the axes of the world coordinates. When mapped onto the screen (in device coordinates) it must occupy a large enough area for each integer of the array to correspond to at least one pixel. The array may be scaled up from this minimum size by any desired amount.

Example Using Patterns

One application where such patterns could be very useful is in the production of heraldic coats of arms.(If you have never studied this, the book "Simple Heraldry" by Iain Moncreiffe and Don Pottinger gives a light-hearted introduction to the subject together with sufficient information to understand the ideas. Weightier tomes are also available in most libraries).

This form of output requires a number of objects, such as "mermaid", or "book" or "lion rampant" or many others. Each of these can be represented by a pattern defined in a cell array. In describing the coat of arms to be mapped onto the shield, colours are specified and the colour table specifying which shades on the screen should correspond to the numbers in the cell array can be adjusted to fit this description. The required pattern may then be mapped onto the specified area of the shield. Figure a shows the case where the pattern is used to fill the whole shield. Figure b shows the case where the pattern is placed on alternate quarters of the shield and a different pattern may be added in the remaining quarters. Finally a design across one section of the shield may be built up from several copies of the pattern, as shown in figure c. Note that the design is scaled to the shape of the specified rectangle in each case.

Patterns on Shields