Hello, all - I'm having a grand time making cpu stats for an embedded board show up in my ruby app, but I have run into a roadblock. I used RMagick's RVG graphics to create the graph, and it works fine when I just dump it to an image file such as .png. I'm trying to eliminate that step and write it directly to a panel in my Wx gui, but it appears -- and there's a statement in the docs that confirms it -- that RVG::Image != Magick::Image. I experimented quite a bit with the sample program that takes a RMagick image and inserts it, but I haven't been able to make those techniques work for RVG. Is there a conversion? I've started looking at the Wx GraphicsContext methodology, but it isn't as elegant. Suggestions? wxRuby 2.0.1 RMagick 2.12.1 Ubuntu 9.10 32 bit Ruby 1.87 p 302
on 2010-11-24 02:11
on 2010-11-25 16:32
On 24/11/10 00:48, Don Wilde wrote: > I've started looking at the Wx GraphicsContext methodology, but it > isn't as elegant. Suggestions? I'm not completely sure I understand what you want to do - but I think the easiest way is to Wx tell RVG to render the vector at a given resolution in a well-known bitmap format (eg PNG), and then display that in Wx. You can bypass writing the rendered image to disk by using Image.read, and a StringIO if necessary - so it can just be passed about in memory. Re-render the image when the display size changes. You might find something useful in my Ruby Quiz response for a Wx Mathematical Image Generator: http://rubyquiz.strd6.com/quizzes/191-mathematical... alex
on 2010-11-25 19:10
On Thu, Nov 25, 2010 at 7:13 AM, Alex Fenton <alex@pressure.to> wrote: >> conversion? > You can bypass writing the rendered image to disk by using Image.read, and > a StringIO if necessary - so it can just be passed about in memory. > Re-render the image when the display size changes. You might find something > useful in my Ruby Quiz response for a Wx Mathematical Image Generator: > http://rubyquiz.strd6.com/quizzes/191-mathematical... > > alex > Alex, thanks! Your presentation and the sample file in wxruby samples were outstanding and a heck of a lot of fun to play with. Some of the other demos get too cute for their own good, but yours was very clear. I am using it to figure out how to get my DC from point-painting to lines. I have decided to rework my code so that the graph-drawing code is embedded in the Window subclass and done completely in wx DC methodology. It's not as straightforwardly obvious and Ruby idiomatic, but I'm making it work and the code outside of the graph-drawing routine is getting much cleaner.
on 2010-11-25 19:12
On Thu, Nov 25, 2010 at 9:02 AM, Don Wilde <dwilde1@gmail.com> wrote: >>> bit with the sample program that takes a RMagick image and inserts it, but I >> a well-known bitmap format (eg PNG), and then display that in Wx. > Alex, thanks! > > > I should mention that I do know who Alonzo Church is, thanks to John McCarthy. Am I dating myself from the LISPocene Era? :D
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.