程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、

GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、

編輯:Delphi

SetBlendBellShape 方法: 創建基於鐘形曲線的漸變過渡過程;

  SetBlendTriangularShape 方法: 創建一個從中心色向兩端單個顏色線性過渡的線性漸變過程.

  兩個方法好像區別不大.

  SetBlendBellShape 測試效果圖:

GdiPlus[16]: IGPLinearGradientBrush 之 SetBlendBellShape、SetBlendTriangularShape

  查看原圖(大圖)

  SetBlendTriangularShape 測試效果圖:

GdiPlus[16]: IGPLinearGradientBrush 之 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; 



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