selection: Add surface based apis

Add gtk_selection_data_set_surface.
This commit is contained in:
Matthias Clasen
2017-10-22 22:19:31 +02:00
parent e5ce3144e0
commit ad00108678
2 changed files with 20 additions and 0 deletions

View File

@@ -1733,6 +1733,23 @@ gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
return FALSE;
}
gboolean
gtk_selection_data_set_surface (GtkSelectionData *selection_data,
cairo_surface_t *surface)
{
GdkPixbuf *pixbuf;
gboolean retval;
pixbuf = gdk_pixbuf_get_from_surface (surface,
0, 0,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
retval = gtk_selection_data_set_pixbuf (selection_data, pixbuf);
g_object_unref (pixbuf);
return retval;
}
/**
* gtk_selection_data_get_pixbuf:
* @selection_data: a #GtkSelectionData

View File

@@ -224,6 +224,9 @@ guchar * gtk_selection_data_get_text (const GtkSelectionData *selection_data
GDK_AVAILABLE_IN_ALL
gboolean gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_3_94
gboolean gtk_selection_data_set_surface (GtkSelectionData *selection_data,
cairo_surface_t *surface);
GDK_AVAILABLE_IN_ALL
GdkPixbuf *gtk_selection_data_get_pixbuf (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL