Rotatetransform {rotation} scaletransform {scaling} translatetransform {translation} settransform {integrated matrix transformation} resettransform {cancel transformation}
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, comctrls, stdctrls, extctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; trackbar2: ttrackbar; Procedure alert (Sender: tobject); Procedure trackbar1change (Sender: tobject); Procedure trackbar2change (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure plugin (Sender: tobject); begin trackbar1.min: =-50; trackbar1.max: = 50; trackbar1.position: = 0; trackbar2.min: = 1; trackbar2.max: = 10; trackbar2.position: = 10; end; Procedure tform1.formpaint (Sender: tobject); const colors: array [0 .. 3] of tgpcolor = (aclred, aclyellow, aclgreen, aclblue); var G: tgpgraphics; P: tgppen; Path: tgpgraphicspath; Pb: tgppathgradientbrush; num: integer; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (aclred); Path: = tgpgraphicspath. create; Path. addrectangle (makerect (50, 20,120,100); Pb: = tgppathgradientbrush. create (PATH); num: = length (colors); Pb. setsurroundcolors (@ colors, num); // Pb. resettransform; Pb. rotatetransform (trackbar1.position); Pb. scaletransform (trackbar2.position/10, trackbar2.position/10); G. fillpath (Pb, PATH); G. drawpath (p, PATH); Pb. free; Path. free; p. free; G. free; end; Procedure tform1.trackbar1change (Sender: tobject); begin repaint; end; Procedure tform1.trackbar2change (Sender: tobject); begin repaint; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 165 clientwidth = 222 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = pow.topcenter oncreate = formcreate onpaint = formpaint pixelsperinch = 96 textheight = 13 object trackbar1: ttrackbar left = 13 Top = 136 width = 100 Height = 23 showselrange = false taborder = 0 onchange = trackbar1change end object trackbar2: ttrackbar left = 110 Top = 134 width = 100 Height = 23 showselrange = false taborder = 1 onchange = trackbar2change endend