/** * gtk_render_icon: * @context: a #GtkStyleContext * @cr: a #cairo_t * @pixbuf: a #GdkPixbuf containing the icon to draw * @x: X position for the @pixbuf * @y: Y position for the @pixbuf * * Renders the icon in @pixbuf at the specified @x and @y coordinates. * * This function will render the icon in @pixbuf at exactly its size, * regardless of scaling factors, which may not be appropriate when * drawing on displays with high pixel densities. * * You probably want to use gtk_render_icon_surface() instead, if you * already have a Cairo surface. * * Since: 3.2 **/ void gtk_render_icon (GtkStyleContext *context, cairo_t *cr, GdkPixbuf *pixbuf, gdouble x, gdouble y) { cairo_surface_t *surface; g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); g_return_if_fail (cr != NULL); cairo_save (cr); cairo_new_path (cr); surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL); gtk_css_style_render_icon_surface (gtk_style_context_lookup_style (context), cr, surface, x, y); cairo_surface_destroy (surface); cairo_restore (cr); }
/** * gtk_render_icon_surface: * @context: a #GtkStyleContext * @cr: a #cairo_t * @surface: a #cairo_surface_t containing the icon to draw * @x: X position for the @icon * @y: Y position for the @incon * * Renders the icon in @surface at the specified @x and @y coordinates. * * Since: 3.10 **/ void gtk_render_icon_surface (GtkStyleContext *context, cairo_t *cr, cairo_surface_t *surface, gdouble x, gdouble y) { g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); g_return_if_fail (cr != NULL); gtk_css_style_render_icon_surface (gtk_style_context_lookup_style (context), cr, surface, x, y); }
void _gtk_icon_helper_draw (GtkIconHelper *self, cairo_t *cr, gdouble x, gdouble y) { gtk_icon_helper_ensure_surface (self); if (self->priv->rendered_surface != NULL) { gtk_css_style_render_icon_surface (gtk_css_node_get_style (gtk_css_gadget_get_node (GTK_CSS_GADGET (self))), cr, self->priv->rendered_surface, x, y); } }