Skip to Main Content
Painting the Web
book

Painting the Web

by Shelley Powers
May 2008
Beginner content levelBeginner
656 pages
17h 41m
English
O'Reilly Media, Inc.
Content preview from Painting the Web

Chapter 11. Canvassing

While work was underway on SVG, Apple was doing its own thing, and the result was the canvas object.

Rather than an XML-based specification, the canvas object is just that—an object that provides a graphical "canvas" on which to create. Instead of adding separate elements, as was demonstrated with SVG earlier in this book, you create an instance of the canvas object and then manipulate it with script to create the desired effect.

The benefit to the canvas object is you don't have to work with XML, nor the potentially large amounts of markup this might create in your web page. The disadvantage is that if a person accessing the page has scripting turned off—which many people do for security reasons—the canvas effect won't show.

The canvas object lacks the sophistication of SVG, especially as we'll see later in this book. However, it's also a simple object to learn how to use, as this chapter will demonstrate. In addition, the canvas object is supported for the next generation of HTML, HTML5.

Tip

This chapter uses JavaScript extensively. See http://www.oreilly.com/catalog/9780596515096 for links to good tutorials to get you up to speed on working with this client-side scripting language.

Cross-Browser canvas Support and Microsoft's Silverlight

There is extensive cross-browser support for the canvas object. Safari, Opera, and Mozilla support canvas out of the box, and Google supplies a JavaScript library, ExplorerCanvas, that can be added to a page and which converts ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
Mastering PHP 7

Mastering PHP 7

Branko Ajzele

Publisher Resources

ISBN: 9780596515096Supplemental ContentErrata Page