DrawImage(D3nfb)
DrawImage --
NFB routine to draw a pixmap in a region of a window
Synopsis
#include "nfbWinStr.h"
void xxxDrawImage (
BoxPtr pbox,
void *image,
unsigned int stride,
unsigned char alu,
unsigned long planemask,
DrawablePtr pDraw);
Description
DrawImage
draws the pixmap pointed to by image
in a rectangular region of the specified window.
Arguments
The arguments are:
pbox
-
describes the rectangular area
in which the image should appear in the frame buffer.
pbox
points to an X structure called a
BoxRec(D4nfb)
where the last pixel of the image should appear.
This means that the pixel width
can be determined by subtracting x1
from x2
and the height by subtracting y1
from y2
.
This is how the X server deals with rectangular coordinates
at the lowest level.
Your Link Kit driver will never have to deal
with situations where the rectangle's width or height
are less than or equal to zero
so it is not necessary to add code
to check these values.
image
-
points to the actual image data
that must be copied into the frame buffer.
If you are writing an 8-bits-per-pixel driver,
then this
void *
is actually an
unsigned char *
.
If you are writing a 16-bits-per-pixel driver,
then this void *
is actually an
unsigned short *
.
If you are writing a 24-bits-per-pixel driver,
then this void *
is actually an
unsigned int *
.
image points to a contiguous chunk of memory
that is stride x pixel width in size.
stride
-
is the memory offset in bytes
between two rows in
image
memory.
See
``stride'' in Developing NFB graphics adapter drivers.
alu
-
is the raster bit operation
that is to be applied when mixing
the
image
with the contents of the frame buffer.
See
``alu'' in Developing NFB graphics adapter drivers.
planemask
-
contains a value that determines
which frame buffer planes get modified
when drawing this image.
If a bit is set, the plane will be modified.
If no bits are set, the plane will not be modified.
Almost all X drawing operations use a
planemask
that specifies modification of all planes.
pDraw
-
pointer to an X structure called DrawableRec.
This pointer is used only to access
your Screen Private data.
The ScreenRec structure is pointed to
by
pDraw->pScreen
.
Your Screen Private hangs off the bottom of ScreenRec.
Exit codes
None
Usage
Driver writers must supply this routine for their drivers.
The xmkddx utility creates a skeleton in the
driver's xxxImage.c file
that is pointed to by the
nfbWinOps(D4nfb)
structure.
The driver writer must add code to implement
the capabilities of the graphics adapter hardware.
Note that different functions are required
to support depths 1, 2, 4, 8, and 16.
Note the following:
-
DrawImage( )
needs to be able to draw a rectangular area
on the screen, applying the given
alu and planemask; see
``alu'' in Developing NFB graphics adapter drivers.
You will probably need to set up a static table
of size 16 that takes the alu value
as an index and returns the actual value required
by the hardware. See
``alu'' in Developing NFB graphics adapter drivers.
-
The sample driver uses C defines
to create a series of macros
that will be used extensively to set the planemask value,
the alu value,
the various drawing command registers,
the drawing coordinates, and so forth.
You should attempt to use a similar paradigm in your driver
to map the alu functions (especially
GXcopy, GXxor, and GXinvert
to the adapter's operations.
-
Once
DrawImage( )
has been written, it may be possible to
run the X server in an almost usable manner.
The cursor code leave tracking on the screen,
and expects
ReadImage(D3nfb)
to be correctly implemented,
but otherwise you should be able to start X clients
and see their output on your graphics adapter.
Version applicability
This function is supported for NFB drivers
on all releases of SCO OpenServer 5, SVR5, and AIX 5L.
Source files
Driver source file-
xxxImage.c
Defined in-
nfbWinOps structure in xxxData.c
Prototyped in-
xxxProcs.h
References
nfbWinOps(D4nfb)
Examples
See the example in the nteImage.c file.
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005