Whatever the curve command, it will be converted into a bezy line in the arrival path. That is to say, there is only a straight line and a bezy line in the path.
Both flattenpath and widenpath can convert the besuppliers line in the path into an approximate line. The difference is that the line looks widened after the widenpath conversion, in fact, it is converted into a new path (similar to a region) of the surrounding path ).
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; Type tform1 = Class (tform) radiogroup1: tradiogroup; procedure formpaint (Sender: tobject); Procedure formcreate (Sender: tobject); Procedure radiogroup1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} procedure tform1.formcreate (Sender: tobject); begin radiogroup1.items. commatext: = 'path, flattenpath, widenpath'; radiogroup1.itemindex: = 0; end; Procedure tform1.formpaint (Sender: tobject); Type tparr = array [0 .. 0] of tpoint; ttarr = array [0 .. 0] of byte; var PTS: ^ tparr; types: ^ ttarr; count: integer; I, X, Y: integer; begin canvas. font. size: = 150; canvas. font. style: = [fsbold]; setbkmode (canvas. handle, transparent); beginpath (canvas. handle); canvas. textout (50, 0, 'd); canvas. ARC (20, 20,220,220,120,120, 20,120); endpath (canvas. handle); canvas. pen. width: = 6; If radiogroup1.itemindex = 1 then flattenpath (canvas. handle); If radiogroup1.itemindex = 2 then widenpath (canvas. handle); canvas. pen. color: = clwhite; count: = getpath (canvas. handle, PTS ^, types ^, 0); getmem (PTS, count * sizeof (tpoint); getmem (types, count); count: = getpath (canvas. handle, PTS ^, types ^, count); text: = 'Total number of point points in the path: '+ inttostr (count); strokepath (canvas. handle); canvas. brush. color: = clred; for I: = 0 to count-1 do begin X: = PTS ^ [I]. x; Y: = PTS ^ [I]. y; canvas. fillrect (rect (x-1, Y-1, x + 1, Y + 1); end; freemem (PTS); freemem (types); end; Procedure tform1.radiogroup1click (Sender: tobject ); begin repaint; end.
Form file:
Object form1: tform1 left = 352 Top = 227 caption = 'form1' clientheight = 215 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesigned oncreate = formcreate onpaint = formpaint pixelsperinch = 96 textheight = 13 object radiogroup1: tradiogroup left = 240 Top = 80 width = 91 Height = 127 caption = 'radiogroup1' taborder = 0 onclick = radiogroup1click endend
For information on plotting points in a path, see: http://www.cnblogs.com/del/archive/2008/05/26/1207423.html