Hello,

I try to create a Fl_Group derived widget, which redirects pixels
by means of a fl_offscreen buffer for manipulation.
fl_offscreen works fine, pixel manipulation is fine, but drawing is
displaced.

My_Group::draw()
{
    if(init || resize)
    {
      off = fl_create_offscreen(w(),h());
      off_buf = new unsigned char[w()*h()*4];
    }
    fl_begin_offscreen(off);
    Fl_Group::draw();
    fl_read_image(off_buf,0,0,w(),h());
    fl_end_offscreen();
    // do some stuff with off_buf ...
    fl_draw_image(off_buf, x(),y(),w(),h());
}

If I comment out the offscreen stuff the Fl_Group::draw() draws
everything correctly. Now I think that Fl_Group draws into the
Fl_Double_Window's offscreen buffer on window coordinates.
Obviously I want FL_Group::draw() to draw into Fl_Groups local
coordinates. The My_/FL_Group widget has a x() and y() value.
The desired way to workaround that difference
between Fl_Group and my derived My_Group would be to set an
offset before the Fl_Group::draw() command above.

Is there a way to place a global drawing instruction like:
all following drawing operations must use a specified offset?

An alternative might be to use a offscreen buffer that is equal to
the window buffer. But that seems not economic, as the offscreen
buffers will overlap and most space is in them not used.

thanks in advance
Kai-Uwe

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to