Graphics Reference
In-Depth Information
Figure 2.20.
Specifying bit maps.
Several modes are allowed in bit map copying:
opMode = ( XORmode,ORmode,ANDmode,REPLACEmode );
One often allows a “texture” so that one can generate patterns.
texture = byte array [1..texlen];
The value of texlen depends on the graphics hardware. Each bit in the texture array
indicates whether the corresponding bit in the source rectangle is to be copied.
Here are the basic parameters of a bitBlt ( bit block transfer ) procedure:
procedure BitBlt ( bitMap source;
integer x0, y0; { start point of source rectangle }
texture tex;
bitMap destination;
rectangle rect;
{ target rectangle }
opMode
mode);
Sometimes the source rectangle is specified instead of the target rectangle. In any
case, both the source and target rectangle are the same size and may need to be clipped
against their associated bit maps. The bit maps themselves may overlap so that the
copy operation must be careful not to overwrite essential data. Here is an outline for
the procedure:
Clip the source and target rectangle to their bit maps;
If either the width or height of the clipped rectangles is negative, then exit;
addr1 := address of start of clipped source rectangle;
addr2 := address of start of clipped target rectangle;
if addr1 < addr2
then
begin
Reset addr1 to address of end of clipped source rectangle;
Reset addr2 to address of end of clipped target rectangle;
Copy the rows of the source rectangle to the target in bottom to top order
end
else Copy the rows of the source rectangle to the target in top to bottom order
Search WWH ::




Custom Search