VC GDI 如何抗锯齿

xophiix 2007-07-05 11:10:17
非字体的如Bitmap和Eclipse, FillRgn输出都有锯齿,打印时比较明显,如何将边缘柔化,也就是抗锯齿,一般怎么作呢?
...全文
2787 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
向立天 2010-08-23
  • 打赏
  • 举报
回复
您好
我是本版版主
此帖已多日无人关注
请您及时结帖
如您认为问题没有解决可按无满意结帖处理
另外本版设置了疑难问题汇总帖
并已在版面置顶
相关规定其帖子中有说明
您可以根据规定提交您帖子的链接
如您目前不想结帖只需回帖说明
我们会删除此结帖通知
laviewpbt 2010-07-26
  • 打赏
  • 举报
回复
Region在GDI和GDI+下都是无法抗锯齿的,因为Region在很大程度上脱离了图形的范畴,一个Region实际上载内存是由一个一个小矩形组成的。
C瓜哥 2010-07-26
  • 打赏
  • 举报
回复
还是转向GDI+吧
an_bachelor 2010-07-26
  • 打赏
  • 举报
回复
CLEARTYPE_NATURAL_QUALITY
redpetallsg 2007-07-09
  • 打赏
  • 举报
回复
虚心向你们学习
xophiix 2007-07-08
  • 打赏
  • 举报
回复
我用path解决了已经,没有描边
直接FillPath即可
但为什么对Region不提供,应该有原因的吧,我再看看MSDN吧,不然我就认为是一个bug了,呵呵
Y___Y 2007-07-08
  • 打赏
  • 举报
回复
GDI可以自己用算法实现
Realdodo 2007-07-08
  • 打赏
  • 举报
回复
貌似确实没有直接的抗锯齿,不过你可以考虑给这个图形描边~最终效果应该跟你期望的一样!
// 把这段代码接在你的绘图代码后面
GraphicsPath path;
Point points[] = {Point(200, 10), Point(200, 0), Point(350, 100), Point(350, 200), Point(200, 10)};
path.AddLines(points, 5);
Region region(&path);
graphics.FillRegion(&brush, ®ion);
Pen pen(Color::Black, 1.0);
graphics.DrawPath(&pen, &path);
xophiix 2007-07-06
  • 打赏
  • 举报
回复
我用GDI+设置抗锯齿了
画Eclipse效果很明显,但FillRgn还是没效果
代码如下:
void TestSmooth(CDC* pDC)
{
Graphics graphics(pDC->GetSafeHdc());

// Set the smoothing mode to SmoothingModeHighSpeed, and fill an ellipse.
graphics.SetSmoothingMode(SmoothingModeHighSpeed);
graphics.FillEllipse(&SolidBrush(Color(255, 0, 0, 0)), 0, 200, 200, 100);

// 画椭圆的确变平滑了
// Set the smoothing mode to SmoothingModeHighQuality, and fill an ellipse.
graphics.SetSmoothingMode(SmoothingModeHighQuality);
graphics.FillEllipse(&SolidBrush(Color(255, 0, 0, 0)), 200, 200, 200, 100);

CRgn rgn;
CPoint pts[4];
pts[0].SetPoint(0, 10);
pts[1].SetPoint(0, 0);
pts[2].SetPoint(150, 10);
pts[3].SetPoint(150, 20);

rgn.CreatePolygonRgn((LPPOINT)&pts, 4, WINDING);
//pDC->FillRgn(&rgn,CBrush::FromHandle((HBRUSH)GetStockObject(BLACK_BRUSH)));

// try antialiasing draw -- 这里还是有锯齿,和用GDI画效果一样
Region gdiRgn((HRGN)rgn.GetSafeHandle());
SolidBrush brush(Color::Black);
graphics.FillRegion(&brush, &gdiRgn);
}

要对Region抗锯齿是不是还有什么其他设置?用Path会不会有效果呢
cleverwyq 2007-07-06
  • 打赏
  • 举报
回复
GDI+, 可以设置抗锯齿级别
hurryboylqs 2007-07-05
  • 打赏
  • 举报
回复
反走样

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧