SetBlendBellShape 方法: 創建基於鐘形曲線的漸變過渡過程;
SetBlendTriangularShape 方法: 創建一個從中心色向兩端單個顏色線性過渡的線性漸變過程.
兩個方法好像區別不大.
SetBlendBellShape 測試效果圖:
查看原圖(大圖)
SetBlendTriangularShape 測試效果圖:
查看原圖(大圖)
SetBlendBellShape 測試代碼:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Rect: TGPRectF;
Brush: IGPLinearGradIEntBrush;
begin
Graphics := TGPGraphics.Create(Canvas.Handle);
Rect.Initialize(10 , 10 , 120, 150);
Brush := TGPLinearGradIEntBrush.Create(Rect, $FFFF0000, $FF0000FF, 0);
Brush.SetBlendBellShape(1);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(0.8);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(0.5);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(0.2);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(0);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
//
Graphics.TranslateTransform(-Graphics.Transform.OffsetX, Rect.Y + Rect.Height);
Brush.SetBlendBellShape(1, 1);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(1, 0.8);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(1, 0.5);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(1, 0.2);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendBellShape(1, 0);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
end;
SetBlendTriangularShape 測試代碼:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Rect: TGPRectF;
Brush: IGPLinearGradIEntBrush;
begin
Graphics := TGPGraphics.Create(Canvas.Handle);
Rect.Initialize(10, 10, 120, 150);
Brush := TGPLinearGradIEntBrush.Create(Rect, $FFFF0000, $FF0000FF, 0);
Brush.SetBlendBellShape(1);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(0.8);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(0.5);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(0.2);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(0);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
//
Graphics.TranslateTransform(-Graphics.Transform.OffsetX, Rect.Y + Rect.Height);
Brush.SetBlendTriangularShape(1, 1);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(1, 0.8);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(1, 0.5);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(1, 0.2);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.SetBlendTriangularShape(1, 0);
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
end;