The R Project SVN R

Rev

Rev 83781 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 83781 Rev 83917
Line 10... Line 10...
10
        y <- y + unit(rev(seq(n)) - mean(seq(n)), "lines")
10
        y <- y + unit(rev(seq(n)) - mean(seq(n)), "lines")
11
    }
11
    }
12
    grid.text(lines, y=y, gp=gpar(fontfamily="HersheySans"))
12
    grid.text(lines, y=y, gp=gpar(fontfamily="HersheySans"))
13
}
13
}
14
 
14
 
-
 
15
devMask <- function(aMask, lMask) {
-
 
16
    support <- dev.capabilities()$masks
-
 
17
    if (is.character(support)) {
-
 
18
        if ("alpha" %in% support) {
-
 
19
            aMask
-
 
20
        } else {
-
 
21
            if ("luminance" %in% support) {
-
 
22
                as.mask(lMask, type="luminance")
-
 
23
            } else {
-
 
24
                FALSE
-
 
25
            }
-
 
26
        }
-
 
27
    } else {
-
 
28
        FALSE
-
 
29
    }
-
 
30
}
-
 
31
 
15
################################################################################
32
################################################################################
16
## Gradients
33
## Gradients
17
 
34
 
18
## Simple linear gradient on grob
35
## Simple linear gradient on grob
19
grid.newpage()
36
grid.newpage()
Line 434... Line 451...
434
 
451
 
435
grid.newpage()
452
grid.newpage()
436
pat <-
453
pat <-
437
    pattern(circleGrob(gp=gpar(col=NA, fill="grey"),
454
    pattern(circleGrob(gp=gpar(col=NA, fill="grey"),
438
                       vp=viewport(width=.2, height=.2,
455
                       vp=viewport(width=.2, height=.2,
439
                                   mask=rectGrob(x=c(1, 3)/4,
456
                                   mask=devMask(rectGrob(x=c(1, 3)/4,
440
                                                 width=.3,
457
                                                         width=.3,
441
                                                 gp=gpar(fill="black")))),
458
                                                         gp=gpar(fill="black")),
-
 
459
                                                rectGrob(x=c(1, 3)/4,
-
 
460
                                                         width=.3,
-
 
461
                                                         gp=gpar(col="white",
-
 
462
                                                                 fill="white"))))),
442
            width=1/4, height=1/4,
463
            width=1/4, height=1/4,
443
            extend="repeat")
464
            extend="repeat")
444
grid.rect(width=.5, height=.5, gp=gpar(fill=pat))
465
grid.rect(width=.5, height=.5, gp=gpar(fill=pat))
445
HersheyLabel("rect in centre with pattern fill
466
HersheyLabel("rect in centre with pattern fill
446
pattern is circle drawn in smaller viewport
467
pattern is circle drawn in smaller viewport