Giter VIP home page Giter VIP logo

Comments (6)

user1095108 avatar user1095108 commented on May 29, 2024

This is really trivial, I've updated the example with your request and I leave the .pdf capture to you as your homework.

from cairowidget.

nmrcardoso avatar nmrcardoso commented on May 29, 2024

Thanks a lot.
Sorry, but I think I was not so explicit, sorry about that.
Imagine if you have more than one widget:

Fl_Group *group = new Fl_Group(0,0,724, 700);
group->begin();
auto const ex(new CairoWidget(0, 0, win->w()/2, win->h()/2));
auto const ex1(new CairoWidget(win->w()/2, 0, win->w()/2, win->h()/2));
auto const ex2(new CairoWidget(0, win->h()/2, win->w()/2, win->h()/2));
auto const ex3(new CairoWidget(win->w()/2, win->h()/2, win->w()/2, win->h()/2));
group->end();
win->end();

can you provide a solution to print all the widgets/all window as one image/pdf/svg?
The solution you provided is good to print only one widget, however I have some
problems implementing the print of the window, all widgets together.
Sorry, I'm new to fltk and cairo, and your solution seems to me the best one to create widgets in cairo context

Thanks a lot.

from cairowidget.

user1095108 avatar user1095108 commented on May 29, 2024

I can only give a generic reply since, I really don't need this feature. I'd start reading here and see how Fl_Double_Window does off-screen rendering, check the source code of course.

https://www.fltk.org/doc-1.3/drawing.html#ssect_Offscreen

Then I'd change the CairoWidget to render into an image and then paste that image via fl_draw_image().

https://www.fltk.org/doc-1.3/group__fl__drawings.html

This would make CairoWidget a regular fltk widget, containing absolutely no hacks. After that I'd make use of this knowledge to create a screenshot of selected widgets (i.e. I'd render them into an off-screen image, then save that image somewhere).

On the other hand, you can also use the fltk-provided:
https://www.fltk.org/doc-1.3/classFl__Cairo__Window.html

and try to use that. I posted CairoWidget to mostly give users ideas and a starting point for adaptation. I really can't help you further, as I don't need the hacks I suggested personally.

from cairowidget.

user1095108 avatar user1095108 commented on May 29, 2024

I wrote an example of what a portable cairo widget might look like.

from cairowidget.

user1095108 avatar user1095108 commented on May 29, 2024

Hey, I added CairoWindow for ripping speed, try it. The speed improvement really show, but you'll have to compile cairo with opengl support yourself.

from cairowidget.

user1095108 avatar user1095108 commented on May 29, 2024

You need to use this with the portable widget:

void Fl_Image_Surface::draw(Fl_Widget *widget, int delta_x, int delta_y)

from cairowidget.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.