Photo-InversionThe simplest of Fastgraph's image processing transforms is photo-inversion. A photo-inversion transform replaces each RGB color component in an image with its grayscale opposite (the grayscale opposite of a color component C is 255-C). The resulting image looks like a photographic negative. The fg_photodcb() function applies a photo-inversion transform to a direct color bitmap, so it can only be used when a high color or true color virtual buffer is active. The first fg_photodcb() parameter is the name of the array containing the direct color bitmap to be transformed, and the second parameter is the name of the array that will receive the transformed direct color bitmap (these two parameters can be the same array). The final fg_photodcb() parameter specifies the size of each bitmap in pixels. The code snippets shown here illustrate how we can apply a photo-inversion transform to an 80x50 true color bitmap:
C/C++:
Delphi:
Visual Basic:
Recall that each pixel in a true color bitmap requires three bytes, so the size of each array is 80*50*3 bytes. The fg_photovb() function applies a photo-inversion transform to a rectangular region of the active virtual buffer. The region's lower left corner is at the current graphics position. Like fg_photodcb(), you can only use fg_photovb() with direct color virtual buffers. The fg_photovb() function has two parameters that specify the width and height (in pixels) of the rectangular area to transform within the active virtual buffer. The code snippets shown here illustrate how we can apply a photo-inversion transform to the upper left 80x50 region in the active virtual buffer:
C/C++ and Delphi:
|
 
copyright 2001 Ted Gruber Software, Inc.