[gtk/wip/matthiasc/icon-theme: 7/12] Add another symbolic pixbuf helper



commit 3c219bf968fe698269e54896715066acba23db16
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 18 07:46:52 2019 -0500

    Add another symbolic pixbuf helper

 gtk/gdkpixbufutilsprivate.h |  5 +++++
 gtk/tools/gdkpixbufutils.c  | 21 +++++++++++++++++++++
 2 files changed, 26 insertions(+)
---
diff --git a/gtk/gdkpixbufutilsprivate.h b/gtk/gdkpixbufutilsprivate.h
index 592bc9ea59..bd6125ea52 100644
--- a/gtk/gdkpixbufutilsprivate.h
+++ b/gtk/gdkpixbufutilsprivate.h
@@ -63,6 +63,11 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_file     (GFile         *file,
                                                    int            height,
                                                    double         scale,
                                                    GError       **error);
+GdkPixbuf *gtk_make_symbolic_pixbuf_from_path     (const char    *path,
+                                                   int            width,
+                                                   int            height,
+                                                   double         scale,
+                                                   GError       **error);
 GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char    *path,
                                                    int            width,
                                                    int            height,
diff --git a/gtk/tools/gdkpixbufutils.c b/gtk/tools/gdkpixbufutils.c
index a572f48a82..ae2684adb2 100644
--- a/gtk/tools/gdkpixbufutils.c
+++ b/gtk/tools/gdkpixbufutils.c
@@ -425,6 +425,27 @@ gtk_make_symbolic_pixbuf_from_resource (const char  *path,
   return pixbuf;
 }
 
+GdkPixbuf *
+gtk_make_symbolic_pixbuf_from_path (const char  *path,
+                                    int          width,
+                                    int          height,
+                                    double       scale,
+                                    GError     **error)
+{
+  char *data;
+  gsize size;
+  GdkPixbuf *pixbuf;
+
+  if (!g_file_get_contents (path, &data, &size, error))
+    return NULL;
+
+  pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
+
+  g_free (data);
+
+  return pixbuf;
+}
+
 GdkPixbuf *
 gtk_make_symbolic_pixbuf_from_file (GFile       *file,
                                     int          width,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]