cnjinhao / nana

a modern C++ GUI library
https://nana.acemind.cn
Boost Software License 1.0
2.29k stars 331 forks source link

Can I use cairo in nana for scientific plotting and visualization? #489

Open liubenyuan opened 4 years ago

liubenyuan commented 4 years ago

I want to add real-time plotting function to nana. Is there any document or demo that using cairo as the backend for plotting?

cnjinhao commented 4 years ago

There are 2 ways to work with cairo.

1, using class "drawing". https://github.com/qPCR4vir/nana-demo/blob/master/Examples/draw.cpp For example in Windows

dw.draw([](paint::graphics& graph)
{
     auto dc = reinterpret_cast<HDC>(graph.context());
    cairo_win32_surface_create(dc);

2, using draw_through to redirectly render on the form. https://sourceforge.net/p/nanapro/blog/2015/01/tour-of-nana-10/

see the section 4, Draw-through of Form