DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

DrawMonoImage(D3nfb)


DrawMonoImage, DrawOpaqueMonoImage -- draw monochrome image into destination rectangle

Synopsis

#include "nfbWinStr.h"

void xxxDrawMonoImage ( BoxPtr pbox, void *image_src, unsigned int startx, unsigned int stride, unsigned long fg, unsigned char alu, unsigned long planemask, DrawablePtr pDraw );

void xxxDrawOpaqueMonoImage ( BoxPtr pbox, void *image_src, unsigned int startx, unsigned int stride, unsigned long fg, unsigned long bg, unsigned char alu, unsigned long planemask, DrawablePtr pDraw );

xxx is the routine's prefix. Valid values are gen to use the default routine or your driver's prefix if you are rewriting this routine to use the specific capabilities of your hardware.

Description

DrawMonoImage and DrawOpaqueMonoImage draw the monochrome image into the destination rectangle specified by pbox, applying alu and planemask to all writes. The monochrome image is color-expanded so that all 1 bits in the source are drawn with the foreground color specified by fg. For DrawMonoImage, the 0 bits are not drawn. For DrawOpaqueMonoImage, all 0 bits are drawn with the background color specified by bg. The handling of background color is the only difference between DrawMonoImage and DrawOpaqueMonoImage.

Both routines work for 1, 8, 16, and 32 bits-per-pixel hardware.

Arguments

The arguments are:

pbox
pointer to a BoxRec(D4nfb) structure that contains the coordinates for the area of the screen where the bitmap is to be expanded

image_src
a pointer to the contiguous memory that contains the bitmap image to be expanded.

startx
value that defines the first bit in each line of the image that must be drawn. This routine should skip that many bits of the mask at the start of each scan line.

stride
the value in bytes that must be added to the image pointer to move from one line of the image to the next. See ``stride'' in Developing NFB graphics adapter drivers.

fg
color to which a set bit must be expanded before the alu and planemask values are applied.

bg
color to be used when a clear bit is expanded from the bitmap.

Exit codes

None

Usage

DrawMonoImage( ) is used for most text operations. Chips that can docolor expansion of mono images give excellent performance for this routine. DrawOpaqueMonoImage( ) is the same as DrawMonoImage( ) except that the background must be drawn as well. One trick is to essentially execute DrawMonoImage( ) twice: once for the foreground and then again for the background.

startx can be any value, but it will never be greater than the width of the image expressed by (pbox->x2 - pbox->x1).

As an example, if the image data is 3x3 bytes, or 24x3 bits (each bit position is represented by a letter of the alphabet):

   ABCDEFGHIJKLMNOPQRSTUVWX
   ABCDEFGHIJKLMNOPQRSTUVWX
   ABCDEFGHIJKLMNOPQRSTUVWX
The BoxRec contains the values:
       pbox->x1 = 5;
       pbox->x2 = 11;
       pbox->y1 = 1;
       pbox->y2 = 4;
So the width of the rectangle is 6 and the height is 3. startx has the value 5 and stride has the value 4. The final image on the screen should only affect pixels in the area shown below:
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4
   0  . . . . . . . . . . . . . . . . . . . . . . . . .
   1  . . . . . E F G H I J . . . . . . . . . . . . . .
   2  . . . . . E F G H I J . . . . . . . . . . . . . .
   3  . . . . . E F G H I J . . . . . . . . . . . . . .
   4  . . . . . . . . . . . . . . . . . . . . . . . . .
Where the bitmap contains clear bits, the final corresponding screen pixel must be unmodified.

Version applicability

This function is supported for NFB drivers on all releases of SCO OpenServer 5, SVR5, and AIX 5L.

Source files


Routine source
./hw/sco/ports/gen/genMono.c

Driver source file
xxxMono.c

Defined in
nfbWinOps structure in xxxData.c

Prototyped in
xxxProcs.h

References

BoxRec(D4nfb), nfbWinOps(D4nfb)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005