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

Prototype

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

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

Purpose

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

Description and use

The
FFScan routine outputs an image at 1 bit per pixel, but FFView, the routine to display the image, only deals with images at 1 byte per pixel (because it displays 256 colours images). The only way I found to resolve this format mismatch was to convert the image from 1 bit per pixel to 8 bit per pixel, being 0x00 a black pixel, and 0xFF a white pixel.

This has been an "ought to" decision because DirectDraw makes it easy to deal with 1 byte per pixel representation of raster images, and FFView just makes use of DirectDraw.

(The routine I wrote more than ten years ago to display black & white images from within my old DOS/Clipper apps was by far much more complex than FFView because, to economize extended memory, I had to deal with b&w images at truly 1 bit per pixel and, as you know, the minimum CPU register is 8 bit wide and to work at the bit level you have to shift bits left and right all around).

Specification

The source image to be expanded should stand in a memory area, and a second memory area for the expanded 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 bit per pixel the source image, and 1 byte per pixel the expanded image)

Parameters
  • pointer to the source image memory area (the image at 1 bit per pixel, to be expanded)
  • number of bits of the source image (the product of the width in pixels by the length in lines divided by 8)
  • pointer to the destination memory area (that will accomodate the expanded image)

Return value

None.

Application examples

See also

Notes