[RQt-devel] one-sided glyph?
Michael Lawrence
lawrence.michael at gene.com
Fri May 27 10:50:59 CEST 2011
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.
Michael
On Thu, May 26, 2011 at 8:09 PM, Yihui Xie <xieyihui at gmail.com> wrote:
> Hi,
>
> Is it possible to create a "one-sided" glyph? For example, a segment
> glyph that goes from (0, 0) to (1, 0) and when we draw it with
> qdrawGlyph(..., x, y), (0, 0) in the glyph corresponds to (x, y) in
> the plot. Currently it seems the glyphs are always centered around (x,
> y).
>
> The example below uses qglyphSegment() in:
> https://github.com/ggobi/qtpaint/blob/master/R/paintUtils.R#L45
>
> library(qtbase)
> library(qtpaint)
> s = qscene()
> r = qlayer(s)
> r[1, 1] = qlayer(paintFun = function(layer, painter) {
> qdrawCircle(painter, .3, .3, r = 2)
> qdrawGlyph(painter, qglyphSegment(x = 20, symm = FALSE), .3, .3)
> qdrawCircle(painter, .5, .5, r = 2)
> qdrawGlyph(painter, qglyphSegment(x = 30, d = pi/2, symm = FALSE), .5,
> .5)
> }, limits = qrect(matrix(c(0, 1, 0, 1), 2)))
> print(qplotView(scene = s))
>
>
> Thanks!
>
> Regards,
> Yihui
> --
> Yihui Xie <xieyihui at gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
> _______________________________________________
> Qtinterfaces-devel mailing list
> Qtinterfaces-devel at lists.r-forge.r-project.org
>
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/qtinterfaces-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20110527/fdebf1ee/attachment.htm>
More information about the Qtinterfaces-devel
mailing list