> Thanks. I have use resize function to resize the window, and 
> it's widget, it is OK. 

That's good.

> But has one problem, if the widget has 
> image in it, the image will not scale with it.  How to make 
> the image also scale together with the widget?

Well, scaling of images is actually quite a hard thing to do well.

Fltk can do it for you, but the method it uses is deliberately
simplistic to make it "low cost" to do quickly. The downside to that is
that you can get some image degradation, and if you scale an image back
and forth a few times, the image will probably be ruined...

So, we need to understand how your images are being used:

If your image is "fixed", e.g. it is known at build time and is being
used to decorate the widget, e.g. as a background or etc., then you are
actually best to store two copies of the image, one optimised for
"portrait" layout, the other optimised for "landscape" layout, then
switch between them accordingly as you resize the widget.

If your widget is loaded dynamically, then you can resize it by
manipulating the image data directly - I think that you are using
fltk-2? (despite advice to the contrary...) in which case you want to
study the test examples image.cxx and pixmap_browser.cxx and see how
they scale the image to fit the widget.

However, if you are likely to be flipping back and forth between
orientations, you might still be better off caching a version of the
image, so if you start out in portrait mode (for example) and switch to
landscape mode, rather than discarding the portrait version of the image
you should maybe cache it for later use, if the user later switches back
to portrait you can re-use the cached version rather than resizing the
active image again...




SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to