# Ruby app using svg under win32

**URL:** <https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140>\
**Category:** Ruby-Gnome 2\
**Created:** [May 31, 2006, 9:25pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140 "2006-05-31T21:25:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [May 31, 2006, 9:25pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/1 "2006-05-31T21:25:52Z")

</div>

hi,

```
I'm very new to ruby, so I'm writing this email to just ask the

```

doability of this project in ruby with ruby/gtk2 bindings.

I need to make this app that loads an svg (a planimetry of a building)  
file and displays into a window. Then I have to trap mouse position and  
popup a window with another svg (schematics of a tool) when the user  
clicks on predefined zones of the building.

all this project has to work inside a cdrom, a friend of mine suggested  
to me to prepare with one click ruby installer a setup.exe and install  
it on the cdrom.

ok, that’s enough!

could you suggest to me if this thing is doable and if there are little  
tutorials regarding svg handling or already ruby apps that are doing  
similar tasks?

thanks! 🙂

ciao,  
Marco

–  
,= ,-_-. =.  
((_/)o o(\_)) jabber:removed\_email\_address@domain.invalid/msn:removed\_email\_address@domain.invalid  
`-'(. .)`-’ #removed\_email\_address@domain.invalid  
\_/ There’s no one inside that flat, everybody knows it

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [May 31, 2006, 10:02pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/2 "2006-05-31T22:02:24Z")

</div>

On Mi, 2006-05-31 at 21:23 +0200, Marco Milanesi wrote:

> all this project has to work inside a cdrom, a friend of mine suggested  
> to me to prepare with one click ruby installer a setup.exe and install  
> it on the cdrom.

hi,

if you only want to do the described (a kind of “svg-kiosk-thing”), the  
easiest way is completely without ruby. just use a svg-capable  
webbrowser like mozilla and a little bit of javascript for the mouse  
tracking.

if you need additional components i would suggest to use gtk-moz-embed  
for the display of the svg. to implement a svg render engine on your own  
is a _very big_ task. just take a look at the svg-specs at  
[Scalable Vector Graphics (SVG) 1.1 (Second Edition)](http://www.w3.org/TR/SVG11/) .

cheers  
detlef

> 

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [May 31, 2006, 10:05pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/3 "2006-05-31T22:05:48Z")

</div>

hi detlef,

> if you only want to do the described (a kind of “svg-kiosk-thing”), the  
> easiest way is completely without ruby. just use a svg-capable  
> webbrowser like mozilla and a little bit of javascript for the mouse  
> tracking.

yeah, that could be a solution. I haven’t thought about that. The  
problem is that it has to work also in IE 😕

> if you need additional components i would suggest to use gtk-moz-embed  
> for the display of the svg. to implement a svg render engine on your own  
> is a _very big_ task. just take a look at the svg-specs at  
> [Scalable Vector Graphics (SVG) 1.1 (Second Edition)](http://www.w3.org/TR/SVG11/) .

yeah, I was hoping in something like this! so the ruby binding of  
Gtk::MozEmbed could make the task? or is better to go c in your opinion?

thanks a lot for the tips, I appreciate 🙂

ciao,  
Marco

–  
,= ,-_-. =.  
((_/)o o(\_)) jabber:removed\_email\_address@domain.invalid/msn:removed\_email\_address@domain.invalid  
`-'(. .)`-’ #removed\_email\_address@domain.invalid  
\_/ There’s no one inside that flat, everybody knows it

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [May 31, 2006, 10:36pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/4 "2006-05-31T22:36:47Z")

</div>

On Mi, 2006-05-31 at 22:04 +0200, Marco Milanesi wrote:

> hi detlef,
> 
> > if you only want to do the described (a kind of “svg-kiosk-thing”), the  
> > easiest way is completely without ruby. just use a svg-capable  
> > webbrowser like mozilla and a little bit of javascript for the mouse  
> > tracking.
> 
> yeah, that could be a solution. I haven’t thought about that. The  
> problem is that it has to work also in IE 😕

you wrote, that you have to start it from cd. afaik you also can start  
programs direkt from cd (sorry, don’t know windoze). so just put the  
browser on the cd and start it via autostart.

> > if you need additional components i would suggest to use gtk-moz-embed  
> > for the display of the svg. to implement a svg render engine on your own  
> > is a _very big_ task. just take a look at the svg-specs at  
> > [Scalable Vector Graphics (SVG) 1.1 (Second Edition)](http://www.w3.org/TR/SVG11/) .
> 
> yeah, I was hoping in something like this! so the ruby binding of  
> Gtk::MozEmbed could make the task? or is better to go c in your opinion?

i never used gtk-moz-embed on my own, but mozilla can display svg and  
the use of ruby-gnome is very easy. after all, it is much easier as to  
write it all in c. from the performance point, its also no problem (as  
long as you don’t want to generate the svg’s on the fly in ruby) cause  
the main task of rendering the svg is done by mozilla and therefor  
implemented in c(++?).

> thanks a lot for the tips, I appreciate 🙂
> 
> ciao,  
> Marco

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [May 31, 2006, 10:49pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/5 "2006-05-31T22:49:07Z")

</div>

> > yeah, that could be a solution. I haven’t thought about that. The  
> > problem is that it has to work also in IE 😕  
> > you wrote, that you have to start it from cd. afaik you also can start  
> > programs direkt from cd (sorry, don’t know windoze). so just put the  
> > browser on the cd and start it via autostart.

me too (for the windows part). that’s an idea, maybe I will have much  
more fun with ruby though. I’ll evaluate.

> > yeah, I was hoping in something like this! so the ruby binding of  
> > Gtk::MozEmbed could make the task? or is better to go c in your opinion?  
> > i never used gtk-moz-embed on my own, but mozilla can display svg and  
> > the use of ruby-gnome is very easy. after all, it is much easier as to  
> > write it all in c. from the performance point, its also no problem (as  
> > long as you don’t want to generate the svg’s on the fly in ruby) cause  
> > the main task of rendering the svg is done by mozilla and therefor  
> > implemented in c(++?).

nono, only render the svg. ok, thanks a lot. now I have more useful  
informations about this work.

ciao,  
Marco

PS: thanks detlef. you have the same name of a character of the  
movie/book Christiane F. - Wir Kinder vom Bahnhof Zoo, nice 🙂

–  
,= ,-_-. =.  
((_/)o o(\_)) jabber:removed\_email\_address@domain.invalid/msn:removed\_email\_address@domain.invalid  
`-'(. .)`-’ #removed\_email\_address@domain.invalid  
\_/ There’s no one inside that flat, everybody knows it

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [June 1, 2006, 2:36am UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/6 "2006-06-01T02:36:16Z")

</div>

for the record I succeded by looking at the examples to load an svg and  
display it, here is the source:

require ‘rsvg2’  
require ‘gtk2’

Gtk.init

gdk\_pixbuf = RSVG.pixbuf\_from\_file(“./mysvg.svg”)

Gtk::Window.new.add(Gtk::Image.new(gdk\_pixbuf)).show\_all

Gtk.main

hope will be a start for a beautiful program 🙂  
nite all

ciao,  
Marco

–  
,= ,-_-. =.  
((_/)o o(\_)) jabber:removed\_email\_address@domain.invalid/msn:removed\_email\_address@domain.invalid  
`-'(. .)`-’ #removed\_email\_address@domain.invalid  
\_/ There’s no one inside that flat, everybody knows it

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [June 1, 2006, 11:35pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/7 "2006-06-01T23:35:28Z")

</div>

> And is it easy to put on a CD? (there is a not so easy explanation on  
> the site to make a ruby executable…)

I don’t know yet, when I succeed to run it under windows I’ll post (If I  
remember!) how I have done. Basically I predict that I’ll have to cross  
compile or compile under win (emulated yes) the required bindings/

ciao,  
Marco

–  
,= ,-_-. =.  
((_/)o o(\_)) jabber:removed\_email\_address@domain.invalid/msn:removed\_email\_address@domain.invalid  
`-'(. .)`-’ #removed\_email\_address@domain.invalid  
\_/ There’s no one inside that flat, everybody knows it

* * *

All the advantages of Linux Managed Hosting–Without the Cost and Risk!  
Fully trained technicians. The highest number of Red Hat certifications  
in  
the hosting industry. Fanatical Support. Click to learn more  
[http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642](http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642)

---

<div class="post-metadata">

**Author:** ![Marco\_Milanesi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Marco\_Milanesi](https://www.ruby-forum.com/u/Marco_Milanesi)\
**Post date:** [June 1, 2006, 7:54pm UTC](https://www.ruby-forum.com/t/ruby-app-using-svg-under-win32/62140/8 "2006-06-01T19:54:52Z")

</div>

Marco Milanesi azt Ã­rta, hogy:

> require ‘rsvg2’  
> require ‘gtk2’
> 
> Gtk.init
> 
> gdk\_pixbuf = RSVG.pixbuf\_from\_file("./mysvg.svg")
> 
> Gtk::Window.new.add(Gtk::Image.new(gdk\_pixbuf)).show\_all
> 
> Gtk.main

And is it easy to put on a CD? (there is a not so easy explanation on  
the site to make a ruby executable…)

Gergo
