Draw graph using double buffer technology

zhaozj2021-02-16  66

When the amount of data is large, the drawing may take a few seconds or even longer, and sometimes a flicker is possible. In order to solve these problems, double buffer technology can be used to draw a graph.

Double buffer creating an object consistent with the screen drawing area, first draws graphics to this object in memory, once again copying the graphics on this object to the screen, so that the speed of the drawing can be greatly accelerated.

The double buffer implementation process is as follows:

1. Create a buffer buffer bufferbmp = new graph graph graph graphics :: tbitmap (); bufferbmp-> width = width; bufferbmp-> height = HEIGHT;

2, in the buffer drawing bufferbmp-> canvas-> brush-> color = clbtnface; bufferbmp-> canvas-> fillRect (Rect (0, 0, width, height); bufferbmp-> canvas-> moveto (...); ..............................

3, copy the buffer bitmap to the current canvas on Bitblt (canvas-> handle, 0, 0, width, height, bufferbmp-> canvas-> handle, 0,0, srccopy);

4, release the memory buffer delete bufferbmp;

转载请注明原文地址:https://www.9cbs.com/read-16991.html

New Post(0)