FLTK logo

[fltk.general] Problem with Displaying Image using FLTK 1.3.5 on Raspberry Pi 4 B

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Problem with Displaying Image using FLTK 1.3.5 on Raspberry Pi 4 B Dave Branson Oct 29, 2020  
 
I'm attempting to display a logo on the screen of my Pi.  When I run the C++ code below I get the window with it's label to display, but not the JPEG image.  The code compiled and linked, and the image resides in the same directory as the code.  Any advice would be appreciated.

// Display Image test

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_JPEG_Image.H>

// Global pointers for the GUI objects
Fl_Window *mywindow;
Fl_Box *mypicturebox;
Fl_JPEG_Image *logo;


// Callback function
void mybutton_cb(Fl_Widget * w, long int data)
{
if (data == 1) {
mypicturebox->image(logo);
mypicturebox->redraw();
}
}
int main()
{
// The main window
mywindow = new Fl_Window(480, 320, "Display Logo");

// Load the image
logo = new Fl_JPEG_Image("logo.jpg");

// Provide a box for the image
mypicturebox = new Fl_Box(16, 20, 320, 160);
mypicturebox->image(logo);

// Make the window visible
mywindow->end();
mywindow->show();
return Fl::run();
}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/70912bc0-ffd7-4708-bf5d-d45b82a093d5o%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.