程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 路徑畫刷 - SetBlend

路徑畫刷 - SetBlend

編輯:Delphi

代碼1:unit Unit1;
interface
uses
 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
 pt: TPoint = (X:130; Y:130);
 r = 120;
 colors: array[0..0] of TGPColor = (aclRed);
var
 g: TGPGraphics;
 p: TGPPen;
 path: TGPGraphicsPath;
 pb: TGPPathGradIEntBrush;
 pts: array[0..4] of TGPPoint;
 radian: Single;
 i,num: Integer;
begin
 for i := 0 to 4 do
 begin
  radian := i * (360*2/5) * (Pi/180);
  pts[i].X := pt.X + Round(Sin(radian) * r);
  pts[i].Y := pt.Y - Round(Cos(radian) * r);
 end;
 g := TGPGraphics.Create(Canvas.Handle);
 path := TGPGraphicsPath.Create;
 path.AddPolygon(PGPPoint(@pts), Length(pts));
 pb:= TGPPathGradIEntBrush.Create(path);
 num := Length(colors);
 pb.SetSurroundColors(@colors, num);
 pb.SetCenterColor(aclYellow);
 {描個邊}
 p := TGPPen.Create(aclYellow);
 g.SetSmoothingMode(SmoothingModeAntiAlias);
 g.DrawPath(p, path);
 g.FillPath(pb, path);
 pb.Free;
 path.Free;
 p.Free;
 g.Free;
end;
end.


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved