Description Usage Arguments Value Author(s) Examples
This function calculates the relative size of one pixel in a layer coordinate system, since it has different relative dimensions in different coordinate systems.
1 | one_pixel(painter)
|
painter |
the painter of a layer |
A numeric vector of length 2 (width and height).
Yihui Xie <http://yihui.name>
1 2 3 4 5 6 7 8 9 | library(qtpaint)
s <- qscene()
qlayer(s, paintFun = function(layer, painter) {
d <- one_pixel(painter)
# one pixel segments
qdrawSegment(painter, 0.1, seq(0, 1, 0.1), 0.1 + d[1], seq(0, 1, 0.1))
qdrawRect(painter, 0.3, 0.4, 0.3 + d[1], 0.4 + d[2]) # one pixel rectangle
}, limits = qrect(c(0, 1), c(0, 1)))
qplotView(scene = s)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.