Lyle Johnson
10/22/2004 3:59:00 PM
On Fri, 22 Oct 2004 23:39:13 +0900, André Pönisch <andre@ap-home.de> wrote:
> At the method onCanvasRepaint would be query whether the arriving event
> synthetic is. What does this indicate exactly? When is an event synthetic
> and when not?
A "synthetic" event is one generated by the FOX event loop and not the
operating system's windowing environment. In the image.rb example, the
onCanvasRepaint() method is used to handle SEL_PAINT messages from the
FOX event loop. The first part of that method checks to see if the
event is "synthetic" or not, and, if so, it re-paints the image into
an offscreen buffer (@picture).
If the SEL_PAINT message is synthetic, that means that it was
generated as a result of someone calling update() on the canvas (as is
done, for example, in the onCmdWell() method). For those cases, we
truly do need to update the image in the back-buffer. If the SEL_PAINT
message is *not* synthetic, that means that it was generated due to an
expose event from the windowing system (i.e. part of the window was
covered and then exposed again). If that's the case, we don't need to
change anything in the back-buffer and we simply copy the back-buffer
image to the screen by calling drawImage(@picture).
In other words: Checking whether an event such as SEL_PAINT is
synthetic or not can sometimes help you optimize your program's
response to that event.
> I also would like to ask in the place whether FXRuby and the kind of
> operation of the example is well suitable for 2D animations or which
> extensions or methods are suitable better.
FXRuby is probably as good as any other GUI toolkit for doing 2-D
animations, but that's not really what it was designed for. If you can
be more specific about what kind of application you have in mind that
might help people advise you on other options.