On 12.02.2009, at 13:00, Fabio Bracci wrote:
>>> why should I be forced to copy the offscreen while it still=20
>>> is the active context?
>>
>> fl_read_image only handles the current context, so if you want to
>> read
>> from the offscreen, it has to be current.
>
> I felt I just needed some more flexibility/usability from the
> offscreen.
Well, there are two philosophies for API's. You can either send the
context of your operation with every call, or you can use a current
context. The difference is this:
draw(context)
rect(context)
line(context)
vs.
begin(context);
draw()
rect()
line()
end(context);
Since most of the time, the context is not change around, we decided
for the second solution. The functionality is exactly the same:
grab_screen(context)
and
begin(context)
grab_screen()
end(context)
are the same. The first line, if written out, would look something
like this in code:
grab_screen(context) {
if (current_ != context)
current_ = begin(context);
grab_screen()
}
Nothing gained, nothing lost. FOr the same reason (avoiding repetitive
typing of "context"), FLTK uses a currrent group for adding more
widgets, so the clumsy
groupA = new Group()
buttonA = new Button()
groupA->add(buttonA)
becomes
new Group()
new Button()
done.
----
http://robowerk.com/
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk