GDI + Learning Record (17): curve-Curve

Source: Internet
Author: User
// Draw the curve var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS); p. free; G. free; end;
  
   
 // Specify the curvature var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS), 0.25); // specify the curvature to 0.25. The default value is 0.5 p. free; G. free; end;
  
   
 // Plot the Curve Part var G: tgpgraphics; P: tgppen; PTS: array [0 .. 4] of tgppoint; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (makecolor (255, 0, 0), 4); PTS [0]. x: = 11; PTS [0]. y: = 11; PTS [1]. x: = 66; PTS [1]. y: = 66; PTS [2]. x: = 88; PTS [2]. y: = 222; PTS [3]. x: = 111; PTS [3]. y: = 111; PTS [4]. x: = 222; PTS [4]. y: = 88; G. drawcurve (p, pgppoint (@ PTS), length (PTS), 1, 2, 0); {parameter 3 specifies the number of points to start from; parameter 4 indicates the number of sections to be drawn; when parameter 5 is a curvature of 0, it becomes a continuous line} p. free; G. free; end;

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.