diff options
| author | Zach DeCook <zachdecook@librem.one> | 2023-08-26 13:32:36 -0400 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2023-08-26 13:32:36 -0400 |
| commit | a8896b3bddd8a78ef5332b0bdbf644e5259b6063 (patch) | |
| tree | 7924f2d99850a6acb4664ff36d8fadce9b1a03cf /main.c | |
| parent | c6346c6ef55614e0a3471634acdf80c09a601071 (diff) | |
| download | shemuvi-a8896b3bddd8a78ef5332b0bdbf644e5259b6063.tar.gz | |
Load File: Display the newly-generated image
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c index 8a86f6f..1c48ecb 100644 --- a/main.c +++ b/main.c @@ -5,6 +5,8 @@ // Largest file we want to read #define BUF_SIZE 200000 +GtkWidget *window; + /* Called when a file is chosen by the open menu. */ static void set_file (GFile *file, gpointer data) { char *name; @@ -26,8 +28,15 @@ static void set_file (GFile *file, gpointer data) { fclose(cfile); vrvToolkit_loadData(pointer, buf); - output = vrvToolkit_renderToSVG(pointer, 1, FALSE); - puts(output); + output = vrvToolkit_renderToSVG(pointer, 1, TRUE); + + // https://stackoverflow.com/a/14123191/1861686 + GdkPixbufLoader *loader = gdk_pixbuf_loader_new (); + gdk_pixbuf_loader_write (loader, output, strlen(output), NULL); + gdk_pixbuf_loader_close(loader, NULL); + GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); + GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf); + gtk_window_set_child (GTK_WINDOW (window), image); // TODO: keep this around free(pointer); @@ -115,7 +124,6 @@ static void open_file (GtkButton *picker, GtkLabel *label) { } static void activate (GtkApplication* app, gpointer user_data) { - GtkWidget *window; GtkWidget *header; GtkWidget *image; GtkWidget *button; |
