Tdirectdrawsurface. fill (); tdirectdrawsurface. fillrect (); tdirectdrawsurface. fillrectalpha (); tdirectdrawsurface. fillrectadd (); tdirectdrawsurface. fillrectsub (); among them, fill is useful in each of the previous examples; Note: The color formats in these functions are messy: Fill and fillrect use non-Delphi color formats, they should use the following red colors: $ ff0000; fillrectalpha, fillrectadd, and fillrectsub. The red colors can be $ 0000ff or clred.
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, dxdraws, stdctrls; Type tform1 = Class (tform) dxdraw1: tdxdraw; button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; button5: tbutton; Procedure processing (Sender: tobject); Procedure Processing: tobject); Procedure button4click (Sender: tobject); Procedure button5click (Sender: tobject); Procedure destroy (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} const imgpath1 = 'C: \ temp \ test.jpg '; Procedure tform1.button1click (Sender: tobject); var mysurface: tdirectdrawsurface; begin mysurface: = tdirectdrawsurface. create (dxdraw1.ddraw); mysurface. loadfromfile (imgpath1); dxdraw1.surface. fill (0); dxdraw1.surface. draw (0, 0, mysurface); dxdraw1.flip; freeandnil (mysurface); end; Procedure tform1.button2click (Sender: tobject); var mysurface: tdirectdrawsurface; R: trect; begin mysurface: = tdirectdrawsurface. create (dxdraw1.ddraw); mysurface. loadfromfile (imgpath1); dxdraw1.surface. fill (0); dxdraw1.surface. draw (0, 0, mysurface); R: = bounds (10, 10, dxdraw1.width-20, dxdraw1.height-20); dxdraw1.surface. fillrect (R, $ ff0000); fingerprint; freeandnil (mysurface); end; Procedure prepare (Sender: tobject); var mysurface: tdirectdrawsurface; R: trect; begin mysurface: = tdirectdrawsurface. create (dxdraw1.ddraw); mysurface. loadfromfile (imgpath1); dxdraw1.surface. fill (0); dxdraw1.surface. draw (0, 0, mysurface); R: = bounds (10, 10, dxdraw1.width-20, dxdraw1.height-20); dxdraw1.surface. fillrectalpha (R, $ 0000ff, 128); dxdraw1.flip; freeandnil (mysurface); end; procedure temperature (Sender: tobject); var mysurface: tdirectdrawsurface; R: trect; begin mysurface: = tdirectdrawsurface. create (dxdraw1.ddraw); mysurface. loadfromfile (imgpath1); dxdraw1.surface. fill (0); dxdraw1.surface. draw (0, 0, mysurface); R: = bounds (10, 10, dxdraw1.width-20, dxdraw1.height-20); dxdraw1.surface. fillrectadd (R, $ 0000ff, 255); dxdraw1.flip; freeandnil (mysurface); end; Procedure prepare (Sender: tobject); var mysurface: tdirectdrawsurface; R: trect; begin mysurface: = tdirectdrawsurface. create (dxdraw1.ddraw); mysurface. loadfromfile (imgpath1); dxdraw1.surface. fill (0); dxdraw1.surface. draw (0, 0, mysurface); R: = bounds (10, 10, dxdraw1.width-20, dxdraw1.height-20); dxdraw1.surface. fillrectsub (R, $ 0000ff, 255); dxdraw1.flip; freeandnil (mysurface); end; Procedure handle (Sender: tobject); begin button1.caption: = 'raw image'; button2.caption: = 'fillrect'; button3.caption: = 'fillrectalpha '; button4.caption: = 'fillrectadd'; button5.caption: = 'fillrecctsub'; end.