Learn more about GDI + [65]: path painter (5)-setgammacorrection

Source: Internet
Author: User
In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs; Type tform1 = Class (tform) Procedure formpaint (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure tform1.formpaint (Sender: tobject); const colorarr: array [0 .. 2] of tgpcolor = (aclred, aclgreen, aclblue); var PTS: array [0 .. 2] of tgppoint; G: tgpgraphics; Path: tgpgraphicspath; Pb: tgppathgradientbrush; num: integer; begin PTS [0]: = makepoint (80, 10); PTS [1]: = makepoint (10,150); PTS [2]: = makepoint (150,150); G: = tgpgraphics. create (canvas. handle); Path: = tgpgraphicspath. create; Path. addpolygon (pgppoint (@ PTS), length (PTS); // Pb: = tgppathgradientbrush. create (PATH); {in this case, the center is set to white by default. In the following example, the center is black by default.} Pb: = tgppathgradientbrush. create (pgppoint (@ PTS), length (PTS); {create path painter Based on the Dot Array} Pb. setcentercolor (aclwhite); num: = length (PTS); Pb. setsurroundcolors (pargb (@ colorarr), num); G. fillpath (Pb, PATH); {use the Grayscale Correction mode to draw another image} Pb. setgammacorrection (true); G. translatetransform (150, 0); G. fillpath (Pb, PATH); Pb. free; Path. free; G. free; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 163 clientwidth = 311 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = pow.topcenter onpaint = formpaint pixelsperinch = 96 textheight = 13end

  

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.