[pangomm] Renderer: Add vfuncs
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pangomm] Renderer: Add vfuncs
- Date: Wed, 22 Jul 2020 08:38:39 +0000 (UTC)
commit 6fa7fe50da999e2d60e47171b420930c292e37d4
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Wed Jul 22 10:36:42 2020 +0200
Renderer: Add vfuncs
See #9
pango/src/pango_vfuncs.defs | 108 +++++++++++++++++++++++++++++++++++++++++---
pango/src/renderer.ccg | 6 +--
pango/src/renderer.hg | 33 ++++++++++++--
3 files changed, 132 insertions(+), 15 deletions(-)
---
diff --git a/pango/src/pango_vfuncs.defs b/pango/src/pango_vfuncs.defs
index 2bdd048..95ec56d 100644
--- a/pango/src/pango_vfuncs.defs
+++ b/pango/src/pango_vfuncs.defs
@@ -2,16 +2,110 @@
; virtual function definitions
; define-vfunc is gtkmm-specific
-; PangoFontFace
+; PangoRenderer
-(define-vfunc get_face_name
- (of-object "PangoFontFace")
- (return-type "const-gchar*")
+(define-vfunc draw_glyphs
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoFont*" "font")
+ '("PangoGlyphString*" "glyphs")
+ '("int" "x")
+ '("int" "y")
+ )
)
-(define-vfunc describe
- (of-object "PangoFontFace")
- (return-type "PangoFontDescription*")
+(define-vfunc draw_rectangle
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoRenderPart" "part")
+ '("int" "x")
+ '("int" "y")
+ '("int" "width")
+ '("int" "height")
+ )
)
+(define-vfunc draw_error_underline
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("int" "x")
+ '("int" "y")
+ '("int" "width")
+ '("int" "height")
+ )
+)
+
+(define-vfunc draw_shape
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoAttrShape*" "attr")
+ '("int" "x")
+ '("int" "y")
+ )
+)
+
+(define-vfunc draw_trapezoid
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoRenderPart" "part")
+ '("double" "y1")
+ '("double" "x11")
+ '("double" "x21")
+ '("double" "y2")
+ '("double" "x12")
+ '("double" "x22")
+ )
+)
+
+(define-vfunc draw_glyph
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoFont*" "font")
+ '("PangoGlyph" "glyph")
+ '("double" "x")
+ '("double" "y")
+ )
+)
+
+(define-vfunc part_changed
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoRenderPart" "part")
+ )
+)
+
+(define-vfunc begin
+ (of-object "PangoRenderer")
+ (return-type "void")
+)
+
+(define-vfunc end
+ (of-object "PangoRenderer")
+ (return-type "void")
+)
+
+(define-vfunc prepare_run
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("PangoLayoutRun*" "run")
+ )
+)
+(define-vfunc draw_glyph_item
+ (of-object "PangoRenderer")
+ (return-type "void")
+ (parameters
+ '("const-char*" "text")
+ '("PangoGlyphItem*" "glyph_item")
+ '("int" "x")
+ '("int" "y")
+ )
+)
diff --git a/pango/src/renderer.ccg b/pango/src/renderer.ccg
index 8057555..e1b79c5 100644
--- a/pango/src/renderer.ccg
+++ b/pango/src/renderer.ccg
@@ -1,8 +1,4 @@
-// -*- c++ -*-
-/* $Id: renderer.ccg,v 1.2 2006/06/10 15:26:24 murrayc Exp $ */
-
/*
- *
* Copyright 2004 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
@@ -23,6 +19,8 @@
#include <pango/pango-renderer.h>
#include <pango/pango-types.h> //For PANGO_MATRIX_INIT
+using Part = Pango::Renderer::Part;
+
namespace Pango
{
diff --git a/pango/src/renderer.hg b/pango/src/renderer.hg
index 7476856..733ceaf 100644
--- a/pango/src/renderer.hg
+++ b/pango/src/renderer.hg
@@ -1,5 +1,3 @@
-/* $Id: renderer.hg,v 1.4 2006/06/10 15:26:24 murrayc Exp $ */
-
/* renderer.h
*
* Copyright(C) 2004 The gtkmm Development Team
@@ -29,6 +27,7 @@
_DEFS(pangomm,pango)
_PINCLUDE(glibmm/private/object_p.h)
+_PINCLUDE(pango/pango-renderer.h)
namespace Pango
{
@@ -70,7 +69,11 @@ public:
_WRAP_METHOD(void set_matrix(const Matrix& matrix), pango_renderer_set_matrix)
- //TODO: Documentation:
+ /** Gets the transformation matrix that will be applied when rendering.
+ * See set_matrix().
+ *
+ * @return The matrix. If no matrix has been set, an identity matrix is returned.
+ */
Matrix get_matrix() const;
_IGNORE(pango_renderer_get_matrix)
@@ -79,7 +82,29 @@ public:
_WRAP_METHOD(Glib::RefPtr<LayoutLine> get_layout_line(), pango_renderer_get_layout_line, refreturn)
_WRAP_METHOD(Glib::RefPtr<const LayoutLine> get_layout_line() const, pango_renderer_get_layout_line,
refreturn, constversion)
+
+protected:
+#m4begin
+_CONVERSION(`PangoFont*',`const Glib::RefPtr<Font>&',`Glib::wrap($3, true)')
+_CONVERSION(`PangoGlyphString*',`const GlyphString&',`Glib::wrap($3, true)')
+_CONVERSION(`const AttrShape&',`PangoAttrShape*',`const_cast<PangoAttrShape*>(($3).gobj())')
+_CONVERSION(`PangoAttrShape*',`const AttrShape&',`Glib::wrap($3, true)')
+_CONVERSION(`const LayoutRun&',`PangoLayoutRun*',`const_cast<PangoLayoutRun*>(($3).gobj())')
+_CONVERSION(`PangoLayoutRun*',`const LayoutRun&',`Glib::wrap($3, true)')
+_CONVERSION(`const GlyphItem&',`PangoGlyphItem*',`const_cast<PangoGlyphItem*>(($3).gobj())')
+_CONVERSION(`PangoGlyphItem*',`const GlyphItem&',`Glib::wrap($3, true)')
+#m4end
+ _WRAP_VFUNC(void draw_glyphs(const Glib::RefPtr<Font>& font, const GlyphString& glyphs, int x, int y),
draw_glyphs)
+ _WRAP_VFUNC(void draw_rectangle(Part part, int x, int y, int width, int height), draw_rectangle)
+ _WRAP_VFUNC(void draw_error_underline(int x, int y, int width, int height), draw_error_underline)
+ _WRAP_VFUNC(void draw_shape(const AttrShape& attr, int x, int y), draw_shape)
+ _WRAP_VFUNC(void draw_trapezoid(Part part, double y1, double x11, double x21, double y2, double x12,
double x22), draw_trapezoid)
+ _WRAP_VFUNC(void draw_glyph(const Glib::RefPtr<Font>& font, Glyph glyph, double x, double y), draw_glyph)
+ _WRAP_VFUNC(void part_changed(Part part), part_changed)
+ _WRAP_VFUNC(void begin(), begin)
+ _WRAP_VFUNC(void end(), end)
+ _WRAP_VFUNC(void prepare_run(const LayoutRun& run), prepare_run)
+ _WRAP_VFUNC(void draw_glyph_item(const Glib::ustring& text, const GlyphItem& glyph_item, int x, int y),
draw_glyph_item)
};
} /* namespace Pango */
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]