Home NVDI Programmer's Guide Text Output with Bitmap and Vector Fonts Input Functions

2.12 Raster Operations


2.12.1 COPY RASTER, OPAQUE (VDI 109)

"COPY RASTER, OPAQUE" copies a rectangular raster onto another rectangular raster and performs the specified logic operations. Both rasters must be in device-specific format or they must have only one plane.

If the screen (or the device specified by <handle>) is the source or destination of a raster operation, the MFDB structure element fd_addr should be zero!

The clipping rectangle for the destination raster is enabled only if fd_addr of the destination MFDB is zero.

The source rectangle will not be clipped (it must be within the raster area).

Decl.:  void vro_cpyfm( WORD handle, WORD vr_mode, WORD *xyarr,
                        MFDB *src_MFDB, MFDB *des_MFDB );
Call:   vro_cpyfm( handle, wr_mode, xyarr, &src_MFDB, &des_MFDB );

Variable         Arguments           Meaning
Input:

contrl[0]        109                 vro_cpyfm
contrl[1]        4                   entries in ptsin
contrl[3]        1                   entries in intin
contrl[6]        handle
contrl[7..8]     src_MFDB            pointer to the source MFDB
contrl[9..10]    des_MFDB            pointer to the destination MFDB
intin[0]         wr_mode             logical operation
ptsin[0..7]      xyarr[0..7]         coordinates

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout

Meaning of wr_mode (logical operations):
0:  result=0
1:  result=source and destination
2:  result=source and (not destination)
3:  result=source
4:  result=(not source) and destination
5:  result=destination (!)
6:  result=source xor destination
7:  result=source or destination
8:  result=not (source or destination)
9:  result=not (source xor destination)
10: result=not destination
11: result=source or (not destination)
12: result=not source
13: result=(not source) or destination
14: result=not (source and destination)
15: result=1

Meaning of xyarr:
xyarr[0..3]: coordinates of the source rectangle
xyarr[4..7]: coordinates of the destination rectangle

Note: Usually vro_cpyfm() ignores the height and width of the destination rectangle and uses the size of the source. If you want to scale a bitmap, you have to set the most significant bit in the transfer mode (wr_mode | 0x8000). In this case vro_cpyfm() scales the bitmap according to the size of the destination rectangle. Wheter the driver is able to scale or not is returned by vq_extnd() in work_out[30] (you are only allowed to set the upper bit of the mode if it is able to).

2.12.2 COPY RASTER, TRANSPARENT (VDI 121)

This function expands a monochrome raster (one plane) considering the foreground and background color and copies the raster onto the destination raster using the specified writing mode.

If the screen is the destination raster, fd_addr should be zero!

Decl.:  void vrt_cpyfm( WORD handle, WORD wr_mode, WORD *xyarr
                    MFDB *src_MFDB, MFDB *des_MFDB, WORD *color_index );
Call:   vrt_cpyfm( handle, wr_mode, xyarr, &src_MFDB, &des_MFDB,
                                                 color_index );

Variable         Arguments           Meaning
Input:

contrl[0]        121                 vrt_cpyfm
contrl[1]        4                   entries in ptsin
contrl[3]        3                   entries in intin
contrl[6]        handle
contrl[7..8]     src_MFDB            pointer to the source MFDB
contrl[9..10]    des_MFDB            pointer to the destination MFDB
intin[0]         wr_mode             writing mode
intin[1]         color_index[0]      color index for "black" points
intin[2]         color_index[1]      color index for "white" points
ptsin[0..7]      xyarr[0..7]         coordinates

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        0                   entries in intout

Meaning of xyarr:
xyarr[0..3]: coordinates of the source rectangle
xyarr[4..7]: coordinates of the destination rectangle

Note: Usually vrt_cpyfm() ignores the height and width of the destination rectangle and uses the size of the source. If you want to scale a bitmap, you have to set the most significant bit in the transfer mode (wr_mode | 0x8000). In this case vrt_cpyfm() scales the bitmap according to the size of the destination rectangle. Wheter the driver is able to scale or not is returned by vq_extnd() in work_out[30] (you are only allowed to set the upper bit of the mode if it is able to).

2.12.3 TRANSFORM FORM (VDI 110)

This function transforms a raster from standard format to device-specific format and vice-versa. The transformation can be "in place" which means that both MFDBs point to the same address. In this case transforming a big bitmap takes ages...

Decl.:  void vr_trnfm( WORD handle, MFDB *src_MFDB, MFDB *des_MFDB );
Call:   vr_trnfm( handle, &src_MFDB, &des_MFDB );

Variable         Arguments           Meaning
Input:

contrl[0]        110                 vr_trnfm
contrl[1]        0                   entries in ptsin
contrl[2]        0                   entries in ptsout
contrl[3]        0                   entries in intin
contrl[4]        0                   entries in intout
contrl[6]        handle
contrl[7..8]     src_MFDB            pointer to the source MFDB
contrl[9..10]    des_MFDB            pointer to the destination MFDB

2.12.4 GET PIXEL (VDI 105)

On a device with up to 8 planes (256 simultaneously displayable colors) this function returns the value and the color index of a pixel.

In HiColor (15 or 16 bits) <pel> contains the pixel value and index is usually -1.

In TrueColor <pel> ist the low word and <index> the high word of the pixel value.

Decl.:  void v_get_pixel( WORD handle, WORD x, WORD y, WORD *pel,
                                                                  WORD *index );
Call:   v_get_pixel( handle, x, y, &pel, & index );

Variable         Arguments           Meaning
Input:

contrl[0]        105                 v_get_pixel
contrl[1]        1                   entries in ptsin
contrl[3]        0                   entries in intin
contrl[6]        handle
ptsin[0]         x
ptsin[1]         y

Output:

contrl[2]        0                   entries in ptsout
contrl[4]        2                   entries in intout
intout[0]        pel                 pixel value
intout[1]        index               color index

2.12.5 Raster Operations and Offscreen Bitmaps

Copying rasters from screen to bitmap and vice versa should be done in device specific format.

If the destination of a call is the offscreen bitmap and if the used handle is the handle of the bitmap, the raster will be clipped according to the rectangle specified by vs_clip().

If the destination is the screen, you should use the screen's handle as input parameter and the raster will be clipped according to the clipping rectangle of this screen workstation.


Home NVDI Programmer's Guide Text Output with Bitmap and Vector Fonts Input Functions