Hello everyone,
i currently try to replace parts of my UI by more absract control-types, so that the user can custom how values are displayed. For optimisation i use a wxMemoryDC on a bitmap, to render the content that is painted to the control in the paint-event.
I now found out, that text (most important) and also other drawn elements are not antialiased this way. So, if i use wxMemoryDC(wxControl).SetFont(wxControl.GetFont()); and ...DrawText(...);, the result is different to the original output that is rendered by ie. wxControl.SetValue().
Is there any way to apply especially the normal text-anti-aliasing to a wxMemoryDC??
Thank you,
Frank
wxDC / antialiasing
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxDC / antialiasing
For antialiased drawing you need to use wxGraphicsContext:
https://docs.wxwidgets.org/trunk/classw ... ntext.html
Fortunately there is also a wxGCDC which provides a wxDC compatible API:
https://docs.wxwidgets.org/trunk/classwx_g_c_d_c.html
However, drawing text should be antialiased even when using wxDC.
https://docs.wxwidgets.org/trunk/classw ... ntext.html
Fortunately there is also a wxGCDC which provides a wxDC compatible API:
https://docs.wxwidgets.org/trunk/classwx_g_c_d_c.html
However, drawing text should be antialiased even when using wxDC.
Use the source, Luke!
-
- Earned some good credits
- Posts: 147
- Joined: Mon Sep 01, 2014 10:14 am
Re: wxDC / antialiasing
Hey!
Somehow you're right. For testing the capabilities of my control, i used rotated text (90deg). Obviously antialiasing is only working with horizontal text. So maybe (where it's important) i draw text text horizontally at first to a seperate bitmap to be copied rotated to the output.
Anyway: wxGCDC i did not know. I'll read more about it...
Thanks,
Frank
Somehow you're right. For testing the capabilities of my control, i used rotated text (90deg). Obviously antialiasing is only working with horizontal text. So maybe (where it's important) i draw text text horizontally at first to a seperate bitmap to be copied rotated to the output.
Anyway: wxGCDC i did not know. I'll read more about it...
Thanks,
Frank