ArticleslgStudy

computer science

Bit blit

Bit blit is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Bit blit rather than just read about it. In short: Bit blit (bit block transfer) is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. A two-bitmap form is called block transfer (BLT) in UEFI Graphics Output Protocol.

Bit blit — main illustration
Bit blit — illustration

Key takeaways

  • Bit blit belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Bit blit to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Bit blit from memory before moving on to harder problems.

Reference excerpt

Bit blit (bit block transfer) is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. A two-bitmap form is called block transfer (BLT) in UEFI Graphics Output Protocol. The operation involves at least two bitmaps: a "source" (or "foreground") and a "destination" (or "background"), and possibly a third that is often called the "mask". The result may be written to a fourth bitmap, though often it replaces the destination. The pixels of each are combined using a program-selectable raster operation, a bit-wise boolean formula. The most obvious raster operation overwrites the destination with the source. Others may involve AND, OR, XOR, and NOT operations. The Commodore Amiga's graphics chipset (and others) could combine three source bitmaps using any of the 256 possible 3-input boolean functions. Modern graphics software has almost completely replaced bitwise operations with more general mathematical operations used for effects such as alpha compositing. This is because bitwise operations on color displays do not usually produce results that resemble the physical combination of lights or inks. Some software still uses XOR to draw interactive highlight rectangles or region borders; when this is done to color images, the unusual resulting colors are easily seen.

Origins The name derives from the BitBLT routine for the Xerox Alto computer, standing for bit-boundary block transfer. Dan Ingalls, Larry Tesler, Bob Sproull, and Diana Merry programmed this operation at Xerox PARC in November 1975 for the Smalltalk-72 system. Dan Ingalls later implemented a redesigned version in microcode. The development of fast methods for various bit blit operations gave impetus to the evolution of computer displays from using character graphics (text mode) to using raster graphics (bitmap) for everything. Machines that rely heavily on the performance of 2D graphics (such as video game consoles) often have special-purpose circuitry called a blitter.

Example of a masked blit implementation A classic use for blitting is to render transparent sprites onto a background. In this example a background image, a sprite, and a 1-bit mask are used. As the mask is 1-bit, there is no possibility for partial transparency via alpha blending. A loop that examines each bit in the mask and copies the pixel from the sprite only if the mask is set will be much slower than hardware that can apply exactly the same operation to every pixel. Instead a masked blit can be implemented with two regular BitBlit operations using the AND and OR raster operations.

The sprite is drawn in various positions over the image to produce this:

Technique When preparing the sprite, the colors are very important. The mask pixels are 0 (black) wherever the corresponding sprite pixel is to be displayed, and 1 (white) wherever the background needs to be preserved. The sprite must be 0 (black) anywhere where it is supposed to be transparent, but note that black can be used in the non-transparent regions. In the first blit, the mask is blitted onto the background using the raster operator AND. Because any value ANDed with 0 equals 0, and any value ANDed with 1 is unchanged, black areas are created where the actual sprites will appear, while leaving the rest of the background alone.

In the second blit, the sprite is blitted onto the newly altered background using the raster operator of OR. Because any value ORed with 0 is unchanged, the background is unaffected and the black areas are filled with the actual sprite image.

It is also possible to achieve the same effect using a sprite with a white background and a white-on-black mask. In this case, the mask would be ORed first, and the sprite ANDed next.

Blitting vs hardware sprites

Blitting is similar to hardware-sprite drawing, in that both systems reproduce a pattern, typically a square area, at different locations on the screen. Hardware sprites have the advantage of being stored in separate memory, and therefore don't disturb the main display memory. This allows them to be moved about the display, covering the "background", with no effect on it. Blitting moves the same types of patterns about the screen, but does so by writing into the same memory as the rest of the display. This means that every time a foreground pattern is placed on the screen, any background pixels underneath it are overwritten, or "damaged". It is up to the software to repair this damage by blitting twice, once to restore the pixels that were changed, and then again to place the foreground pattern in its new location. One way to do it is to store the required patterns in VRAM offscreen and to reserve another area offscreen as a sort of stack to temporarily store the affected display section. Assuming the graphics chip has dedicated VRAM this is useful to lessen the strain on system RAM but also the bandwidth limited ISA expansion slot on older PC systems. However, there are several ways to optimize this. If large areas of the screen are taken over by the patterns, it may be more efficient to blit the background to the screen instead of erasing each pattern individually. A variation involves dividing the screen into segments and erasing only the segments where patterns have been drawn on. This technique is known as dirty rectangles.

See also Alpha compositing Mask (computing), used here as a stencil Blitter

References

External links Xerox Inter-Office Memorandum 19 November 1975

Illustrations

Bit blit illustration
Bit blit illustration

Worked examples

Example 1 — a first encounter with Bit blit

Start with the simplest possible case. Write down what Bit blit claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Bit blit before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Bit blit ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Bit blit

In research
Bit blit appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Bit blit in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Bit blit is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer graphics algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Bit blit outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bit blit” →

How to study Bit blit in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bit blit means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Bit blit out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bit blit in simple terms?

Bit blit (bit block transfer) is a data operation commonly used in computer graphics in which several bitmaps are combined into one using a boolean function. A two-bitmap form is called block transfer (BLT) in UEFI Graphics Output Protocol.

Why does Bit blit matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Bit blit?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Bit blit.

Tags

  • Computer graphics algorithms

Keep exploring