bm_pixel_picker() lets you use an interactive graphics device
to click on a bitmap's pixels and learn the
column/row coordinates for the clicked pixel and its integer/color value.
To end the program click a non-left mouse button within the graphics device.
Usage
bm_pixel_picker(x, ...)
# S3 method for class 'bm_bitmap'
bm_pixel_picker(
x,
...,
col = getOption("bittermelon.col", col_bitmap),
silent = FALSE
)
# S3 method for class 'bm_pixmap'
bm_pixel_picker(x, ..., silent = FALSE)
# S3 method for class 'raster'
bm_pixel_picker(x, ..., silent = FALSE)Arguments
- x
Either a
bm_bitmap(),bm_pixmap(), or raster object- ...
Currently ignored.
- col
Character vector of R color specifications. First color is used for values equal to 0, second color for values equal to 1, etc.
- silent
Don't generate messages about clicked pixels.
Value
A list with named components "row", "col", and "value" for the last clicked pixel returned invisibly.
See also
This function wraps grid::grid.locator().
Examples
if (interactive() && dev.interactive(orNone = TRUE)) {
corn <- farming_crops_16x16()$corn$portrait
bm_pixel_picker(corn)
}