-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
infrastructure for image loader backend
- Loading branch information
Showing
6 changed files
with
86 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
#include "main.h" | ||
#include "image-load.h" | ||
#include "image_load_gdk.h" | ||
|
||
|
||
static gchar* image_loader_gdk_get_format_name(GObject *loader) | ||
{ | ||
return gdk_pixbuf_format_get_name(gdk_pixbuf_loader_get_format(GDK_PIXBUF_LOADER(loader))); | ||
} | ||
static gchar** image_loader_gdk_get_format_mime_types(GObject *loader) | ||
{ | ||
return gdk_pixbuf_format_get_mime_types(gdk_pixbuf_loader_get_format(GDK_PIXBUF_LOADER(loader))); | ||
} | ||
|
||
static gpointer image_loader_gdk_new(GCallback area_updated_cb, GCallback size_cb, GCallback area_prepared_cb, gpointer data) | ||
{ | ||
GdkPixbufLoader *loader = gdk_pixbuf_loader_new(); | ||
|
||
g_signal_connect(G_OBJECT(loader), "area_updated", area_updated_cb, data); | ||
g_signal_connect(G_OBJECT(loader), "size_prepared", size_cb, data); | ||
g_signal_connect(G_OBJECT(loader), "area_prepared", area_prepared_cb, data); | ||
return (gpointer) loader; | ||
} | ||
|
||
void image_loader_backend_set_default(ImageLoaderBackend *funcs) | ||
{ | ||
funcs->loader_new = image_loader_gdk_new; | ||
funcs->set_size = gdk_pixbuf_loader_set_size; | ||
funcs->write = gdk_pixbuf_loader_write; | ||
funcs->get_pixbuf = gdk_pixbuf_loader_get_pixbuf; | ||
funcs->close = gdk_pixbuf_loader_close; | ||
|
||
funcs->get_format_name = image_loader_gdk_get_format_name; | ||
funcs->get_format_mime_types = image_loader_gdk_get_format_mime_types; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
#ifndef IMAGE_LOAD_GDK_H | ||
#define IMAGE_LOAD_GDK_H | ||
|
||
void image_loader_backend_set_default(ImageLoaderBackend *funcs); | ||
|
||
#endif | ||
|