[gimp/gimp-2-10] Issue #2446 - DPI information is not stored in clipboard
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #2446 - DPI information is not stored in clipboard
- Date: Fri, 4 Jan 2019 17:14:06 +0000 (UTC)
commit adbac2f6804d6b6be018e8dfe2958734d13d6d54
Author: Michael Natterer <mitch gimp org>
Date: Fri Jan 4 18:11:12 2019 +0100
Issue #2446 - DPI information is not stored in clipboard
Set the "x-dpi" and "y-dpi" options on the GdkPixbuf set on the
clipboard. There is not much more we can do, getting that value across
the clipboard is out of our control, but at least we set the vlaues
now.
(cherry picked from commit a0263f40d0824be031b3ddb450eb8009ad864b26)
app/widgets/gimpclipboard.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/app/widgets/gimpclipboard.c b/app/widgets/gimpclipboard.c
index 75c143d078..7f3e58b6a9 100644
--- a/app/widgets/gimpclipboard.c
+++ b/app/widgets/gimpclipboard.c
@@ -22,6 +22,8 @@
#include <gegl.h>
#include <gtk/gtk.h>
+#include "libgimpmath/gimpmath.h"
+
#include "widgets-types.h"
#include "core/gimp.h"
@@ -1167,6 +1169,18 @@ gimp_clipboard_send_image (GtkClipboard *clipboard,
if (pixbuf)
{
+ gdouble res_x;
+ gdouble res_y;
+ gchar str[16];
+
+ gimp_image_get_resolution (gimp_clip->image, &res_x, &res_y);
+
+ g_snprintf (str, sizeof (str), "%d", ROUND (res_x));
+ gdk_pixbuf_set_option (pixbuf, "x-dpi", str);
+
+ g_snprintf (str, sizeof (str), "%d", ROUND (res_y));
+ gdk_pixbuf_set_option (pixbuf, "y-dpi", str);
+
if (gimp->be_verbose)
g_printerr ("clipboard: sending image data as '%s'\n",
gimp_clip->image_target_entries[info].target);
@@ -1200,6 +1214,18 @@ gimp_clipboard_send_buffer (GtkClipboard *clipboard,
if (pixbuf)
{
+ gdouble res_x;
+ gdouble res_y;
+ gchar str[16];
+
+ gimp_buffer_get_resolution (gimp_clip->buffer, &res_x, &res_y);
+
+ g_snprintf (str, sizeof (str), "%d", ROUND (res_x));
+ gdk_pixbuf_set_option (pixbuf, "x-dpi", str);
+
+ g_snprintf (str, sizeof (str), "%d", ROUND (res_y));
+ gdk_pixbuf_set_option (pixbuf, "y-dpi", str);
+
if (gimp->be_verbose)
g_printerr ("clipboard: sending pixbuf data as '%s'\n",
gimp_clip->buffer_target_entries[info].target);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]