Example of a simple "Double Buffering" plot-reply to the "tookiq" question

Source: Internet
Author: User
The so-called double buffer is to first draw to the memory canvas (such as tbitmap), and then post to the destination.

For example, the following smallProgram:

 
Procedure tform1.formcreate (Sender: tobject); begin timer1.interval: = 100; color: = clwhite; end; Procedure tform1.timer1timer (Sender: tobject); begin canvas. pen. color: = random ($ ffffff); canvas. moveTo (random (clientwidth), random (clientheight); canvas. lineto (random (clientwidth), random (clientheight); end;

  

The double buffer drawing can be changed:

VaR bit: tbitmap; Procedure tform1.formcreate (Sender: tobject); begin timer1.interval: = 100; bit: = tbitmap. create; bit. width: = clientwidth; bit. height: = clientheight; end; Procedure tform1.timer1timer (Sender: tobject); begin bit. canvas. pen. color: = random ($ ffffff); bit. canvas. moveTo (random (bit. width), random (bit. height); bit. canvas. lineto (random (bit. width), random (bit. height); self. canvas. draw (0, 0, bit); end; Procedure tform1.formdestroy (Sender: tobject); begin bit. free; end;

  

What tookiq needs is GDI +, and the truth is the same.

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.