Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Scaling image with FXRuby

Reply
Thread Tools

Scaling image with FXRuby

 
 
Thomas Leitner
Guest
Posts: n/a
 
      01-17-2005
Hy,

I try to scale an image in FXRuby. First I create the image with

icon = FXPNGIcon.new( getApp(), "image.png" )
icon.create

and then I do this

icon.scale( 100, 100 )
dc.drawIcon(icon, 0, 0)

This should draw the scaled icon on the specified DeviceContext,
however, the result is distorted.

What I try to accomplish:
- First load the png picture with transparent background
- Scale the picture depending on the current window size
- Draw the scaled image

Is there method like drawIcon( icon, x, y, width, height) available?
This would simply everything!

If not: Can anyone advise me on how to do this? I could not find a
solution...

Thomas

--
|\ Thomas Leitner -- thomas [underscore] leitner [at] gmx [dot] at
|>
|/ "Life is what happens to you while you're busy making other plans"
 
Reply With Quote
 
 
 
 
Sander Jansen
Guest
Posts: n/a
 
      02-16-2005
Make sure IMAGE_KEEP flag is passed when you construct a FXIcon. icon.create
will throw away the icon data if you don't pass this flag. Scaling is done
only on the client side. If there's no client side data, it will do a normal
resize and the content of the image is then undefined.

Another option is to do a create after scaling the icon.

Hope this helps,

Sander




On Monday 17 January 2005 04:36 am, Thomas Leitner wrote:
> Hy,
>
> I try to scale an image in FXRuby. First I create the image with
>
> icon = FXPNGIcon.new( getApp(), "image.png" )
> icon.create
>
> and then I do this
>
> icon.scale( 100, 100 )
> dc.drawIcon(icon, 0, 0)
>
> This should draw the scaled icon on the specified DeviceContext,
> however, the result is distorted.
>
> What I try to accomplish:
> - First load the png picture with transparent background
> - Scale the picture depending on the current window size
> - Draw the scaled image
>
> Is there method like drawIcon( icon, x, y, width, height) available?
> This would simply everything!
>
> If not: Can anyone advise me on how to do this? I could not find a
> solution...
>
> Thomas



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] At InfoQ: Interview about FXRuby, plus an exclusive chapterfrom the FXRuby Book Lyle Johnson Ruby 0 05-20-2008 02:32 PM
prevent image scaling for high dpi displays Yofnik ASP .Net 3 01-27-2007 05:50 PM
FXRuby Image Scaling question Patrick Hurley Ruby 2 02-02-2006 07:20 PM
Scaling PNG image ko021_626@hotmail.com Java 3 04-30-2004 01:37 PM
Overriding browser image auto-scaling Daniel L. Bateman HTML 6 10-30-2003 09:59 PM



Advertisments