Scaling image with FXRuby

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"

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