How to Convert VGA Colors to Their Equivalent Gray Scale (50225)
The information in this article applies to:
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
- Microsoft Basic Professional Development System for MS-DOS 7.0
This article was previously published under Q50225 SUMMARY
In Microsoft QuickBasic, VGA colors can be converted to their
equivalent gray scale values using the CALL INTERRUPT statement. This
can be useful when printing an image or having the image scanned by
devices that do not support color.
This procedure can be used to convert a color image to a monochrome
equivalent before printing out the image on a dot-matrix printer.
Once the color registers are converted to their gray scale
equivalents, the original red, green, and blue values are lost. If
this information needs to be restored, the VGA color registers should
be saved before doing the gray scale summing, and then restored
afterward.
This information applies to Microsoft QuickBasic Versions 4.00, 4.00b,
and 4.50 for MS-DOS and to Microsoft Basic Compiler Versions 6.00,
and 6.00b for MS-DOS, and Microsoft Basic PDS 7.00 for MS-DOS.
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | KB50225 |
---|
|