FFReduce8bpp1bpp
convert image in memory from 8 to 1 bit per pixel

Prototype

Put the following prototype in the prototypes section of the application program header file:

void ( __stdcall *pfnFFReduce8bpp1bpp)( void*, int, void* );

Purpose

Change the representation in memory of a black & white image from 8 bit per pixel to 1 bit per pixel.

Description and use

Several routines in my DLL deal with black & white images in memory at 1 byte per pixel, being 0x00 a black pixel and 0xFF a white pixel. Although this is a waste of memory it is very handy doing like this.

But when it is time to get a bitmap out of the image at 1 byte per pixel, it is necessary to change its representasion from 1 byte per pixel to 1 bit per pixel.

In the application examples below you will find how to display or print an image in your Borland C++ Builder project using TBitmap and TImage components.

Specification

The source image to be reduced should stand in a memory area, and a second memory area for the reduced image should be allocated before calling this routine. The sizes of the memory areas should be calculated according to the representation of the pixel (1 byte per pixel the source image, and 1 bit per pixel the reduced image)

Parameters
  • pointer to the source image memory area (the image at 1 byte per pixel, to be reduced)
  • number of bytes of the source image (the product of the width in pixels by the length in lines)
  • pointer to the destination memory area (that will accomodate the reduced image)

Return value

None.

Application examples
  • print TIFF files on any printer supported by Windows print several b&w images each contained into a TIFF file compressed CCITT group IV-2d; the example shows how to set up the printer, how to convert the TIFF images into bitmaps in memory, and then how to call StretchBlt to actually print the bitmaps
  • display a TIFF file into a TImage component: the TIFF file should contain a black & white image; use any image to test this example; the example shows how to convert a TIFF image into a bitmap in memory, and then how to display it using TBitmap and TImage components

See also

Notes