gsize file_len,
int width,
int height,
+ double scale,
const GdkRGBA *fg,
const GdkRGBA *success_color,
const GdkRGBA *warning_color,
if (!pixbuf)
return NULL;
+ if (width == 0)
+ width = gdk_pixbuf_get_width (pixbuf) * scale;
+ if (height == 0)
+ height = gdk_pixbuf_get_height (pixbuf) * scale;
+
svg_width = g_strdup_printf ("%d", gdk_pixbuf_get_width (pixbuf));
- svg_height = g_strdup_printf ("%d",gdk_pixbuf_get_height (pixbuf));
+ svg_height = g_strdup_printf ("%d", gdk_pixbuf_get_height (pixbuf));
g_object_unref (pixbuf);
escaped_file_data = g_markup_escape_text (file_data, file_len);
gsize file_len,
int width,
int height,
+ double scale,
GError **error)
{
GdkRGBA r = { 1,0,0,1}, g = {0,1,0,1};
GdkPixbuf *loaded;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf = NULL;
int plane;
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
-
- gdk_pixbuf_fill (pixbuf, 0);
-
for (plane = 0; plane < 3; plane++)
{
/* Here we render the svg with all colors solid, this should
* channels, with the color of the fg being implicitly
* the "rest", as all color fractions should add up to 1.
*/
- loaded = load_symbolic_svg (file_data, file_len, width, height,
+ loaded = load_symbolic_svg (file_data, file_len, width, height, scale,
&g,
plane == 0 ? &r : &g,
plane == 1 ? &r : &g,
if (loaded == NULL)
return NULL;
+ if (pixbuf == NULL)
+ {
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
+ gdk_pixbuf_get_width (loaded),
+ gdk_pixbuf_get_height (loaded));
+ gdk_pixbuf_fill (pixbuf, 0);
+ }
+
if (plane == 0)
extract_plane (loaded, pixbuf, 3, 3);
gtk_make_symbolic_pixbuf_from_resource (const char *path,
int width,
int height,
+ double scale,
GError **error)
{
GBytes *bytes;
data = g_bytes_get_data (bytes, &size);
- pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, error);
+ pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
g_bytes_unref (bytes);
gtk_make_symbolic_pixbuf_from_file (GFile *file,
int width,
int height,
+ double scale,
GError **error)
{
char *data;
if (!g_file_load_contents (file, NULL, &data, &size, NULL, error))
return NULL;
- pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, error);
+ pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
g_free (data);
if (gtk_icon_info_is_symbolic (icon_info))
source_pixbuf = gtk_make_symbolic_pixbuf_from_resource (icon_info->filename,
size, size,
+ icon_info->desired_scale,
&icon_info->load_error);
else if (size == 0)
source_pixbuf = _gdk_pixbuf_new_from_resource_scaled (icon_info->filename,
if (gtk_icon_info_is_symbolic (icon_info) && icon_info->icon_file)
source_pixbuf = gtk_make_symbolic_pixbuf_from_file (icon_info->icon_file,
size, size,
+ icon_info->desired_scale,
&icon_info->load_error);
else if (size == 0)
source_pixbuf = _gdk_pixbuf_new_from_stream_scaled (stream,