[fxruby-users] "managed" canvas?

Bil bil.bas at virgin.net
Sat Jul 24 08:04:26 EDT 2004



*********** REPLY SEPARATOR  ***********

On 23/07/2004 at 13:39 Joel VanderWerf wrote:

>Bil wrote:
>> I am aware that people have, in the past, asked for a Tk-style canvas
>> object that manages shapes (etc) within it. 
>> [snip] 
>
>FWIW, I'll add my encouragement. It'd be great to have a Tk canvas
>workalike in FXRuby, for doing simple animations and diagrams that 
>aren't worth the effort to do in OpenGL.

Thanks everyone for the encouragement *8-)*. Just proposed at RubyForge (comments welcome!). I'll CVS where I'm up to when I get a reply.

The reason I haven't gone with a C++ implementation is that, really _I_ don't need it enough (at least to justify the much greater effort to get anywhere - C++ is OK, but I've not used 'real' FOX and even after that it would have to be wrapped...). Most importantly I would like an FXRuby implementation sort of soon. If you are optimistic, see this as a prototype...

> (Maybe I should just get better at OpenGL ;)
Maybe I should just get better at C++ *8-P*

<proposal>

Working title
-------------
FXSvgCanvas

Purpose
-------
FXRuby lacks a managed canvas like the Tk canvas widget. The intention is to create a subclass of FXCanvas that manages internal "pseudo-widgets" in an SVG-like hierarcy.
Note: it is *possible* that this Ruby implementation will be a prototype for a later C++/FOX implementation (which would then be wrapped for FXRuby).

Spec
----
Allow creation of pseudo-widgets:
* Geometric shapes [circle, polygon, etc]
* Images and icons.
* Text.
* Containers for grouping objects (SVG <g>).

Allow manipulation of these objects:
* move, resize, raise, lower, etc.
* _possibly_ scripted animation.

Canvas handles all re-drawing of items in correct order.

Perform hit-testing (e.g. ob = canvas.hit(10, 30)).

Allow tag-recognition (e.g. canvas["frog"].move! 10, 3). _Possibly_ XPath syntax as well as that of Tk (e.g. canvas["/fish/head/eye"] == canvas["eye"] assuming there is only one "eye" in diagram)?

Allow event-binding (e.g. onMouseOver, onMouseClick) to these pseudo-widgets.

Structure is based on w3's SVG (Scaleable Vector Graphics) format. Thus can easily import from/export to SVG (though import of externally produced SVG will probably be limited). This relies on REXML for parsing.

</proposal>

bil





More information about the fxruby-users mailing list