Hello,

I want to do something like fl_begin_offscreen/fl_copy_offscreen as
it was available in fltk1 on an X11 system.
I tried drawing into an Image as suggested in src/GSave.cxx (see
example program below).
But I just get:

X_PolyFillRectangle: BadMatch (invalid parameter attributes) 0x0
XRequest.154: BadMatch (invalid parameter attributes) 0x0
XRequest.154: RenderBadPicture (invalid Picture parameter) 0x160000a
XRequest.154: RenderBadPicture (invalid Picture parameter) 0x160000a

and a black rectangle.
It works fine however when I compile with --disable-xft.

Any ideas?
Johannes


#include <fltk/run.h>
#include <fltk/Window.h>
#include <fltk/Image.h>
#include <fltk/Widget.h>
#include <fltk/math.h>
#include <fltk/draw.h>

using namespace fltk;

class TestWidget : public Widget {
  Image *im;

  void draw()
  {
        if (im->h() < h() || im->w() < w()) {
                im->setsize(w(), h());
        }
        {
                GSave gsave;
                im->make_current();

                setcolor(WHITE);
                fillrect(0, 0, w(), h());
                setcolor(BLACK);
                drawtext("Hello World" , Rectangle(w(), h()), ALIGN_WRAP);
        }

        im->draw(Rectangle(w(), h()));
  }


public:

  TestWidget(int x,int y,int w,int h,const char *l=0) :
          Widget(x,y,w,h,l) {
                  im = new Image (w, h);
          }

};


int main(int argc, char **argv) {

        Window window(300, 330);
        window.clear_double_buffer();
        window.begin();

        TestWidget tw(10, 10, 280, 280);
        window.end();
        window.show(argc,argv);

        return run();
}
_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to