• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C#Graphics中有关绘图质量的几个Mode

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 

SourceOver

1.1

可能会发生异常或图像可能无法正确呈现。

 

二、CompositingQuality

组合的情况下质量决定将合成图像的呈现质量级别。

CompositingQuality Enum

AssumeLinear 4

假定线性值。

Default 0

默认质量。

GammaCorrected 3

使用灰度校正。

HighQuality 2

高质量、低速度复合。

HighSpeed 1

高速度、低质量。

Invalid -1

无效质量。

Compositing is done during rendering when the source pixels are combined with the destination pixels to produce the resultant pixels.
The quality of compositing directly relates to the visual quality of the output and is inversely proportional to the render time. The higher the quality, the slower the render time. This is because the higher the quality level, the more surrounding pixels need to be taken into account during the composite. The linear quality setting (AssumeLinear) compromises by providing better quality than the default quality at a slightly lower speed.
 

三、InterpolationMode

The interpolation mode determines how intermediate values between two endpoints are calculated.

 

四、SmoothingMode

SmoothingMode属性。

 

五、TextRenderingHint

The text rendering hint specifies whether text renders with antialiasing.

Note:

You should not use a CompositingMode property value of SourceCopy when the TextRenderingHint property is set to ClearTypeGridFit. An exception could occur or the image may not render correctly.

 

六、TextContrast

The gamma correction value used for rendering antialiased and ClearType text.

private void ChangeTextRenderingHintAndTextContrast(PaintEventArgs e)
{

    // Retrieve the graphics object.
    Graphics formGraphics = e.Graphics;

    // Declare a new font.
    Font myFont = new Font(FontFamily.GenericSansSerif, 20, FontStyle.Regular);

    // Set the TextRenderingHint property.
    formGraphics.TextRenderingHint =  System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;

    // Draw the string.
    formGraphics.DrawString("Hello World", myFont, Brushes.Firebrick, 20.0F, 20.0F);

    // Change the TextRenderingHint property.
    formGraphics.TextRenderingHint =  System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;

    // Draw the string again.
    formGraphics.DrawString("Hello World", myFont, Brushes.Firebrick, 20.0F, 60.0F);

    // Set the text contrast to a high-contrast setting.
    formGraphics.TextContrast = 0;

    // Draw the string.
    formGraphics.DrawString("Hello World", myFont, 
        Brushes.DodgerBlue, 20.0F, 100.0F);

    // Set the text contrast to a low-contrast setting.
    formGraphics.TextContrast = 12;

    // Draw the string again.
    formGraphics.DrawString("Hello World", myFont,  Brushes.DodgerBlue, 20.0F, 140.0F);

    // Dispose of the font object.
    myFont.Dispose();

}

 

 

 

参考资料

MSDN .NET 4.7.2, 18.9.20

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C#与OOP知识总结发布时间:2022-07-14
下一篇:
C#与Java的区别发布时间:2022-07-14
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap