GdiPlus[21]: IGPPathGradientBrush 之 InterpolationColors


测试效果图:

GdiPlus[21]: IGPPathGradientBrush 之 InterpolationColors

测试代码:


uses GdiPlus, GdiPlusHelpers;



procedure TForm1.FormPaint(Sender: TObject);

const

  C1 = $FF000000;

  C2 = $FFFF0000;

  C3 = $FFFFFF00;

  C4 = $FFFF0000;

  C5 = $FF000000;

var

  Brush: IGPPathGradientBrush;

  Rect: TGPRect;

  Path: IGPGraphicsPath;

  ColorBlend: IGPColorBlend;

begin

  Rect.Initialize(10, 10, 180, 100);

  Path := TGPGraphicsPath.Create;

  Path.AddEllipse(Rect);



  Brush := TGPPathGradientBrush.Create(Path);

  ColorBlend := TGPColorBlend.Create([C1, C2, C3, C4, C5], [0, 0.25, 0.5, 0.75, 1]);

  Brush.InterpolationColors := ColorBlend;



  Canvas.ToGPGraphics.FillEllipse(Brush, Rect);

end;


 
   

你可能感兴趣的:(color)