Canvas drawing optimization using bitmaps--based on the Createjs library

Source: Internet
Author: User

In real-time drawing of a large number of (million-level) graphics on the map, the reason for real-time drawing is because the shape of the various shapes, graphics to follow the parameters of the back-end to draw.

It is convenient to draw graphics with canvas, and the API interface of JavaScript is relatively simple. Now there are a lot of JS Canvas library, such as this: Createjs in the EASELJS, the canvas is a lightweight package, support chain operation, support for graphics add events, although it is designed to do game development, but take it to real-time drawing graphics, add events on the graph, The staff were very friendly and helpful.

For example, to draw a solid circle or sector, you can use the arc () function:

But here's the problem, the ARC function is very slow, very CPU-intensive. So how to optimize it? If only from the perspective of canvas painting: The other way to replace the arc is a good choice, such as the Createjs provided by the bitmap to introduce the existing image, and then the image rotation, deformation, etc., if you can meet the needs, then it is also very good.

Canvas drawing optimization using bitmaps--based on the Createjs library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.