Delphix (20) of Delphi and DirectX: tdirectdrawsurface. fillrect...

Source: Internet
Author: User
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.
 
   
 

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.