Thanks Romain,

Your suggestion does indeed eliminate the link error.

Another fix would involve a core developer including xpmFileImage.o in the same 
fltk link library as fltk::register_images().  I could be wrong, as I haven't 
done any extensive comparisons of jpegImage and SharedImage, but I think 
fltk::register_image would add additional functionality such as use of texture 
formats other than jpeg.

Regards,

tm

> Hi Tom, the trick is not to use the register_images() function at all and use 
> 'jpegImage' instead of 'SharedImage' to load a JPEG picture.
> Here's the full source code for a splash screen that show in the middle for 3 
> seconds:
>
>
> #include <fltk/SharedImage.h>
> #include <fltk/Monitor.h>
> #include <fltk/Window.h>
> #include <fltk/run.h>
>
>
>
> fltk::Window* splash_screen() {
>
>       fltk::Window* o = new fltk::Window(550, 400, "splash screen");
>       o->type(241);
>       o->begin();
>               fltk::Group* g = new fltk::Group(0, 0, 550, 400);
>               g->image(fltk::jpegImage::get("data/splash.jpg"));
>               g->resizable(o);
>       o->end();
>       o->set_non_modal();
>       o->clear_border();
>       o->resizable(o);
>
>       o->border(false);
>       
> o->Rectangle::set(fltk::Monitor::find(0,0),o->w(),o->h(),fltk::ALIGN_CENTER);
>       o->show();
>       o->flush();
>
>       do {
>               fltk::check();
>
>       } while (!o->visible());
>
>       return o;
> }
>
>
>
>
> int main(int argc, char** argv) {
>
>       const bool show_splash = true;
>
>       // open splash screen
>       fltk::Window* splash_window = 0;
>       double splash_start = fltk::get_time_secs();
>
>               splash_window = splash_screen();
>
>               splash_window->show();
>
>               // hide splash screen after 3 seconds
>               while(splash_window->visible() && fltk::get_time_secs() - 
> splash_start < 3.0)
>                       fltk::check();
>
>               splash_window->hide();
>               delete splash_window;
>
>       return fltk::run();
> }
>
>
>
>
> > I have working code similar to yours ie. code that displays a texture on a 
> > widget, but referencing fltk::register_images() gives me a link error that 
> > I am avoiding by putting xpmFileImage.cxx in my source.
> >
> > What libraries are you linking with in order to avoid the following error?
> >
> > /usr/local/lib/libfltk2_images.a(xpmFileImage.o): In function 
> > `fltk::xpmFileImage::fetch()':
> > xpmFileImage.cxx:(.text+0x85): undefined reference to 
> > `fltk::xpmImage::fetch(fltk::Image&, char const* const*)'
> > xpmFileImage.cxx:(.text+0x2e1): undefined reference to 
> > `fltk::xpmImage::fetch(fltk::Image&, char const* const*)'
> > xpmFileImage.cxx:(.text+0x3af): undefined reference to 
> > `fltk::xpmImage::fetch(fltk::Image&, char const* const*)'
> >
> >
> > Thanks much.
> >
> > tm
> >
> > >   This works for me; shows the image in a borderless window.
> > >   Code based on the buttons.cxx example.
> > >
> > > #include <fltk/run.h>
> > > #include <fltk/Window.h>
> > > #include <fltk/SharedImage.h>
> > > int main() {
> > >     fltk::register_images();
> > >     fltk::Window win(720,486);
> > >     win.border(0);                        // borderless window
> > >     win.image(*fltk::SharedImage::get("/var/tmp/foo.jpg"));
> > >     win.end();
> > >     win.show();
> > >     return(fltk::run());
> > > }
> >
>

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

Reply via email to