Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Bitmap/R/bitmap.r
Normal file
19
Task/Bitmap/R/bitmap.r
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# See the class definitions and constructors with, e.g.
|
||||
getClass("pixmapIndexed", package=pixmap)
|
||||
pixmapIndexed
|
||||
|
||||
# Image with all one colour
|
||||
plot(p1 <- pixmapIndexed(matrix(0, nrow=3, ncol=4), col="red"))
|
||||
|
||||
# Image with one pixel specified
|
||||
cols <- rep("blue", 12); cols[7] <- "red"
|
||||
plot(p2 <- pixmapIndexed(matrix(1:12, nrow=3, ncol=4), col=cols))
|
||||
|
||||
# Retrieve colour of a pixel
|
||||
getcol <- function(pm, i, j)
|
||||
{
|
||||
pmcol <- pm@col
|
||||
dim(pmcol) <- dim(pm@index)
|
||||
pmcol[i,j]
|
||||
}
|
||||
getcol(p2, 3, 4) #red
|
||||
Loading…
Add table
Add a link
Reference in a new issue