[gtk/pango2: 1/2] Add an api for rendering PangoLines




commit ecc50dd88f288e501fcdf53d95c946fde1303aa0
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 18 12:34:28 2022 -0500

    Add an api for rendering PangoLines

 gtk/gskpango.c    | 20 ++++++++++++++++++++
 gtk/gtksnapshot.h |  5 +++++
 2 files changed, 25 insertions(+)
---
diff --git a/gtk/gskpango.c b/gtk/gskpango.c
index e96c84a2fc..6807ada46d 100644
--- a/gtk/gskpango.c
+++ b/gtk/gskpango.c
@@ -480,3 +480,23 @@ gtk_snapshot_append_layout (GtkSnapshot   *snapshot,
 
   gsk_pango_renderer_release (crenderer);
 }
+
+void
+gtk_snapshot_append_lines (GtkSnapshot   *snapshot,
+                            PangoLines   *lines,
+                            const GdkRGBA *color)
+{
+  GskPangoRenderer *crenderer;
+
+  g_return_if_fail (snapshot != NULL);
+  g_return_if_fail (PANGO_IS_LINES (lines));
+
+  crenderer = gsk_pango_renderer_acquire ();
+
+  crenderer->snapshot = snapshot;
+  crenderer->fg_color = color;
+
+  pango_renderer_draw_lines (PANGO_RENDERER (crenderer), lines, 0, 0);
+
+  gsk_pango_renderer_release (crenderer);
+}
diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h
index 6125e44ecc..4ff34b2cdb 100644
--- a/gtk/gtksnapshot.h
+++ b/gtk/gtksnapshot.h
@@ -224,6 +224,11 @@ void            gtk_snapshot_append_layout              (GtkSnapshot
                                                          PangoLayout            *layout,
                                                          const GdkRGBA          *color);
 
+GDK_AVAILABLE_IN_ALL
+void            gtk_snapshot_append_lines               (GtkSnapshot            *snapshot,
+                                                         PangoLines             *lines,
+                                                         const GdkRGBA          *color);
+
 
 GDK_AVAILABLE_IN_ALL
 void            gtk_snapshot_render_background          (GtkSnapshot            *snapshot,


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