Am 23.01.12, 01:53 -0800 schrieb Albrecht Schlosser:
> On 23.01.2012 10:23, Kai-Uwe Behrmann wrote:
>
>> 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);
         int X=x(),Y=y();
         position(0,0);
>>      Fl_Group::draw();
         position(X,Y);
>>      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.
>
> ... or set the Fl_Group's coordinates temporarily to (0,0) before
> calling draw() and reset them afterwards.

Fl_Widget::position() does the trick. Thanks for your hint in the right 
direction.

kind regards
Kai-Uwe Behrmann
-- 
developing for colour management 
www.behrmann.name + www.oyranos.org

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

Reply via email to