␡
- Feature #10: Path-Based Graphics and the Nonzero Winding Rule
- Feature #9: Hit Detection
- Feature #8: canvas Is an HTML Element
- Feature #7: Temporary Drawing
- Feature #6: Offscreen Canvases
- Feature #5: Transforming the Coordinate System
- Feature #4: Image Manipulation
- Feature #3: Drawing Images and More with drawImage()
- Feature #2: The Clipping Region
- Feature #1: New Functionality in the 2D API
- Conclusion
Like this article? We recommend
Feature #6: Offscreen Canvases
Feature #6: Offscreen Canvases
Canvas-based applications often use offscreen canvases, typically to pre-render all or part of an onscreen canvas; in fact, offscreen canvases are often critical for performance reasons.
Fortunately, because canvas is an HTML element, you can easily create an offscreen canvas like this:
var offscreenCanvas = document.createElement('canvas');
Once you've drawn into an offscreen canvas, you can copy it onscreen with the 2D context's versatile drawImage() method. I discuss that method in the later section "Feature #3: Drawing Images and More with drawImage()."