Book Image

Mastering Dart

By : Sergey Akopkokhyants
Book Image

Mastering Dart

By: Sergey Akopkokhyants

Overview of this book

Table of Contents (19 chapters)
Mastering Dart
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Canvas


The HTML5 canvas is a fantastic feature that allows you to code programmatic drawing operations. It has become very popular because it allows you to create and manipulate imagery directly within web pages. The canvas is one of the most flexible tags in new HTML5 features. This tag is a blank state. It defines a context object that users can draw inside. The actual drawing operations can be split in the following ways:

  • Drawing a 2D context

  • Drawing a 3D context formally known as a WebGL

A 2D context is available in all modern web browsers. It is more established and stable, while the 3D context is in the early process of being defined. Let's discuss the 2D context as it is more widely supported.

The canvas API is simple and powerful at the same time. You can only draw on a 2D bitmap surface using script. In the process of drawing, you do not have any DOM nodes for the shapes you draw. All that you produce is pixels, so you can forget about the performance penalties event if the image complexity...