> > I have a window which size is w=600, h=800, and has a jpeg
> > file which size is w=1024, h=768, I want to display the whole
> > image in the window.
> >
> > I have try to set the RESIZE_FIT and RESIZE_FILL flag, but is
> > still display partial of the image, how can I to scale the
> > image and display it in the window.
>
> I don't think fltk provides for automatic scaling of images, so you need
> to do that "by hand" yourself.
>
> The "correct" way to do this is to access the raw image data then apply
> whatever interpolation and filtering you think is appropriate to resize
> the image with minimal visual degradation.
Ian has a point here, the correct and best way to do this would be to use the
raw image data and then interpolate/filter this.
However, if you want to stretch/shrink the jpeg file to the window, the
following code snippet should do it. Note this does really horrible
interpolation though:
#include <fltk/Window.h>
#include <fltk/run.h>
#include <fltk/SharedImage.h>
using namespace fltk;
int main(){
register_images();
Window win(600, 800, "Test Window");
win.box(SharedImage::get("samplemine.jpg"));
win.show();
return run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk