C# Graphics中有关绘图质量的几个Mode
一、CompositingMode
获取一个值,该值指定如何将合成图像绘制到此 Graphics。复合模式确定从源映像的像素是覆盖(SourceCopy)还是组合(SourceOver, 需要使用半透明、混合叠加效果时使用)使用背景像素。默认值为 SourceOver。
该属性适用于 适用于.NET Framework 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0, 1.1
不应使用CompositingMode属性值为SourceCopy时TextRenderingHint属性设置为ClearTypeGridFit。 可能会发生异常或图像可能无法正确呈现。
二、CompositingQuality
获取或设置绘制到此 Graphics 的合成图像的呈现质量。组合的情况下质量决定将合成图像的呈现质量级别。
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.
三、InterpolationMode
The interpolation mode determines how intermediate values between two endpoints are calculated.
四、SmoothingMode
平滑模式指定直线、 曲线和已填充区域的边缘是否使用平滑处理 (也称为抗锯齿)。 一个例外是路径渐变画笔不遵守平滑模式。 使用填充的区域PathGradientBrush呈现相同的方式 (别名) 而不考虑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, , 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 = ; // 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 = ; // 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
C# Graphics中有关绘图质量的几个Mode的更多相关文章
- Java知多少(98)Graphics类的绘图方法
Graphics类提供基本绘图方法,Graphics2D类提供更强大的绘图能力.本节讲解Graphics类,下节讲解Graphics2D. Graphics类提供基本的几何图形绘制方法,主要有:画线段 ...
- Java的Graphics类进行绘图的方法详解
Graphics类提供基本绘图方法,Graphics2D类提供更强大的绘图能力. Graphics类提供基本的几何图形绘制方法,主要有:画线段.画矩形.画圆.画带颜色的图形.画椭圆.画圆弧.画多边形等 ...
- 十一. 图形、图像与多媒体4.Graphics类的绘图方法
Graphics类提供基本绘图方法,Graphics2D类提供更强大的绘图能力.本节讲解Graphics类,下节讲解Graphics2D. Graphics类提供基本的几何图形绘制方法,主要有:画线段 ...
- Android中Canvas绘图基础详解(附源码下载) (转)
Android中Canvas绘图基础详解(附源码下载) 原文链接 http://blog.csdn.net/iispring/article/details/49770651 AndroidCa ...
- 【《Effective C#》提炼总结】提高Unity中C#代码质量的21条准则
作者:Williammao, 腾讯移动客户端开发工程师 商业转载请联系腾讯WeTest获得授权,非商业转载请注明出处. 原文链接:http://wetest.qq.com/lab/view/290.h ...
- OpenCV中的绘图函数-OpenCV步步精深
OpenCV 中的绘图函数 画线 首先要为画的线创造出环境,就要生成一个空的黑底图像 img=np.zeros((512,512,3), np.uint8) 这是黑色的底,我们的画布,我把窗口名叫做i ...
- 【《Effective C#》提炼总结】提高Unity中C#代码质量的22条准则
引言 原则1尽可能地使用属性而不是可直接访问的数据成员 原则2偏向于使用运行时常量而不是编译时常量 原则3 推荐使用is 或as操作符而不是强制类型转换 原则4 推荐使用条件属性而不是if条件编译 原 ...
- 【转】Effective C#观后感之提高Unity中C#代码质量的21条准则
转自:http://blog.csdn.net/swj524152416/article/details/75418162 我们知道,在C++领域,作为进阶阅读材料,必看的书是<Effectiv ...
- 【Matlab开发】matlab中bar绘图设置与各种距离度量
[Matlab开发]matlab中bar绘图设置与各种距离度量 标签(空格分隔): [Matlab开发] [机器学习] 声明:引用请注明出处http://blog.csdn.net/lg1259156 ...
随机推荐
- 为Linux服务器的SSH登录启用Google两步验证
对于Linux服务器而言使用密钥登录要比使用密码登录安全的多,毕竟当前网上存在多个脚本到处进行爆破. 这类脚本都是通过扫描IP端的开放端口并使用常见的密码进行登录尝试,因此修改端口号也是非常有必要的. ...
- Jmeter聚合报告
Label:请求的Name. #Samples:发出请求数量. Average:平均响应时间(单位:ms). Median:全部响应时间中位数,. 90%Line:90%用户的响应时间低于这个时间. ...
- springmvc+mybatis+redis实现查询插入操作
最近在学习redis,虽然现在还不是很熟练.不过可以进行简单的框架整合开发. IDE:我使用的是IDEA.springmvc+spring+mybatis的整合这个我就不多说了,下面我们先进行这块的整 ...
- BZOJ2090: [Poi2010]Monotonicity 2【线段树优化DP】
BZOJ2090: [Poi2010]Monotonicity 2[线段树优化DP] Description 给出N个正整数a[1..N],再给出K个关系符号(>.<或=)s[1..k]. ...
- Postman 上传文件
一.选择post请求方式,输入请求地址 二.填写Headers Key:Content-Type Value:multipart/form-data 三.填写body 选择form-data 然后选择 ...
- NET Core 2.2
.NET Core 2.2 新增部分功能使用尝鲜 https://www.cnblogs.com/viter/p/10070248.html 前言 美国当地时间12月4日,微软2019开发者大 ...
- 【DUBBO】Dubbo:protocol 的配置项
[一]:配置项 <dubbo:protocol id="标识" port="端口号" name="名字"/> [二]:配置解析器 ...
- bzoj 3779 重组病毒——LCT维护子树信息
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3779 调了很久……已经懒得写题解了.https://www.cnblogs.com/Zinn ...
- 军哥 LNMP 常见问题
安装memcached出错: Install memcached...Notice: memcached-1.4.25.tar.gz not found!!!download now...--2016 ...
- 军哥LNMP优化
http://bbs.vpser.net/thread-8914-1-1.html http://www.zxsdw.com/index.php/archives/881/ 修改/usr/local/ ...