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;