GamMacorrection 屬性是一個 Boolean 值, 默認 False; 為 True 表示啟用了灰度校正.
測試圖中的第二個圖形使用了灰度校正:
測試代碼:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Rect: TGPRectF;
Brush: IGPLinearGradIEntBrush;
begin
Graphics := TGPGraphics.Create(Canvas.Handle);
Rect.Initialize(20 , 10, 150, 200);
Brush := TGPLinearGradIEntBrush.Create(Rect, $FFFF0000, $FF0000FF, 0);
Graphics.FillEllipse(Brush, Rect);
Brush.GamMacorrection := True;
Graphics.TranslateTransform(Rect.X + Rect.Width, 0);
Graphics.FillEllipse(Brush, Rect);
end;