QPainterPath unfortunately does not allow "empty space" within its bounding rectangle. For now, it's probably best to just get the painter transform and figure out the necessary offset in pixels. If this turns out to be a common problem, we could think about glyph anchor points.<br>
<br>Michael<br><br><div class="gmail_quote">On Thu, May 26, 2011 at 8:09 PM, Yihui Xie <span dir="ltr"><<a href="mailto:xieyihui@gmail.com">xieyihui@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
Is it possible to create a "one-sided" glyph? For example, a segment<br>
glyph that goes from (0, 0) to (1, 0) and when we draw it with<br>
qdrawGlyph(..., x, y), (0, 0) in the glyph corresponds to (x, y) in<br>
the plot. Currently it seems the glyphs are always centered around (x,<br>
y).<br>
<br>
The example below uses qglyphSegment() in:<br>
<a href="https://github.com/ggobi/qtpaint/blob/master/R/paintUtils.R#L45" target="_blank">https://github.com/ggobi/qtpaint/blob/master/R/paintUtils.R#L45</a><br>
<br>
library(qtbase)<br>
library(qtpaint)<br>
s = qscene()<br>
r = qlayer(s)<br>
r[1, 1] = qlayer(paintFun = function(layer, painter) {<br>
qdrawCircle(painter, .3, .3, r = 2)<br>
qdrawGlyph(painter, qglyphSegment(x = 20, symm = FALSE), .3, .3)<br>
qdrawCircle(painter, .5, .5, r = 2)<br>
qdrawGlyph(painter, qglyphSegment(x = 30, d = pi/2, symm = FALSE), .5, .5)<br>
}, limits = qrect(matrix(c(0, 1, 0, 1), 2)))<br>
print(qplotView(scene = s))<br>
<br>
<br>
Thanks!<br>
<br>
Regards,<br>
Yihui<br>
--<br>
<font color="#888888">Yihui Xie <<a href="mailto:xieyihui@gmail.com">xieyihui@gmail.com</a>><br>
Phone: 515-294-2465 Web: <a href="http://yihui.name" target="_blank">http://yihui.name</a><br>
Department of Statistics, Iowa State University<br>
2215 Snedecor Hall, Ames, IA<br>
_______________________________________________<br>
Qtinterfaces-devel mailing list<br>
<a href="mailto:Qtinterfaces-devel@lists.r-forge.r-project.org">Qtinterfaces-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel</a><br>
</font></blockquote></div><br>