Method of gray scaling facsimile images
This is a continuation of application Ser. No. 07/854,158, filed 20 Mar. 1992 now abandoned. 
    
    
     The present invention relates to techniques for displaying facsimile images on low resolution output devices. 
     BACKGROUND OF THE INVENTION 
     In recent years, personal computers and facsimile machines have become nearly indispensable tools to many businesses. In response, numerous companies have developed facsimile machines, hereinafter called fax cards, that integrate with personal computers. When a fax card receives a facsimile transmission, the received image is typically stored in computer memory for subsequent use, such as for display on a display screen or for output on a printer. 
     However, before a computer can display a received facsimile image, two issues related to the present invention must be addressed: (1) to reduce transmission time, most facsimile images are sent in a specially encoded data stream that requires decoding, and (2) facsimile images have a higher resolution than most computer output devices. Thus, one typically must both decode the received image data and reduce its resolution. 
     Beneficially, facsimile transmissions have been standardized by international agreement; currently, most transmissions are per the CCITT Group 3 specification. According to that specification, facsimile images are sent as a sequence of run length encoded data segments organized by horizontal lines that terminate with a special end-of-line (EOL) data sequence. The data segments represent the lengths (in number of picture elements, hereinafter called pixels) of, alternately, the white runs and black runs found in the original image. The encoding scheme, the EOL data sequence, and the scanning of the original are all controlled by the Group 3 specification. In particular, the original is scanned at either 3.85 (course mode) or 7.7 (fine mode) horizontal lines per millimeter (mm), with each horizontal line being 215 mm long and divided into 1728 evenly spaced pixels (other specified lengths and number of pixels are optionally permitted). Importantly, the first data segment sent for each horizontal scan line represents a run of white pixels. 
     As mentioned, in a typically computer/fax card system, a received facsimile image is stored before it is output. To reproduce the original image, the computer decodes the stored facsimile image, reduces its resolution to match the output, and applies the resulting data to the output device for display. Some prior art facsimile image decoding and reduction techniques degrade the image so much that even a small resolution reduction unacceptably distorts the visual image. However, it is known that gray scaling significantly improves the visual image. As used in this description and in the appended claims, &#34;gray scale&#34; refers to a series of at least three achromatic tones ranging between white and black and &#34;gray scaling&#34; refers to the process of producing such gray scale tones. 
     However, gray scaling a facsimile images using low cost computer systems is not usually done. This is believed to be because of the unacceptably slow execution using prior art decoding and gray scaling methods, and because those methods typically require large amounts of memory. Generally, prior art methods first completely decode the facsimile image to its bit-mapped form and then gray scale by processing the decoded bits. Since a bit-mapped representation of a facsimile image is frequently large (say about 0.5 Mbytes), and since gray scaling requires a blending of bits, the prior art methods generally require processing large amounts of data several times, thus the slow execution. 
     It would be advantageous to have a fast method of gray scaling a facsimile image. 
     SUMMARY OF THE PRESENT INVENTION 
     The present invention relates to techniques for converting source run length encoded data--such as facsimile image data according to G3 specifications--into gray scaled data suitable for controlling the intensity of individual pixels of an output device. Given the number and organization of the gray scale data points (one for each pixel) to be produced, the source run lengths are processed by scan lines to create gray scaled values for the data points of a destination (output) scan line. The process entails forming horizontal and vertical scaling factors based upon the resolution of the source image and the gray scaled data points. A conversion vector having entries in a one-to-one relationship with the data points of a destination scan line is initialized. The source run lengths are then sequentially scaled to adjusted run lengths by multiplying each source run length by the numerator of the horizontal scaling factor. The data points that correspond to the beginning and end of the adjusted run lengths are then found, and numerical values are determined and summed into the corresponding entries. The numerical values depend upon the destination resolution, the color represented by the source run lengths, the adjusted run lengths, and where the adjusted run lengths begin and end relative to the other adjusted run lengths. After all of the source run lengths for the scan lines associated with the destination scan line are processed, the conversion vector contains numerical values that range between a smallest value, nominally zero and a largest possible value (VALUE --  OF --  BLACK). The entries of the conversion vector are used to determine individual pixel intensities for a scan line of the output device. Based upon the vertical scaling factor, additional destination scan lines may then be processed. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Other aspects of the present invention will become apparent as the following description proceeds and upon reference to the accompanying drawings, in which: 
     FIG. 1 shows a simplified block diagram of a computer and fax card system suitable for practicing the present invention; 
     FIG. 2 shows the beginning steps, in flow chart form, of a gray scaling program 200 according to the principles of the present invention; 
     FIG. 3 is a continuation from FIG. 2 of the gray scaling program 200; 
     FIG. 4 is a continuation from FIG. 3 of the gray scaling program 200; 
     FIG. 5 is a continuation from FIG. 3 of the gray scaling program 200; 
     FIG. 6 is a continuation from FIG. 5 of the gray scaling program 200; 
     FIG. 7 is a continuation from FIG. 6 of the gray scaling program 200; 
     FIG. 8 is a continuation from FIG. 3 of the gray scaling program 200; 
     FIG. 9 is a continuation from FIG. 8 of the gray scaling program 200; 
     FIG. 10 helps in illustrating the process of gray scaling a scan line of facsimile image data. 
     Note that in the drawings, like references designate like elements. 
    
    
     DETAILED DESCRIPTION OF THE ILLUSTRATED EMBODIMENT 
     The present invention relates to techniques for gray scaling run length encoded image data into data suitable for controlling the individual pixel intensities of an output device, such as a display. While the present invention is beneficially practiced within a system comprised of a low cost personal computer and a commercially available fax card, it is to be understood that the present invention is useful with many other systems; thus, the present invention is to be limited only by the appended claims. 
     A suitable system for practicing the present invention is the simplified system 2 shown in FIG. 1. The system 2 includes a bus 4 which interconnects a central processing unit 6 to a fax card 8. In operation the fax card receives a Group 3 type transmission over a telephone line 10. The received data is beneficially stored in a data file using either a floppy disk drive 12 or a hard disk drive 14 (as controlled by a disk controller 16). When a gray scale representation of the stored facsimile image is to be produced, a gray scaling program (which will presently be more particularly discussed) causes the CPU 6 to convert the stored facsimile image data into gray scaled data suitable for controlling the intensity of individual pixels of a display 18. Of course, other types of output devices are possible. Additionally, the present invention may be used without storing facsimile image data by decoding the image data as it is received. As the system 2 is implemented using a personal computer, also included is a RAM 20, a display card 22, a ROM 24, a keyboard 26, and possibly a printer 28. 
     As mentioned, a gray scaling program controls the processing of the stored facsimile image data into gray scaled data. One embodiment of a gray scaling program is the gray scaling program 200 illustrated in FIGS. 2 through 9, inclusive. Prior to operation of the gray scaling program 200, it is assumed that the number and the organization of the gray scaled data points to be produced is specified. Since the gray scaling program 200 produces data representative of the desired intensity values for individual pixels of the display 18, the number and the organization of the gray scaled data points relate to the number and organization of pixels in the display used to produce the visual image. Specifically, the number of pixels in each display scan line and the number of display scan lines are important. Conveniently, dimensions are specified by the number of items (pixels or scan lines) per unit length. The number of pixels per unit length in each display scan line is referred to as the horizontal resolution of the destination, while the number of scan lines per unit length is referred to as the vertical resolution of the destination. 
     Referring now to FIG. 2, the gray scaling program 200 begins, step 202, and proceeds with the determination of the components of a horizontal scaling factor, step 204. The horizontal scaling factor relates the horizontal resolution (in pixels per unit length) of the destination with the horizontal resolution of the source (usually 1728 pixels). Thus, step 204 is performed by setting: 
     
         HORIZONTAL.sub.-- NUMERATOR=horizontal resolution of destination; 
    
     
         HORIZONTAL.sub.-- DENOMINATOR=horizontal resolution of source. 
    
     It is preferred that both horizontal components are integers less than 256 (and thus can be held in one byte). To achieve this, the components of the horizontal scaling factor are reduced to their lowest common denominator form (LCD). Of course, to obtain both components less then 256, slight modifications to the various resolutions before reduction may be required. 
     With the horizontal scaling factor determined, the gray scaling program 200 proceeds with the determination of a vertical scaling factor, step 206. The vertical scaling factor relates the vertical resolution of the destination to the vertical resolution of the source. Step 206 is accomplished by setting: 
     
         VERTICAL.sub.-- NUMERATOR=vertical resolution of destination; 
    
     
         VERTICAL.sub.-- DENOMINATOR=vertical resolution of source. 
    
     The components of the vertical scaling factor are also preferably reduced to their lowest common denominator form and are also both less than 256. Again, slight modifications of the various resolutions before reduction may be required. 
     After the components of the horizontal and vertical scaling factors are determined, the next step is the determination of the width of the destination output, referred to as DST --  WIDTH, step 208. While the illustrated embodiment has a DST --  WIDTH that corresponds to the number of pixels in a scan line of the display that are used to produce the gray scaled image, other embodiments may have a DST --  WIDTH dependent upon such things as printer pixels or memory assignments. In any event, DST --  WIDTH represents the number of data elements that each source scan line is mapped into. Step 208 is performed by multiplying the width of the original facsimile image (in pixels) by the horizontal resolution of the destination and then dividing that product by the horizontal resolution of the source (together being the horizontal scaling factor). 
     Next, the number of destination scan lines, called #DST --  SCAN --  LINES, is found, step 210. #DST --  SCAN --  LINES represents the number of scan lines used in the display used to produce the visual image. Step 210 is performed by setting #DST --  SCAN --  LINES equal to (1) the height (in scan lines) of the source data times the vertical resolution of the destination (2) divided by the vertical resolution of the source. 
     To assist in decoding and gray scaling, several useful counters are then initialized, step 212. Specifically, a source scan line counter and a destination scan line counter, referred to as SRC --  SCAN --  LINE and DST --  SCAN --  LINE, respectively, are initialized to zero. SRC --  SCAN --  LINE specifies which source scan line is being processed, while DST --  SCAN --  LINE tracks which destination scan line is being gray scaled. After step 212, the entries of a conversion vector are all initialized to zero, step 214. The conversion vector is a vector having entries in a one-to-one relationship with gray scaled data points of a scan line (specifically the display scan line DST --  SCAN --  LINE). In the preferred embodiment the entries of the conversion vector may contain only integers. Next, a variable VALUE --  OF --  BLACK is initialized to zero, step 216. VALUE --  OF --  BLACK stores the largest possible entry is the conversion vector and is updated upon completion of gray scaling of each DST --  SCAN --  LINE (as described below). 
     Referring now to FIG. 3, after step 216 several control variables are initialized, step 218. Specifically, a pointer VECTOR --  POINTER, a variable COLOR, and a counter PARTIAL --  PIXEL --  COUNTER. The VECTOR --  POINTER is a pointer that specifies which entry of the conversion vector can be changed (referred to hereinafter as the active entry). The VECTOR --  POINTER is initialized so that the first conversion vector entry (corresponding to the left most pixel) is active. COLOR is a toggle that identifies the color (either black or white) of the source run length being processed; it is initialized to white. Finally, the PARTIAL --  PIXEL --  COUNTER is initialized to zero. The VECTOR --  POINTER and the PARTIAL --  PIXEL --  COUNTER are related; the PARTIAL --  PIXEL --  COUNTER specifies the degree to which the active entry is affected by processed source run lengths. A PARTIAL --  PIXEL --  COUNTER count equal to the HORIZONTAL --  DENOMINATOR is equivalent to the active entry being completely affected. The use of these control variables will become clearer as the explanation of the gray scaling program 200 proceeds. 
     After step 218, the decoding of a run length of the source scan line specified by SRC --  SCAN --  LINE occurs. Specifically, the next unprocessed source image run length is identified and decoded, step 220. The first run length of SRC --  SCAN --  LINE 0 is decoded in the first pass through step 220. A determination is then made as to whether the decoded run length is truly a run length, or whether it is actually an end-of-line code (EOL), step 222. Assuming that it is a run length, the decoded length is multiplied by the value of the HORIZONTAL --  NUMERATOR to determined an adjusted run length, called ADJUSTED --  RUN --  LENGTH, step 224. A determination is then made, by checking COLOR, as to whether the run length being processed is white (the first run length of each scan line is always white), step 226. 
     If the source run length is white, the position of the beginning of the following black run (run lengths alternate between white and black) is determined per FIG. 4. The determination has two parts, the pixel (or, equivalently, the conversion vector entry)where the following black run begins must be found and how much of that pixel is related to the current white run must be specified. The initial step is to add the value of the ADJUSTED --  RUN --  LENGTH into the PARTIAL --  PIXEL --  COUNTER, step 228. Next, the content of the PARTIAL --  PIXEL --  COUNTER is divided by the HORIZONTAL --  DENOMINATOR to determine a quotient and a remainder, step 230. The quotient represents how many pixels (conversion entries) are spanned by the white ADJUSTED --  RUN --  LENGTH; the remainder represents the degree to which the pixel on which the white run ends is associated with that white run. Thus, to specify the position where the following black run starts, the VECTOR --  POINTER is advanced by the quotient while the remainder is stored in the PARTIAL --  PIXEL --  COUNTER, step 232. After step 232, operation of the program passes to step 272 (discussed in more detail below), shown on FIG. 3. 
     However, if per step 226 (see FIG. 3) it is determined that the source run length is black, the subsequent procedure is somewhat more complicated. Not only must the starting pixel (conversion entry) of the following white run and the degree to which that pixel (conversion entry) is affected by the current black run be found, but numerical values must be determined and added into the entries of the conversion vector associated with the black run. Those numerical values specify the degree to which the black run &#34;spans&#34; each entry. For example, if a black ADJUSTED --  RUN --  LENGTH completely spans a display pixel, a given value (usually the HORIZONTAL --  DENOMINATOR, see below) representing black is added to the conversion vector entry associated with that pixel. If a black ADJUSTED --  RUN --  LENGTH effectively spans only half a pixel, only half of the given value is added to the associated entry. Since, as described below, the entries of the conversion vector are scaled so that 0 corresponds to white and the largest possible entry (VALUE --  OF --  BLACK) corresponds to black, the given number for black is not critical. However, the given number is preferably equal to the value of the HORIZONTAL --  DENOMINATOR since that value is an integer (fast processing) less than 256 (storable in one byte) and is intimately related to divisions of the PARTIAL --  PIXEL --  COUNTER (thus fractional values are avoided). 
     The procedure for processing a black run length after step 226 is shown beginning on FIG. 5. The procedure begins with a determination of a quantity called REMAINING --  VALUE, step 234. REMAINING --  VALUE specifies how much of the active pixel remains to be influenced by the black run. The REMAINING VALUE is set equal to: 
     
         HORIZONTAL.sub.-- DENOMINATOR-PARTIAL.sub.-- PIXEL.sub.-- COUNTER. 
    
     With the REMAINING --  VALUE known, a determination is made as to whether the black ADJUSTED --  RUN --  LENGTH completely spans the remainder of the active pixel, step 236. This is performed by determining if the ADJUSTED --  RUN --  LENGTH is greater than or equal to REMAINING --  VALUE. If only the active pixel is directly affected by the black run, the value of the ADJUSTED --  RUN --  LENGTH is added to the active entry, step 238. The ADJUSTED --  RUN --  LENGTH is then subtracted from the following entry, step 240 (a negative number may result). While the VECTOR --  POINTER must be advanced to perform step 240, the VECTOR --  POINTER is returned so that the active entry is the same as when step 238 was performed. After step 240, the value of the ADJUSTED --  RUN --  LENGTH is added to the PARTIAL --  PIXEL --  COUNTER, step 242. Processing then goes to step 272 (shown on FIG. 3). 
     However, if per step 236 the ADJUSTED --  RUN --  LENGTH is found to affect more than one pixel, the procedure begun on FIG. 6 is followed. A determination is made as to whether the previous white run has affected the active entry, step 244. This is readily performed by checking whether the PARTIAL --  PIXEL --  COUNTER is equal to 0. If the PARTIAL --  PIXEL --  COUNTER is not equal to 0, the previous white run has affected the active entry, and thus that entry must be scaled separately. This scaling is performed by first adding the REMAINING --  VALUE to the active entry, step 246, and then incrementing the VECTOR --  POINTER, step 248. The REMAINING --  VALUE is then subtracted from the new active entry and from the ADJUSTED --  RUN --  LENGTH, steps 250 and 252, respectively, and the PARTIAL --  PIXEL --  COUNTER is then zeroed, step 254. 
     If the PARTIAL --  PIXEL --  COUNTER was equal to 0 in step 244, or after completion of step 254, the PARTIAL --  PIXEL --  COUNTER is equal to 0 (signifying that the active entry has not been affected by the previous white run). The entries affected by the black ADJUSTED --  RUN --  LENGTH are then determined. The first step in this process involves determining, per step 256, the quotient and remainder of: 
     
         ADJUSTED.sub.-- RUN.sub.-- LENGTH÷HORIZONTAL.sub.-- DENOMINATOR. 
    
     The HORIZONTAL --  DENOMINATOR is then added to the active entry, step 258, and the VECTOR --  POINTER is advanced by the quotient, step 260. Referring now to FIG. 7, after step 260 the HORIZONTAL --  DENOMINATOR is subtracted from the new active entry, step 262. The ADJUSTED --  RUN --  LENGTH is then set equal to the remainder (from step 256), step 264, and the new ADJUSTED --  RUN --  LENGTH is added to the active entry, step 266. The ADJUSTED --  RUN --  LENGTH is then subtracted from the next conversion vector entry, step 268. While the VECTOR --  POINTER must be advanced to perform step 268, the VECTOR --  POINTER is returned so that the active entry is the same as when step 266 was performed. After step 268, the value of the ADJUSTED --  RUN --  LENGTH is added to the PARTIAL --  PIXEL --  COUNTER, step 270. Processing then goes to step 272 (shown on FIG. 3). 
     Whether the run length being processed is white or black, program operation eventually passes to step 272 on (FIG. 3). Per step 272, if the processed run was white, the COLOR toggle is switched to black; if the processed run was black, the COLOR toggle is switched to white. Program operation then returns to step 220 for processing of the next run length. Looping through step 220 continues until an end-of-line is found in step 222. 
     When an EOL is detected in step 222, the gray scale program proceeds as using the process illustrated beginning on FIG. 8. First, the VALUE --  OF --  BLACK is updated, per step 274, to: 
     
         VALUE.sub.-- OF.sub.-- BLACK=VALUE.sub.-- OF.sub.-- BLACK+HORIZONTAL.sub.-- DENOMINATOR. 
    
     Since an EOL indicates that a source scan line has been completely processed, the source scan line counter SRC --  SCAN --  LINE is then incremented by 1, step 276. Because several source scan lines may be processed into the same destination scan line, a determination is made as to whether the current destination scan line is complete. To assist in determining this, a value NEW --  DST --  SCAN --  LINE is found, per step 278, using integer arithmetic: 
     
         NEW.sub.-- DST.sub.-- SCAN.sub.-- LINE=SRC.sub.-- SCAN.sub.-- LINE×VERTICAL.sub.-- NUMERATOR÷VERTICAL.sub.-- DENOMINATOR. 
    
     A comparison is then made as to whether the NEW --  DST --  SCAN --  LINE is equal to the DST --  SCAN --  LINE, step 280. If those values are equal, then the destination scan line for the new source scan line is the same as the previous destination scan line (i.e., multiple source scan lines are mapped into the same destination scan line). Thus program operation loops back to step 218 (see FIG. 3) for processing of the next source scan line. However, if the NEW --  DST --  SCAN --  LINE is not equal to the DST --  SCAN --  LINE, it is known that the current destination scan line is complete. In that case, final computation of gray scale values for the individual pixels of the completed destination scan line is performed. First the VECTOR --  POINTER is reset to the first entry of the conversion vector, step 282. Next, a variable PIXEL --  INTENSITY is initialized to zero, step 284. Computation proceeds as shown on FIG. 9. Per step 286 the value of PIXEL --  INTENSITY is updated to: 
     
         PIXEL.sub.-- INTENSITY=PIXEL.sub.-- INTENSITY+active entry value. 
    
     Next, the intensity of the display pixel that corresponds to the active entry is adjusted to a gray scale value based upon the PIXEL --  INTENSITY and the VALUE --  OF --  BLACK, step 288. This is performed by setting that pixel gray scale value proportional to PIXEL --  INTENSITY+VALUE --  OF --  BLACK. The VECTOR --  POINTER is then incremented to make the next conversion vector entry active, step 290. A determination is then made as to whether all of the pixel intensities for the current destination scan line have been gray scaled, step 292. This is readily performed by determining if the VECTOR --  POINTER has incremented beyond the width specified by DST --  WIDTH. If not, program operation returns to step 286 for computation of the gray scale intensity of the next pixel. However, if step 292 indicates that all pixels corresponding to the current destination scan line have been gray scaled, the DST --  SCAN --  LINE is incremented, step 294, and a determination is made as to whether any additional scan lines are to be processed, step 296. This is performed by comparing #DST --  SCAN --  LINES with DST --  SCAN --  LINE. If they are not equal, more destination scan lines are to be processed and system operation loops back to step 214 on FIG. 2. However, if they are equal, no more scan lines are to be processed and the gray scaling program ends, step 298. 
     FIG. 3 helps illustrate the process of gray scaling according to the principles of the present invention. FIG. 3 shows part of one source scan line 300 comprised of 1728 pixels that is to be gray scaled into a destination scan line 302 of to 1296 pixels. Per step 204, after reduction the HORIZONTAL --  NUMERATOR is 3 and the HORIZONTAL --  DENOMINATOR IS 4. Per step 208, the DST --  WIDTH is set to 1296. Since the gray scaling of only one source scan line will be carried out in this example, the vertical elements are not explicitly discussed. The source and destination scan lines, SRC --  SCAN --  LINE and DST --  SCAN --  LINE, respectively, are initialized to zero, step 212, as are all 1296 entries (one for each pixel in the destination scan line) of a conversion vector 304, step 214. The variable VALUE --  OF --  BLACK is also set to zero, step 216. The VECTOR --  POINTER is initialized to the first entry of the conversion vector, the COLOR toggle is set to white, and the PARTIAL --  PIXEL --  COUNTER is initialized to zero, step 218. 
     The first run length of the source scan line 300 is read and decoded, step 220. As shown in FIG. 3, the first run length corresponds to a run of 4 white pixels (W4). Since the first run length is not an EOL (per step 222), the corresponding adjusted run length, ADJUSTED --  RUN --  LENGTH, of 12 is found by multiplying the run length (4) by the HORIZONTAL --  NUMERATOR (3), step 224. Since the COLOR toggle for the first run length is set to white, operation passes from step 226 to step 228 on FIG. 3. 
     Per step 228, the ADJUSTED --  RUN --  LENGTH (12) is added to the PARTIAL --  PIXEL --  COUNTER. The value of the PARTIAL --  PIXEL --  COUNTER (12) is then divided by the HORIZONTAL --  DENOMINATOR (4), step 230. The VECTOR --  POINTER is then advanced by the quotient (3) to make the fourth entry of the conversion vector active, and the value of the PARTIAL --  PIXEL --  COUNTER is set to the remainder (0), step 232. The resulting contents of the first three entries of the conversion vector 304 are thus zero (as shown in FIG. 3). Operation of the gray scaling program proceeds to step 272 on FIG. 3. Per step 272, the COLOR toggle is set to black. 
     Per step 220, the second source scan line run length of 2 is decoded. Since that run length is not an EOL (step 222) the ADJUSTED --  RUN --  LENGTH of 6 is found, step 224. Since the second ADJUSTED --  RUN --  LENGTH is black, system operation passes from step 226 to step 234 on FIG. 5. The REMAINING --  VALUE of 4 is computed per step 234 by setting REMAINING --  VALUE=HORIZONTAL --  DENOMINATOR (4)-PARTIAL --  PIXEL --  COUNTER (0). Since the ADJUSTED --  RUN --  LENGTH (6) is greater than the REMAINING --  VALUE (4) per step 236, system operation passes to step 244 on FIG. 6. Additionally, since the PARTIAL --  PIXEL --  COUNTER equals 0, system operation passes from step 244 to step 256. 
     The quotient of 1 and the remainder of 2 is determined per step 256 from: ADJUSTED --  RUN --  LENGTH (6)÷HORIZONTAL --  DENOMINATOR (4). The HORIZONTAL --  DENOMINATOR (4) is added to the active entry (resulting in 4 in the fourth entry of the conversion vector 304 as shown on FIG. 3), step 258. The VECTOR --  POINTER is then advanced by the quotient (making the fifth entry active), step 260. Per step 262 (see FIG. 7) the HORIZONTAL --  DENOMINATOR (4) is then subtracted from the active entry (resulting in a -4 in the fifth entry) and the ADJUSTED --  RUN --  LENGTH is set equal to the remainder, step 264. The ADJUSTED --  RUN --  LENGTH (now 2) is added to the active entry (resulting in the -2 in the fifth entry of the conversion vector 304 as shown on FIG. 3) and subtracted from the next entry (resulting in the -2 in the sixth entry of the conversion vector 304 as shown on FIG. 3), steps 266 and 268, respectively. The PARTIAL --  PIXEL --  COUNTER is then set equal to the ADJUSTED --  RUN --  LENGTH (2), step 270. Operation of the gray scaling program proceeds to step 272 (see FIG. 3) wherein the COLOR toggle is set to white. The processing of subsequent run lengths on the source scan line 300 results in the conversion vector 304 as shown on FIG. 10. 
     When the EOL is detected in step 222, system operation proceeds as shown on FIG. 8. First, the VALUE --  OF --  BLACK is updated by adding in the value of the HORIZONTAL --  DENOMINATOR (4) per step 274. Note that if multiple source scan lines were processed into the same destination scan line that the VALUE --  OF --  BLACK would be set equal to a multiple of the HORIZONTAL --  DENOMINATOR. The source scan line is incremented (to 1) per step 276, and a NEW --  DST --  SCAN --  LINE is computed using integer arithmetic per step 278 by multiplying the SRC --  SCAN --  LINE by the VERTICAL --  NUMERATOR and dividing the result by the VERTICAL --  DENOMINATOR. Because in the instant example only the processing of one source scan line is discussed, it is assumed that the vertical scaling factor is such that the NEW --  DST --  SCAN --  LINE is not equal to the DST --  SCAN --  LINE (0). Per step 280, program operation then passes to step 282 where the determination of the final gray scale values for the individual display pixels begins. 
     The final gray scale values resulting from the entries of the conversion vector 304 are shown in output vector 306 in FIG. 10. Those values are found by first resetting the VECTOR --  POINTER to the first conversion vector entry, step 282. Next, PIXEL --  INTENSITY is initialized to zero, step 284. Referring now to FIG. 9, the value of PIXEL --  INTENSITY is updated by adding into it the value of the active entry, step 286. The resulting value of zero (both the PIXEL --  INTENSITY and the value of the active entry in the conversion vector 304 are zero) is input as the first entry of the output vector 306, step 288 (it is assumed in the instant example that the final gray scale values are equal to the PIXEL --  INTENSITY, in other applications scaling, such as by multiplying by a constant, may be performed). The second entry of the conversion vector is then made active by incrementing the VECTOR --  POINTER by 1, step 290. Additionally, the active entry of the output vector is also incremented so that the final gray scale value is input to the proper output vector entry. Since the VECTOR --  POINTER has not exceeded the DST --  WIDTH, additional entries of the conversion vector remain to be processed, step 292. The PIXEL --  INTENSITY is then updated for the second entry, step 286. Note that when the fourth entry of the conversion entry is processed, a 4 results in the PIXEL --  INTENSITY and thus fourth entry of the output vector becomes 4. When the fifth entry of the conversion entry is processed, -2 is added to the PIXEL --  INTENSITY (4), resulting in a 2 in the fifth entry of the output vector (and in the PIXEL --  INTENSITY). Subsequent processing results in the values in the output vector as shown in FIG. 3. 
     Eventually, the VECTOR --  POINTER is incremented beyond the DST --  WIDTH and operation passes from step 292 to step 294. A determination is made whether another DST --  SCAN --  LINE is to be formed. Since in the example only one line is processed, the gray scaling program terminates per step 298. The result of the processing of the source scan line 300 is representially illustrated by line 308 of FIG. 3. An output vector entry of 4 causes the associated pixel on the output device to be pure black; this is represented by a black bar which extends to a maximum height. A vector entry of 2 causes the associated pixel to be half-black pixels; this is represented by a black bar that extends to one-half of the maximum height. In the same manner, a 1 causes the associated pixel to be 1/4 black (represented by a black bar that extends to 1/4 of the maximum height). 
     From the foregoing, numerous modifications and variations of the principles of the present invention will be obvious to those skilled in its art. Therefore the scope of the present invention is to be defined by the appended claims.