linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [RFC PATCH 3/3] kernel-shark: Add text rendering to the plotting example
Date: Mon,  1 Jul 2019 15:17:20 +0300	[thread overview]
Message-ID: <20190701121720.18009-4-y.karadz@gmail.com> (raw)
In-Reply-To: <20190701121720.18009-1-y.karadz@gmail.com>

run:
kernel-shark/bin/dplot -s

And if the font file is loaded successfully you will see "Hello Kernel!"
rendered.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/examples/dataplot.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/kernel-shark/examples/dataplot.cpp b/kernel-shark/examples/dataplot.cpp
index 94841e7..1f06dc9 100644
--- a/kernel-shark/examples/dataplot.cpp
+++ b/kernel-shark/examples/dataplot.cpp
@@ -27,6 +27,9 @@ using namespace std;
 
 #define default_file (char*)"trace.dat"
 
+struct ksplot_font font;
+const char *font_file = "/usr/share/fonts/truetype/msttcorefonts/times.ttf";
+
 struct kshark_trace_histo	histo;
 vector<KsPlot::Graph *>		graphs;
 
@@ -72,6 +75,11 @@ void drawShapes()
 	r.setFill(false);
 	r.draw();
 
+	if (ksplot_init_font(&font, 60, font_file)) {
+		struct ksplot_color col = {100, 255, 0};
+		ksplot_print_text(&font, &col, 250, 70, "Hello Kernel!");
+	}
+
 	glFlush();
 }
 
-- 
2.20.1


      parent reply	other threads:[~2019-07-01 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 12:17 [RFC PATCH 0/3] Add support for text rendering Yordan Karadzhov (VMware)
2019-07-01 12:17 ` [RFC PATCH 1/3] kernel-shark: Simplify the drawing of the Triangle Fan Yordan Karadzhov (VMware)
2019-07-01 12:17 ` [RFC PATCH 2/3] kernel-shark: Add support for drawing text Yordan Karadzhov (VMware)
2019-07-01 14:35   ` Slavomir Kaslev
2019-07-01 14:50   ` Slavomir Kaslev
2019-07-01 12:17 ` Yordan Karadzhov (VMware) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190701121720.18009-4-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).