John Smith with a flacon of HTML N°5 perfume

HTML5

≻ Guidelines for Web Developers

Chapter 5: Canvas

This page shows all examples, graphics and links used in this chapter of HTML5: Guidelines for Web Developers. The first table lists examples and graphics with the relevant page numbers in the book, includes links (where applicable) to the online version of that page plus information on browser compatibility, and shows a preview of the figure in the book. Click on this preview to load the figure in original size in JPEG format. The second table lists all URLs which appear in the book on the relevant pages. If you would like to leave feedback or report any errors and bugs, please use the e-mail contact above.

pageexample / figurescreenshot
105Figure 5.1 Two overlapping rectangles

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
106Figure 5.2 Bar chart with ten horizontal bars

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
107Figure 5.3 The Canvas coordinate system

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (axis labels missing, layout error for y)

screenshot:
115Figure 5.4 Linear gradient with four colors

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (layout error for red)

screenshot:
116Figure 5.5 Components of a radial gradient

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (layout error for rgba)

screenshot:
118Figure 5.6 The letter A as a path

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (axis labels missing)

screenshot:
119Figure 5.7 The path method “lineTo()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
120Figure 5.8 The path method “quadraticCurveTo()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
121Figure 5.9 The path method “bezierCurveTo()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
122Figure 5.10 The path method “arcTo()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6 (method arcTo() not correctly implemented), Chrome 6, Safari 5, IE 9b

screenshot:
123Figure 5.11 Four different rectangles with rounded corners; the circle is an extreme example of a rounded rectangle

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6 (method arcTo() not correctly implemented), Chrome 6, Safari 5, IE 9b (method arcTo() not correctly implemented)

screenshot:
124Figure 5.12 The path method “arc()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
126Figure 5.13 Circles and sectors

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
127Figure 5.14 The path method “rect()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
128Figure 5.15 Attributes for determining line styles

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (layout error for context.lineWidth)

screenshot:
129Figure 5.16 The non-zero fi ll rule for paths

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (nonzero rule not correctly implemented), Safari 5, IE 9b

screenshot:
132Figure 5.17 Font formatting with the “font” attribute

created with: Firefox 3.6

tested with: Firefox 3.6 (wrong font for small-caps), Opera 10.6 (wrong font for small-caps), Chrome 6 (font sizes specified with font-size in % are too small; @font-face not supported), Safari 5 (font sizes specified with font-size in % are too small; @font-face not supported), IE 9b (wrong font for small-caps)

screenshot:
133Figure 5.18 Horizontal anchor points with “textAlign”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (punctuation mark not on the left for document.dir=rtl), Safari 5 (punctuation mark not on the left for document.dir=rtl), IE 9b (text not displayed)

screenshot:
134Figure 5.19 Vertical anchor points with “textBaseline”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
135Figure 5.20 “fi llText()”, “strokeText()”, and “measureText()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (maxLength not implemented), Safari 5 (maxLength not implemented), IE 9b

screenshot:
136Figure 5.21 Position parameters of the “drawImage()” method

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (layout error for image)

screenshot:
137Figure 5.22 The source image of all “drawImage()” examples

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (wrong shadows for strokeRect - rectangle has transparent white fill), Safari 5, IE 9b (layout error for vertical texts, text 1200 and 600 missing)

screenshot:
138Figure 5.23 Taft Point in Yosemite National Park

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
139Figure 5.24 Taft Point with El Capitan in Yosemite National Park

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
140Figure 5.25 Yosemite National Park postcard

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
141Figure 5.26 Yosemite National Park postcard (alternative layout)

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
142Figure 5.27 The “ImageData” object

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (layout errors for vertical text and rgba values)

screenshot:
144Figure 5.28 Modifying colors in the “CanvasPixelArray”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
146Figure 5.29 Color manipulation with “getImageData()” and “putImageData()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6 (method createImageData() not implemented), Chrome 6 (method createImageData() not implemented), Safari 5, IE 9b

screenshot:
149Figure 5.30 Values of the “globalCompositeOperation” attribute

created with: Firefox 4.0b

tested with: Firefox 4.0b, Opera 10.6, Chrome 6 (source-in, source-out, destination-in, destination-atop and copy are wrong), Safari 5 (source-in, source-out, destination-in, destination-atop and copy are wrong)

screenshot:
151Figure 5.31 Compositing operation “destination-in” with image and text

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6 (rendering wrong), Chrome 6 (destination-in not implemented correctly, maxLength wrong for subtitle), Safari 5 (destination-in not implemented correctly, maxLength wrong for subtitle)

screenshot:
152Figure 5.32 Compositing operation “lighter” with 16 base colors

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5

screenshot:
153Figure 5.33 Checkered pattern in eight color combinations

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (createPattern() with Canvas not implemented correctly), Safari 5, IE 9b

screenshot:
154Figure 5.34 Pattern using images as a source

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6 (wrong patterns in legend), Safari 5, IE 9b

screenshot:
156Figure 5.35 The basic transformations “scale()”, “rotate()”, and “translate()”

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
157Figure 5.36 Rotate, scale and move

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 7, Safari 5, IE 9b

screenshot:
160Figure 5.37 Photo collage with mirror effect in pseudo-3D

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b (shadows wrong due to missing composite)

screenshot:
167Figure 5.38 Animation with multicolored spheres

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
169Figure 5.39 HSL colors for multicolored spheres animation

created with: Firefox 3.6

tested with: Firefox 3.6, Opera 10.6, Chrome 6, Safari 5, IE 9b

screenshot:
170Figure 5.40 Yosemite National Park video postcard

created with: Firefox 4.0b

tested with: Firefox 4.0b (wrong background at restart), Opera 10.6 (wrong background at restart), Chrome 6 (wrong background at restart)

screenshot:
pageURL
108http://weblogs.mozillazine.org/hyatt/archives/2004_07.html#005913
108http://ln.hixie.ch/?start=1089635050&count=1
109http://html5.komplett.cc/code/chap_canvas/index_en.html
110http://www.w3.org/TR/2dcontext/
110http://www.khronos.org/webgl/
114http://www.w3.org/TR/css3-color/
131http://www.fontex.org/
146http://docs.gimp.org/de/gimp-tool-desaturate.html
147http://bit.ly/a2nxI6
148http://www.pixastic.com/lib/
154http://www.squidfingers.com/patterns/
161http://bit.ly/b5AFW6
170http://www.youtube.com/watch?v=NmdHx_7b0h0
175https://mozillalabs.com/skywriter/
176http://www.whatwg.org/images/logo
176http://code.google.com/chrome/chromeframe/
176http://code.google.com/p/explorercanvas/
176http://philip.html5.org/tests/canvas/suite/tests/
176http://html5.komplett.cc/code/chap_canvas/index_en.html
176http://www.canvasdemos.com/
176https://developer.mozilla.org/en/canvas_tutorial
176http://hacks.mozilla.org/category/canvas/
177http://www.w3.org/TR/html5/the-canvas-element.html
177http://www.w3.org/TR/2dcontext/
177http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html