相關內容有:
IGPGraphics.SmoothingMode; { 繪圖質量 }
IGPGraphics.InterpolationMode; { 插補模式 }
IGPGraphics.CompositingMode; { 前景色與背景色的合成混合模式 }
IGPGraphics.CompositingQuality; { 圖像合成質量 }
IGPGraphics.PixelOffsetMode; { 像素的偏移模式 }
{ 文本的呈現質量要用 }
IGPGraphics.TextRenderingHint; { 文本呈現模式 }
IGPGraphics.TextContrast; { 文本灰度校正值(消除鋸齒和 ClearType 文本的伽瑪值校正) }
相關參數:
SmoothingMode { 對直線、曲線和已填充區域的邊緣采用鋸齒消除功能, 它不能控制路徑漸變畫筆 }
Invalid // 一個無效模式
Default // 不消除鋸齒, 等效於 HighSpeed、None
HighSpeed // 不消除鋸齒
HighQuality // 消除鋸齒, 等效於 AntiAlias
None // 不消除鋸齒
AntiAlias // 消除鋸齒
InterpolationMode { 插補模式確定如何計算兩個像素點之間的中間值 }
Invalid // 等效於 QualityMode 枚舉的 Invalid 元素.
Default // 默認模式.
Low // 低質量插值法.
High // 高質量插值法.
Bilinear // 雙線性插值法; 不進行預篩選; 將圖像收縮為原始大小的 50% 以下時此模式不適用.
Bicubic // 雙三次插值法; 不進行預篩選; 將圖像收縮為原始大小的 25% 以下時此模式不適用.
NearestNeighbor // 最臨近插值法.
HighQualityBilinear // 高質量的雙線性插值法; 執行預篩選以確保高質量的收縮.
HighQualityBicubic // 高質量的雙三次插值法; 執行預篩選以確保高質量的收縮; 可產生質量最高的轉換圖像.
CompositingMode { 顏色合成模式 }
SourceOver // 與背景色混合; 該混合由透明度確定
SourceCopy // 改寫背景色
CompositingQuality { 圖像合成時, 源像素與目標像素和合成方式 }
Invalid // 無效質量
Default // 默認質量
HighSpeed // 高速度、低質量
HighQuality // 高質量、低速度復合
GamMacorrected // 使用灰度校正
AssumeLinear // 假定線性值
PixelOffsetMode { 像素偏移模式 }
Invalid // 無效模式.
Default // 默認模式.
HighSpeed // 高速度、低質量呈現.
HighQuality // 高質量、低速度呈現.
None // 沒有任何像素偏移.
Half // 像素在水平和垂直距離上均偏移 -0.5 個單位, 以進行高速鋸齒消除.
SmoothingMode 測試:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Pen: IGPPen;
Rect: TGPRectF;
i: Integer;
begin
Graphics := TGPGraphics.Create(Handle);
Pen := TGPPen.Create($FFB22222, 4);
Rect.Initialize(ClientWidth * 3/8, ClientHeight * 3/8, ClientWidth / 4, ClIEntHeight / 4);
for i := 0 to 4 do
begin
Graphics.SmoothingMode := TGPSmoothingMode(i);
Graphics.DrawEllipse(Pen, Rect);
Rect.Inflate(ClientWidth / 14, ClIEntHeight / 14);
end;
end;
InterpolationMode 測試:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Image: IGPImage;
Rect: TGPRectF;
i: Integer;
begin
Graphics := TGPGraphics.Create(Handle);
Image := TGPImage.Create('C:\GdiPlusImg\Grapes.jpg');
Rect.Initialize(10, 10, Image.Width * 0.5, Image.Height * 0.5);
for i := 0 to 7 do
begin
Graphics.InterpolationMode := TGPInterpolationMode(i);
Graphics.DrawImage(Image, Rect);
Rect.Offset(Rect.Width + 10, 0);
if Rect.X + Rect.Width > ClIEntWidth then
begin
Rect.X := 10;
Rect.Offset(0, Rect.Height + 10);
end;
end;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Repaint;
end;
CompositingMode 測試:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Brush: IGPLinearGradIEntBrush;
Rect: TGPRect;
begin
Graphics := TGPGraphics.Create(Handle);
Rect.Initialize(20, 20, 200, 60);
Brush := TGPLinearGradIEntBrush.Create(Rect, $FFA52A2A, $FFFFFF00, 0);
Graphics.CompositingMode := CompositingModeSourceOver; //默認模式
Graphics.FillRectangle(Brush, Rect);
Brush := TGPLinearGradIEntBrush.Create(Rect, $80A52A2A, $80FFFF00, 0);
Graphics.CompositingMode := CompositingModeSourceOver;
Rect.Offset(0, 20 + Rect.Height);
Graphics.FillRectangle(Brush, Rect);
Graphics.CompositingMode := CompositingModeSourceCopy;
Rect.Offset(0, 20 + Rect.Height);
Graphics.FillRectangle(Brush, Rect);
end;
CompositingQuality 測試:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
Image: IGPImage;
Rect: TGPRectF;
Brush: IGPSolidBrush;
i: Integer;
begin
Graphics := TGPGraphics.Create(Handle);
Image := TGPImage.Create('C:\GdiPlusImg\Grapes.jpg');
Rect.Initialize(10, 10, Image.Width * 0.75, Image.Height * 0.75);
Brush := TGPSolidBrush.Create($800000FF);
for i := 0 to 4 do
begin
Graphics.CompositingQuality := TGPCompositingQuality(i);
Graphics.DrawImage(Image, Rect);
Graphics.FillRectangle(Brush, Rect);
Rect.Offset(Rect.Width + 10, 0);
if Rect.X + Rect.Width > ClIEntWidth then
begin
Rect.X := 10;
Rect.Offset(0, Rect.Height + 10);
end;
end;
end;
procedure TForm1.FormResize(Sender: TObject);
begin
Repaint;
end;
PixelOffsetMode 測試:
uses GdiPlus;
procedure TForm1.FormPaint(Sender: TObject);
var
Graphics: IGPGraphics;
BrushBack: IGPHatchBrush;
Brush: IGPSolidBrush;
Rect: TGPRectF;
i: Integer;
begin
Graphics := TGPGraphics.Create(Handle);
BrushBack := TGPHatchBrush.Create(HatchStyleCross, $FFD0D0D0, $FFFFFFFF);
Graphics.FillRectangle(BrushBack, TGPRect.Create(ClIEntRect));
Rect.Initialize(0.34, 1, 5.1, 1.3);
Brush := TGPSolidBrush.Create($80FF0000);
Graphics.ScaleTransform(27.3, 17.3);
for i := 0 to 4 do
begin
Graphics.PixelOffsetMode := TGPPixelOffsetMode(i);
Graphics.FillRectangle(Brush, Rect);
Rect.Offset(0, Rect.Height + 1);
end;
end;