专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »PHP教程 » GdiPlus[45]: IGPGraphics ( 4) 有关呈现质量 »正文

GdiPlus[45]: IGPGraphics ( 4) 有关呈现质量

来源: 发布时间:星期六, 2009年12月26日 浏览:0次 评论:0


  相关内容有:

IGPGraphics.SmoothingMode;      { 绘图质量 }  
IGPGraphics.InterpolationMode;    { 插补模式 }  
IGPGraphics.CompositingMode;     { 前景色和背景色合成混合模式 }  
IGPGraphics.CompositingQuality;    { 图像合成质量 }  
IGPGraphics.PixelOffMode;     { 像素偏移模式 }  
 
{ 文本呈现质量要用 } 
IGPGraphics.TextRenderingH;    { 文本呈现模式 } 
IGPGraphics.TextContrast;       { 文本灰度校正值(消除锯齿和 ClearType 文本伽玛值校正) } 


  相关参数:

SmoothingMode { 对直线、曲线和已填充区域边缘采用锯齿消除功能, 它不能控制路径渐变画笔 } 
Invalid   // 个无效模式  
Default   // 不消除锯齿, 等效于 HighSpeed、None 
HighSpeed  // 不消除锯齿  
HighQuality // 消除锯齿, 等效于 AntiAlias 
None    // 不消除锯齿  
AntiAlias  // 消除锯齿 
 
InterpolationMode { 插补模式确定如何计算两个像素点的间中间值 } 
Invalid       // 等效于 QualityMode 枚举 Invalid 元素. 
Default       // 默认模式. 
Low         // 低质量插值法. 
High        // 高质量插值法. 
Bilinear      // 双线性插值法; 不进行预筛选; 将图像收缩为原始大小 50% 以下时此模式不适用. 
Bicubic       // 双 3次插值法; 不进行预筛选; 将图像收缩为原始大小 25% 以下时此模式不适用. 
NearestNeighbor   // 最临近插值法. 
HighQualityBilinear // 高质量双线性插值法; 执行预筛选以确保高质量收缩. 
HighQualityBicubic // 高质量双 3次插值法; 执行预筛选以确保高质量收缩; 可产生质量最高转换图像. 
 
CompositingMode { 颜色合成模式 } 
SourceOver // 和背景色混合; 该混合由透明度确定 
SourceCopy // 改写背景色 
 
CompositingQuality { 图像合成时, 源像素和目标像素和合成方式 } 
Invalid    // 无效质量 
Default    // 默认质量 
HighSpeed   // 高速度、低质量 
HighQuality  // 高质量、低速度复合 
GammaCorrected // 使用灰度校正 
AssumeLinear  // 假定线性值 
 
PixelOffMode { 像素偏移模式 } 
Invalid   // 无效模式. 
Default   // 默认模式. 
HighSpeed  // 高速度、低质量呈现. 
HighQuality // 高质量、低速度呈现. 
None    // 没有任何像素偏移. 
Half    // 像素在水平和垂直距离上均偏移 -0.5 个单位, 以进行高速锯齿消除. 


  SmoothingMode 测试:



uses GdiPlus; 
 
procedure TForm1.FormPa(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.FormPa(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.Off(Rect.Width + 10, 0); 
   Rect.X + Rect.Width > ClientWidth then 
  begin 
   Rect.X := 10; 
   Rect.Off(0, Rect.Height + 10); 
  end; 
 end; 
end; 
 
procedure TForm1.FormResize(Sender: TObject); 
begin 
 Repa; 
end; 


  CompositingMode 测试:



uses GdiPlus; 
 
procedure TForm1.FormPa(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.Off(0, 20 + Rect.Height); 
 Graphics.FillRectangle(Brush, Rect); 
 
 Graphics.CompositingMode := CompositingModeSourceCopy; 
 Rect.Off(0, 20 + Rect.Height); 
 Graphics.FillRectangle(Brush, Rect); 
end; 


  CompositingQuality 测试:



uses GdiPlus; 
 
procedure TForm1.FormPa(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.Off(Rect.Width + 10, 0); 
   Rect.X + Rect.Width > ClientWidth then 
  begin 
   Rect.X := 10; 
   Rect.Off(0, Rect.Height + 10); 
  end; 
 end; 
end; 
 
procedure TForm1.FormResize(Sender: TObject); 
begin 
 Repa; 
end; 


  PixelOffMode 测试:



uses GdiPlus; 
 
procedure TForm1.FormPa(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.PixelOffMode := TGPPixelOffMode(i); 
  Graphics.FillRectangle(Brush, Rect); 
  Rect.Off(0, Rect.Height + 1); 
 end; 
end; 


标签:
0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: