1. Definition
BitBlt (Bit Block Transfer) is a raster graphics operation that copies a block of pixels from a source to a destination in memory or on a display.
- It is a low-level graphics operation used in windowing systems, GUIs, and 2D graphics.
- Allows fast manipulation of images, sprites, or regions of the screen.
- Typically used in systems like Windows GDI (Graphics Device Interface).
2. Basic Concept
-
Copy a rectangular pixel block (bitmap) from a source to a destination.
-
Can include masking, raster operations, and combining pixel values.
-
Parameters typically include:
- Source coordinates (xs,ys)
- Destination coordinates (xd,yd)
- Width and height of the rectangle
- Raster operation (ROP)
3. Raster Operations (ROPs)
ROPs define how source, destination, and optional mask pixels are combined.
Common ROPs include:
| Operation |
Meaning |
| SRCCOPY |
Destination = Source |
| SRCAND |
Destination = Source AND Destination |
| SRCPAINT |
Destination = Source OR Destination |
| SRCINVERT |
Destination = Source XOR Destination |
| NOTSRCCOPY |
Destination = NOT(Source) |
- These operations allow effects like masking, transparency, and inversion.
4. Applications of BitBlt
- Moving or copying windows on the screen.
- Double buffering: Draw off-screen and copy to the screen to avoid flicker.
- Sprite animation in games.
- Image manipulation: overlaying, inverting, masking.
5. BitBlt Process
- Define source rectangle: select the block of pixels to copy.
- Define destination rectangle: where to place the copied block.
- Apply raster operation (ROP): determines how pixels are combined.
- Transfer pixels efficiently using hardware acceleration when available.
6. Advantages
- Fast: Optimized for block copying of pixels.
- Flexible: Supports masking, transparency, and logical operations.
- Fundamental in 2D GUIs: Used for window movement, screen updates, and animations.
Key Points:
- BitBlt = copying a block of pixels with optional raster operations.
- Essential for efficient 2D graphics, windowing systems, and off-screen drawing.
- Works with source, destination, and mask for powerful visual effects.