BITBLT(3R)

NAME
bitblt - bit-block transfer

SYNOPSIS
#include <dmd.h>

void bitblt (sb, r, db, p, f)
Bitmap *sb, *db;
Rectangle r;
Point p;
Code f;

DESCRIPTION
The bitblt function copies the data from Rectangle r in Bitmap sb to the congruent Rectangle with origin p in Bitmap db. Copy is specified by the function Code f.

The source and destination Bitmaps may be the same or different and the source and destination Rectangles may even overlap; bitblt always does the assignments in the correct order.

EXAMPLES
The following subroutine paints a mouse icon into the upper left corner of the applications window.

    unsigned short mouseicon[] = {
    	 0x0000, 0x0000, 0x03E0, 0x17F0,
    	 0x3FF0, 0x5FFE, 0xFFF1, 0x0421,
    	 0x0002, 0x00FC, 0x0100, 0x0080,
    	 0x0040, 0x0080, 0x0000, 0x0000,
    };
    Bitmap mousemap = {
    	(Word *)mouseicon,
    	1,
    	(short)0, (short)0, (short)16, (short)16,
    	(char *)0
    };
    paintmouse()
    {
    	bitblt(&mousemap, mousemap.rect, &display,
    		   Drect.origin, F_XOR);
    }

The following subroutine paints the character c of font *ffont into the upper left corner of the applications window. This is similar to the library function string, which paints strings of characters.

    #include <font.h>
    character(ffont, c)
    Font *ffont;
    char c;
    {
    	Fontchar *fchar;
    	Rectangle r;
    	Rectangle fRect();
    	fchar = ffont->info + c;
    	r = fRect(fchar->x, 0, (fchar+1)->x,
    		   ffont->height);
    	bitblt(ffont->bits, r, &display,
    		   Drect.origin, F_STORE);
    }

The following subroutine scrolls a Rectangle r in a Bitmap *b by n pixels.

    scroll(b, r, n)
    Bitmap *b;
    Rectangle r;
    {
         Rectangle s;
         s = r;
         s.origin.y += n; /* scroll up */
         bitblt (b, s, b, r.origin, F_STORE);
         s.origin.y = r.corner.y - n; /* clear bottom */
         rectf (b, s, F_CLR);
    }

SEE ALSO
structures(3R), string(3R).