HI..
I am currently learning to code in C & have managed to code a super simple image viewer. It does what it is supposed to, but if I open any image that is larger than my screens resolution then parts of the open image get cut off. I also cannot resize images. Could someone please help me ?? I would like to code the window so that it if the image is larger than my resolution (1920x1080) it is automatically scaled down to either fit the height or width. I'd also like images to scale to the window size if possible also. I've attached my code below. Sorry if this is a silly question, but I'm just starting out and slowly learning. Many thanks....
Code:
#include <gtk/gtk.h>
void destroy(void) {
gtk_main_quit();
}
int main (int argc, char** argv) {
GtkWidget* window;
GtkWidget* image;
gtk_init (&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
image = gtk_image_new_from_file(argv[1]);
gtk_signal_connect(GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (destroy), NULL);
gtk_container_add(GTK_CONTAINER (window), image);
gtk_widget_show_all(window);
gtk_main();
return 0;
}