<s>
Bit	B-Algorithm
blit	I-Algorithm
(	O
also	O
written	O
BITBLT	B-Algorithm
,	O
BIT	O
BLT	O
,	O
BitBLT	B-Algorithm
,	O
Bit	O
BLT	O
,	O
Bit	O
Blt	O
etc.	O
,	O
which	O
stands	O
for	O
bit	B-Algorithm
block	I-Algorithm
transfer	I-Algorithm
)	O
is	O
a	O
data	O
operation	O
commonly	O
used	O
in	O
computer	O
graphics	O
in	O
which	O
several	O
bitmaps	O
are	O
combined	O
into	O
one	O
using	O
a	O
boolean	O
function	O
.	O
</s>
<s>
The	O
operation	O
involves	O
at	O
least	O
two	O
bitmaps	O
:	O
a	O
"	O
source	O
"	O
(	O
or	O
"	O
foreground	O
"	O
)	O
and	O
a	O
"	O
destination	O
"	O
(	O
or	O
"	O
background	O
"	O
)	O
,	O
and	O
possibly	O
a	O
third	O
that	O
is	O
often	O
called	O
the	O
"	O
mask	B-Algorithm
"	O
.	O
</s>
<s>
The	O
pixels	B-Algorithm
of	O
each	O
are	O
combined	O
bitwise	O
according	O
to	O
the	O
specified	O
raster	O
operation	O
(	O
ROP	O
)	O
and	O
the	O
result	O
is	O
then	O
written	O
to	O
the	O
destination	O
.	O
</s>
<s>
Other	O
ROPs	O
may	O
involve	O
AND	O
,	O
OR	O
,	O
XOR	B-Application
,	O
and	O
NOT	O
operations	O
.	O
</s>
<s>
The	O
Commodore	B-Device
Amiga	I-Device
's	O
graphics	O
chipset	O
(	O
and	O
others	O
)	O
could	O
combine	O
three	O
source	O
bitmaps	O
using	O
any	O
of	O
the	O
256	O
possible	O
boolean	O
functions	O
with	O
three	O
inputs	O
.	O
</s>
<s>
Modern	O
graphics	O
software	O
has	O
almost	O
completely	O
replaced	O
bitwise	O
operations	O
with	O
more	O
general	O
mathematical	O
operations	O
used	O
for	O
effects	O
such	O
as	O
alpha	B-Algorithm
compositing	I-Algorithm
.	O
</s>
<s>
Some	O
software	O
still	O
uses	O
XOR	B-Application
to	O
draw	O
interactive	O
highlight	O
rectangles	O
or	O
region	O
borders	O
;	O
when	O
this	O
is	O
done	O
to	O
color	O
images	O
,	O
the	O
unusual	O
resulting	O
colors	O
are	O
easily	O
seen	O
.	O
</s>
<s>
The	O
name	O
derives	O
from	O
the	O
BitBLT	B-Algorithm
routine	O
for	O
the	O
Xerox	B-Device
Alto	I-Device
computer	O
,	O
standing	O
for	O
bit-boundary	O
block	O
transfer	O
.	O
</s>
<s>
Dan	O
Ingalls	O
,	O
Larry	O
Tesler	O
,	O
Bob	O
Sproull	O
,	O
and	O
Diana	O
Merry	O
programmed	O
this	O
operation	O
at	O
Xerox	O
PARC	O
in	O
November	O
1975	O
for	O
the	O
Smalltalk-72	B-Application
system	O
.	O
</s>
<s>
Dan	O
Ingalls	O
later	O
implemented	O
a	O
redesigned	O
version	O
in	O
microcode	B-Device
.	O
</s>
<s>
The	O
development	O
of	O
fast	O
methods	O
for	O
various	O
bit	B-Algorithm
blit	I-Algorithm
operations	O
gave	O
impetus	O
to	O
the	O
evolution	O
of	O
computer	O
displays	O
from	O
using	O
character	O
graphics	O
(	O
text	B-Application
mode	I-Application
)	O
to	O
using	O
raster	B-Algorithm
graphics	I-Algorithm
(	O
bitmap	O
)	O
for	O
everything	O
.	O
</s>
<s>
Machines	O
that	O
rely	O
heavily	O
on	O
the	O
performance	O
of	O
2D	O
graphics	O
(	O
such	O
as	O
video	B-Device
game	I-Device
consoles	I-Device
)	O
often	O
have	O
special-purpose	O
circuitry	O
called	O
a	O
blitter	B-General_Concept
.	O
</s>
<s>
A	O
classic	O
use	O
for	O
blitting	B-Algorithm
is	O
to	O
render	O
transparent	O
sprites	O
onto	O
a	O
background	O
.	O
</s>
<s>
In	O
this	O
example	O
a	O
background	O
image	O
,	O
a	O
sprite	O
,	O
and	O
a	O
1-bit	O
mask	B-Algorithm
are	O
used	O
.	O
</s>
<s>
As	O
the	O
mask	B-Algorithm
is	O
1-bit	O
,	O
there	O
is	O
no	O
possibility	O
for	O
partial	O
transparency	O
via	O
alpha	B-Algorithm
blending	I-Algorithm
.	O
</s>
<s>
A	O
loop	O
that	O
examines	O
each	O
bit	O
in	O
the	O
mask	B-Algorithm
and	O
copies	O
the	O
pixel	B-Algorithm
from	O
the	O
sprite	O
only	O
if	O
the	O
mask	B-Algorithm
is	O
set	O
will	O
be	O
much	O
slower	O
than	O
hardware	O
that	O
can	O
apply	O
exactly	O
the	O
same	O
operation	O
to	O
every	O
pixel	B-Algorithm
.	O
</s>
<s>
Instead	O
a	O
masked	O
blit	B-Algorithm
can	O
be	O
implemented	O
with	O
two	O
regular	O
BitBlit	B-Algorithm
operations	O
using	O
the	O
AND	O
and	O
OR	O
raster	O
operations	O
.	O
</s>
<s>
The	O
mask	B-Algorithm
pixels	B-Algorithm
are	O
0	O
(	O
black	O
)	O
wherever	O
the	O
corresponding	O
sprite	O
pixel	B-Algorithm
is	O
to	O
be	O
displayed	O
,	O
and	O
1	O
(	O
white	O
)	O
wherever	O
the	O
background	O
needs	O
to	O
be	O
preserved	O
.	O
</s>
<s>
In	O
the	O
first	O
blit	B-Algorithm
,	O
the	O
mask	B-Algorithm
is	O
blitted	O
onto	O
the	O
background	O
using	O
the	O
raster	O
operator	O
AND	O
.	O
</s>
<s>
In	O
the	O
second	O
blit	B-Algorithm
,	O
the	O
sprite	O
is	O
blitted	O
onto	O
the	O
newly	O
altered	O
background	O
using	O
the	O
raster	O
operator	O
of	O
OR	O
.	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
achieve	O
the	O
same	O
effect	O
using	O
a	O
sprite	O
with	O
a	O
white	O
background	O
and	O
a	O
white-on-black	B-General_Concept
mask	B-Algorithm
.	O
</s>
<s>
In	O
this	O
case	O
,	O
the	O
mask	B-Algorithm
would	O
be	O
ORed	O
first	O
,	O
and	O
the	O
sprite	O
ANDed	O
next	O
.	O
</s>
<s>
Blitting	B-Algorithm
is	O
similar	O
to	O
hardware-sprite	O
drawing	O
,	O
in	O
that	O
both	O
systems	O
reproduce	O
a	O
pattern	O
,	O
typically	O
a	O
square	O
area	O
,	O
at	O
different	O
locations	O
on	O
the	O
screen	O
.	O
</s>
<s>
Blitting	B-Algorithm
moves	O
the	O
same	O
types	O
of	O
patterns	O
about	O
the	O
screen	O
,	O
but	O
does	O
so	O
by	O
writing	O
into	O
the	O
same	O
memory	O
as	O
the	O
rest	O
of	O
the	O
display	O
.	O
</s>
<s>
This	O
means	O
that	O
every	O
time	O
a	O
foreground	O
pattern	O
is	O
placed	O
on	O
the	O
screen	O
,	O
any	O
background	O
pixels	B-Algorithm
underneath	O
it	O
are	O
overwritten	O
,	O
or	O
"	O
damaged	O
"	O
.	O
</s>
<s>
It	O
is	O
up	O
to	O
the	O
software	O
to	O
repair	O
this	O
damage	O
by	O
blitting	B-Algorithm
twice	O
,	O
once	O
to	O
restore	O
the	O
pixels	B-Algorithm
that	O
were	O
changed	O
,	O
and	O
then	O
again	O
to	O
place	O
the	O
foreground	O
pattern	O
in	O
its	O
new	O
location	O
.	O
</s>
<s>
If	O
large	O
areas	O
of	O
the	O
screen	O
are	O
taken	O
over	O
by	O
the	O
patterns	O
,	O
it	O
may	O
be	O
more	O
efficient	O
to	O
blit	B-Algorithm
the	O
background	O
to	O
the	O
screen	O
instead	O
of	O
erasing	O
each	O
pattern	O
individually	O
.	O
</s>
