how to How to improve the effect of wxDc drawing circle

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Ellan
Experienced Solver
Experienced Solver
Posts: 57
Joined: Mon May 15, 2017 10:11 am

how to How to improve the effect of wxDc drawing circle

Post by Ellan »

Hi,
WxDc draw circle, the edge of this circle is serrated, what can I do to eliminate the sawtooth?
Thanks

Best Regards

Ellan
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to How to improve the effect of wxDc drawing circle

Post by doublemax »

Assuming you're under Windows, you'll need to use wxGraphicsContext, it supports anti-aliasing:
http://docs.wxwidgets.org/trunk/classwx ... ntext.html

If you already have a lot of code based on wxDC, you can use wxGCDC which is a wrapper around wxGraphicsContext with a wxDC-compatible API:
http://docs.wxwidgets.org/trunk/classwx_g_c_d_c.html
Use the source, Luke!
Ellan
Experienced Solver
Experienced Solver
Posts: 57
Joined: Mon May 15, 2017 10:11 am

Re: how to How to improve the effect of wxDc drawing circle

Post by Ellan »

doublemax wrote:Assuming you're under Windows, you'll need to use wxGraphicsContext, it supports anti-aliasing:
http://docs.wxwidgets.org/trunk/classwx ... ntext.html

If you already have a lot of code based on wxDC, you can use wxGCDC which is a wrapper around wxGraphicsContext with a wxDC-compatible API:
http://docs.wxwidgets.org/trunk/classwx_g_c_d_c.html
the wxGraphicsContext drawing line works very well, but drawBitmap is the same as the sawtooth effect of wxDc
Thanks

Best Regards

Ellan
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to How to improve the effect of wxDc drawing circle

Post by doublemax »

the wxGraphicsContext drawing line works very well, but drawBitmap is the same as the sawtooth effect of wxDc
Do you scale the bitmap? How?

Experiment with wxGraphicsContext::SetInterpolationQuality()
http://docs.wxwidgets.org/trunk/classwx ... c285d01b91
Use the source, Luke!
Ellan
Experienced Solver
Experienced Solver
Posts: 57
Joined: Mon May 15, 2017 10:11 am

Re: how to How to improve the effect of wxDc drawing circle

Post by Ellan »

doublemax wrote:
the wxGraphicsContext drawing line works very well, but drawBitmap is the same as the sawtooth effect of wxDc
Do you scale the bitmap? How?

Experiment with wxGraphicsContext::SetInterpolationQuality()
http://docs.wxwidgets.org/trunk/classwx ... c285d01b91
It shows the original image, not zooming
Thanks

Best Regards

Ellan
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to How to improve the effect of wxDc drawing circle

Post by doublemax »

It shows the original image, not zooming
Then the result is expected. If the image is pixelated before, wxGraphicsContect won't "fix" it.

Can you show a screenshot?
Use the source, Luke!
Ellan
Experienced Solver
Experienced Solver
Posts: 57
Joined: Mon May 15, 2017 10:11 am

Re: how to How to improve the effect of wxDc drawing circle

Post by Ellan »

doublemax wrote:
It shows the original image, not zooming
Then the result is expected. If the image is pixelated before, wxGraphicsContect won't "fix" it.

Can you show a screenshot?
The effect of the wxDc and wxGc is that, like the ICONS in the attachment, it looks like the sawtooth is obvious.
Attachments
微信截图_20170830183803.png
微信截图_20170830183803.png (3.34 KiB) Viewed 2274 times
Thanks

Best Regards

Ellan
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: how to How to improve the effect of wxDc drawing circle

Post by doublemax »

It's hard for me to tell what's graphic and what's text. The only thing that looks a little strange is the paperclip. Everything else looks normal to me.
Use the source, Luke!
Post Reply