<s>
The	O
canvas	B-Language
element	I-Language
is	O
part	O
of	O
HTML5	B-Application
and	O
allows	O
for	O
dynamic	O
,	O
scriptable	B-Language
rendering	O
of	O
2D	O
shapes	O
and	O
bitmap	O
images	O
.	O
</s>
<s>
HTML5	B-Language
Canvas	I-Language
also	O
helps	O
in	O
making	O
2D	O
games	O
.	O
</s>
<s>
While	O
the	O
HTML5	B-Language
canvas	I-Language
offers	O
its	O
own	O
2D	O
drawing	O
API	B-General_Concept
,	O
it	O
also	O
supports	O
the	O
WebGL	B-Library
API	B-General_Concept
to	O
allow	O
3D	O
rendering	O
with	O
OpenGL	B-Application
ES	I-Application
.	O
</s>
<s>
Canvas	B-Language
was	O
initially	O
introduced	O
by	O
Apple	O
for	O
use	O
in	O
their	O
own	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
WebKit	B-Language
component	O
in	O
2004	O
,	O
powering	O
applications	O
like	O
Dashboard	B-Application
widgets	I-Application
and	O
the	O
Safari	B-Application
browser	I-Application
.	O
</s>
<s>
Later	O
,	O
in	O
2005	O
,	O
it	O
was	O
adopted	O
in	O
version	O
1.8	O
of	O
Gecko	B-Language
browsers	O
,	O
and	O
Opera	B-Application
in	O
2006	O
,	O
and	O
standardized	O
by	O
the	O
Web	B-Language
Hypertext	I-Language
Application	I-Language
Technology	I-Language
Working	I-Language
Group	I-Language
(	O
WHATWG	B-Language
)	O
on	O
new	O
proposed	O
specifications	O
for	O
next	O
generation	O
web	O
technologies	O
.	O
</s>
<s>
A	O
canvas	B-Language
consists	O
of	O
a	O
drawable	O
region	O
defined	O
in	O
HTML	B-Language
code	I-Language
with	O
height	O
and	O
width	O
attributes	O
.	O
</s>
<s>
JavaScript	B-Language
code	O
may	O
access	O
the	O
area	O
through	O
a	O
full	O
set	O
of	O
drawing	O
functions	O
similar	O
to	O
those	O
of	O
other	O
common	O
2D	O
APIs	B-General_Concept
,	O
thus	O
allowing	O
for	O
dynamically	O
generated	O
graphics	O
.	O
</s>
<s>
Some	O
anticipated	O
uses	O
of	O
canvas	B-Language
include	O
building	O
graphs	O
,	O
animations	O
,	O
games	O
,	O
and	O
image	O
composition	O
.	O
</s>
<s>
Interacting	O
with	O
the	O
canvas	B-Language
involves	O
obtaining	O
the	O
canvas	B-Language
 '	O
rendering	O
context	O
,	O
which	O
determines	O
whether	O
to	O
use	O
the	O
canvas	B-Language
API	B-General_Concept
,	O
WebGL	B-Library
,	O
or	O
WebGL2	B-Library
rendering	O
context	O
.	O
</s>
<s>
The	O
following	O
code	O
creates	O
a	O
Canvas	B-Language
element	I-Language
in	O
an	O
HTML	B-Language
page	O
:	O
</s>
<s>
Using	O
JavaScript	B-Language
,	O
you	O
can	O
draw	O
on	O
the	O
canvas	B-Language
:	O
</s>
<s>
The	O
Canvas	B-Language
API	B-General_Concept
also	O
provides	O
save( )	O
and	O
restore( )	O
,	O
for	O
saving	O
and	O
restoring	O
all	O
the	O
canvas	B-Language
context	O
's	O
attributes	O
.	O
</s>
<s>
A	O
canvas	B-Language
actually	O
has	O
two	O
sizes	O
:	O
the	O
size	O
of	O
the	O
element	O
itself	O
and	O
the	O
size	O
of	O
the	O
element	O
's	O
drawing	O
surface	O
.	O
</s>
<s>
Setting	O
the	O
element	O
's	O
width	O
and	O
height	O
attributes	O
sets	O
both	O
of	O
these	O
sizes	O
;	O
CSS	B-Language
attributes	O
affect	O
only	O
the	O
element	O
's	O
size	O
and	O
not	O
the	O
drawing	O
surface	O
.	O
</s>
<s>
By	O
default	O
,	O
both	O
the	O
canvas	B-Language
element	I-Language
's	O
size	O
and	O
the	O
size	O
of	O
its	O
drawing	O
surface	O
is	O
300	O
screen	O
pixels	B-Algorithm
wide	O
and	O
150	O
screen	O
pixels	B-Algorithm
high	O
.	O
</s>
<s>
In	O
the	O
listing	O
shown	O
in	O
the	O
example	O
,	O
which	O
uses	O
CSS	B-Language
to	O
set	O
the	O
canvas	B-Language
element	I-Language
's	O
size	O
,	O
the	O
size	O
of	O
the	O
element	O
is	O
600	O
pixels	B-Algorithm
wide	O
and	O
300	O
pixels	B-Algorithm
high	O
,	O
but	O
the	O
size	O
of	O
the	O
drawing	O
surface	O
remains	O
unchanged	O
at	O
the	O
default	O
value	O
of	O
300	O
pixels	B-Algorithm
×	O
150	O
pixels	B-Algorithm
.	O
</s>
<s>
When	O
a	O
canvas	B-Language
element	I-Language
's	O
size	O
does	O
not	O
match	O
the	O
size	O
of	O
its	O
drawing	O
surface	O
,	O
the	O
browser	O
scales	O
the	O
drawing	O
surface	O
to	O
fit	O
the	O
element	O
(	O
which	O
may	O
result	O
in	O
surprising	O
and	O
unwanted	O
effects	O
)	O
.	O
</s>
<s>
SVG	B-Application
is	O
an	O
alternative	O
approach	O
to	O
drawing	O
shapes	O
in	O
browsers	O
.	O
</s>
<s>
Unlike	O
canvas	B-Language
,	O
which	O
is	O
raster-based	O
,	O
SVG	B-Application
is	O
vector-based	O
,	O
so	O
that	O
each	O
drawn	O
shape	O
is	O
remembered	O
as	O
an	O
object	O
in	O
a	O
scene	B-Data_Structure
graph	I-Data_Structure
or	O
Document	B-General_Concept
Object	I-General_Concept
Model	I-General_Concept
,	O
which	O
is	O
subsequently	O
rendered	O
to	O
a	O
bitmap	O
.	O
</s>
<s>
This	O
means	O
that	O
if	O
attributes	O
of	O
an	O
SVG	B-Application
object	O
are	O
changed	O
,	O
the	O
browser	O
can	O
automatically	O
re-render	O
the	O
scene	O
.	O
</s>
<s>
Canvas	B-Language
objects	O
,	O
on	O
the	O
other	O
hand	O
,	O
are	O
drawn	O
in	O
immediate	O
mode	O
.	O
</s>
<s>
In	O
the	O
canvas	B-Language
example	O
above	O
,	O
the	O
rectangle	O
draw	O
operation	O
modifies	O
the	O
canvas	B-Language
,	O
and	O
its	O
representation	O
as	O
a	O
rectangle	O
is	O
forgotten	O
by	O
the	O
system	O
.	O
</s>
<s>
If	O
the	O
rectangle	O
's	O
position	O
were	O
to	O
be	O
changed	O
,	O
the	O
canvas	B-Language
would	O
need	O
to	O
be	O
redrawn	O
,	O
including	O
any	O
objects	O
that	O
might	O
have	O
been	O
covered	O
by	O
the	O
rectangle	O
.	O
</s>
<s>
In	O
the	O
equivalent	O
SVG	B-Application
case	O
,	O
one	O
could	O
simply	O
change	O
the	O
position	O
attributes	O
of	O
the	O
rectangle	O
and	O
the	O
browser	O
would	O
determine	O
how	O
to	O
repaint	O
it	O
.	O
</s>
<s>
There	O
are	O
additional	O
JavaScript	B-Language
libraries	I-Language
that	O
abstract	O
the	O
canvas	B-Language
model	O
to	O
have	O
svg-like	O
scene	O
capabilities	O
within	O
the	O
canvas	B-Language
element	I-Language
.	O
</s>
<s>
Multiple	O
canvas	B-Language
layers	O
can	O
also	O
be	O
used	O
,	O
meaning	O
that	O
only	O
specific	O
layers	O
need	O
to	O
be	O
recreated	O
when	O
changes	O
are	O
required	O
.	O
</s>
<s>
SVG	B-Application
images	O
are	O
represented	O
in	O
XML	B-Protocol
,	O
and	O
complex	O
scenes	O
can	O
be	O
created	O
and	O
maintained	O
with	O
XML	B-Protocol
editing	O
tools	O
.	O
</s>
<s>
The	O
SVG	B-Application
scene	B-Data_Structure
graph	I-Data_Structure
enables	O
event	O
handlers	O
to	O
be	O
associated	O
with	O
objects	O
,	O
so	O
a	O
rectangle	O
may	O
respond	O
to	O
an	O
onClick	O
event	O
.	O
</s>
<s>
To	O
get	O
the	O
same	O
functionality	O
with	O
canvas	B-Language
,	O
one	O
must	O
manually	O
match	O
the	O
coordinates	O
of	O
the	O
mouse	O
click	O
with	O
the	O
coordinates	O
of	O
the	O
drawn	O
rectangle	O
to	O
determine	O
whether	O
it	O
was	O
clicked	O
.	O
</s>
<s>
Conceptually	O
,	O
canvas	B-Language
is	O
a	O
lower-level	O
API	B-General_Concept
upon	O
which	O
higher-level	O
interfaces	O
might	O
be	O
built	O
(	O
for	O
example	O
,	O
SVG	B-Application
support	O
)	O
.	O
</s>
<s>
There	O
are	O
JavaScript	B-Language
libraries	I-Language
that	O
provide	O
partial	O
SVG	B-Application
implementations	O
using	O
canvas	B-Language
for	O
browsers	O
that	O
do	O
not	O
provide	O
SVG	B-Application
but	O
support	O
canvas	B-Language
,	O
such	O
as	O
the	O
browsers	O
in	O
Android	O
2.x	O
.	O
</s>
<s>
The	O
situation	O
is	O
complicated	O
because	O
there	O
are	O
scene	B-Data_Structure
graph	I-Data_Structure
libraries	O
for	O
canvas	B-Language
,	O
and	O
SVG	B-Application
has	O
some	O
bitmap	O
manipulation	O
functionality	O
.	O
</s>
<s>
At	O
the	O
time	O
of	O
its	O
introduction	O
,	O
the	O
canvas	B-Language
element	I-Language
was	O
met	O
with	O
mixed	O
reactions	O
from	O
the	O
web	O
standards	O
community	O
.	O
</s>
<s>
There	O
have	O
been	O
arguments	O
against	O
Apple	O
's	O
decision	O
to	O
create	O
a	O
new	O
proprietary	O
element	O
instead	O
of	O
supporting	O
the	O
SVG	B-Application
standard	O
.	O
</s>
<s>
On	O
March	O
14	O
,	O
2007	O
,	O
WebKit	B-Language
developer	O
Dave	O
Hyatt	O
forwarded	O
an	O
email	O
from	O
Apple	O
's	O
Senior	O
Patent	O
Counsel	O
,	O
Helene	O
Plotka	O
Workman	O
,	O
which	O
stated	O
that	O
Apple	O
reserved	O
all	O
intellectual	O
property	O
rights	O
relative	O
to	O
WHATWG	B-Language
's	O
Web	O
Applications	O
1.0	O
Working	O
Draft	O
,	O
dated	O
March	O
24	O
,	O
2005	O
,	O
Section	O
10.1	O
,	O
entitled	O
“	O
Graphics	O
:	O
The	O
bitmap	O
canvas	B-Language
”	O
,	O
but	O
left	O
the	O
door	O
open	O
to	O
licensing	O
the	O
patents	O
should	O
the	O
specification	O
be	O
transferred	O
to	O
a	O
standards	O
body	O
with	O
a	O
formal	O
patent	O
policy	O
.	O
</s>
<s>
This	O
caused	O
considerable	O
discussion	O
among	O
web	O
developers	O
and	O
raised	O
questions	O
concerning	O
the	O
WHATWG	B-Language
's	O
lack	O
of	O
a	O
policy	O
on	O
patents	O
in	O
comparison	O
to	O
the	O
World	O
Wide	O
Web	O
Consortium	O
(	O
W3C	O
)	O
'	O
s	O
explicit	O
favoring	O
of	O
royalty-free	O
licenses	O
.	O
</s>
<s>
The	O
disclosure	O
means	O
that	O
Apple	O
is	O
required	O
to	O
provide	O
royalty-free	O
licensing	O
for	O
the	O
patent	O
whenever	O
the	O
Canvas	B-Language
element	I-Language
becomes	O
part	O
of	O
a	O
future	O
W3C	O
recommendation	O
created	O
by	O
the	O
HTML	B-Language
working	O
group	O
.	O
</s>
<s>
Canvas	B-Protocol
fingerprinting	I-Protocol
is	O
one	O
of	O
a	O
number	O
of	O
browser	B-Protocol
fingerprinting	I-Protocol
techniques	O
for	O
tracking	O
online	O
users	O
that	O
allow	O
websites	O
to	O
identify	O
and	O
track	O
visitors	O
using	O
HTML5	B-Language
canvas	I-Language
element	O
.	O
</s>
<s>
The	O
privacy	O
concerns	O
regarding	O
canvas	B-Protocol
fingerprinting	I-Protocol
center	O
around	O
the	O
fact	O
that	O
even	O
deleting	O
cookies	O
and	O
clearing	O
the	O
cache	O
will	O
not	O
be	O
sufficient	O
for	O
users	O
to	O
avoid	O
online	O
tracking	O
.	O
</s>
<s>
The	O
element	O
is	O
supported	O
by	O
the	O
current	O
versions	O
of	O
Mozilla	B-Application
Firefox	I-Application
,	O
Google	B-Application
Chrome	I-Application
,	O
Internet	B-Application
Explorer	I-Application
,	O
Safari	B-Application
,	O
Konqueror	B-Application
,	O
Opera	B-Application
and	O
Microsoft	B-Application
Edge	I-Application
.	O
</s>
