nana icon indicating copy to clipboard operation
nana copied to clipboard

need examples for nana

Open mohammed-altmimi opened this issue 4 years ago • 5 comments

hi is there a simple example for paint::image or "animation" and is there a good book for nana lib of good tutorial

mohammed-altmimi avatar Mar 17 '20 12:03 mohammed-altmimi

https://qpcr4vir.github.io/nana-doxy/html/d0/deb/animate-bmp_8cpp-example.html

#include <nana/gui.hpp>
#include <nana/gui/animation.hpp>
int main()
{
    using namespace nana;
   
    //Build frames
    frameset fset;
    auto grs = {"000", "015", "030", "045", "060", "075", "090", "105", "120", "135", "150", "170",
                "180", "195", "210", "225", "240", "260", "270", "285", "300", "315", "330", "345"};
    for (const auto& gr: grs)
        fset.push_back(nana::paint::image(std::string("../Examples/a_pic")+gr+".bmp"));
    //A widget to display animation.
    form fm;
    fm.show();
    animation ani;
    ani.push_back(fset);
    ani.output(fm, nana::point());
    ani.looped(true);
    ani.play();
    exec();

https://qpcr4vir.github.io/nana-doxy/html/df/d21/draw_8cpp-example.html

#include <nana/gui.hpp>
int main()
{
    using namespace nana;
    form fm {API::make_center(340, 340)};
    drawing dw(fm);
    dw.draw([](paint::graphics& graph)
    {
        graph.rectangle(rectangle{5, 5, 50, 50}, true, colors::red );
        graph.line(point(5, 5), point(55, 55), colors::blue);
        graph.line_begin(200,100);
        graph.line_to(point(300,300));
        graph.line_to(point(100,200));
        graph.line_to(point(300,200));
        graph.line_to(point(100,300));
        graph.line_to(point(200,100));
                graph.save_as_file("graphics.bmp");
                nana::paint::image img("test.bmp");
                if (img.empty())
                {
                        graph.line(point(100, 100), point(300, 100), colors::red);
                        graph.save_as_file("test.bmp");
                }
                else 
                        img.paste(nana::rectangle(img.size()), graph, nana::point());
                graph.save_as_file("testGraphics.bmp");
    });
        nana::paint::graphics graphics;
        nana::paint::image img("test.bmp");
        if (!img.empty())
        {
                img.paste(nana::rectangle(img.size()), graphics, nana::point());
                graphics.save_as_file("testGraphics2.bmp");
        }
        dw.update();
    fm.show();
    ::nana::exec();

kassane avatar Mar 17 '20 12:03 kassane

thank you

mohammed-altmimi avatar Mar 17 '20 14:03 mohammed-altmimi

is there a good book for nana lib of good tutorial

I've been working on a more detailed alternative for the documentation, that includes examples. It's far from complete, but you may find it useful: https://errorflynn.github.io/nana-docs/ It's not designed for mobile devices at the moment (use desktop to view).

ErrorFlynn avatar Mar 17 '20 19:03 ErrorFlynn

is there a good book for nana lib of good tutorial

I've been working on a more detailed alternative for the documentation, that includes examples. It's far from complete, but you may find it useful: https://errorflynn.github.io/nana-docs/ It's not designed for mobile devices at the moment (use desktop to view).

thank you

mohammed-altmimi avatar Mar 19 '20 12:03 mohammed-altmimi

I've been working on a more detailed alternative for the documentation, that includes examples. It's far from complete, but you may find it useful:

very good work

mohammed-altmimi avatar Mar 19 '20 12:03 mohammed-altmimi