Skip to contents

Build a tile-source descriptor for the canvas

Usage

at_tile_source(
  img,
  level_max = NULL,
  tile_size = 512L,
  embed = TRUE,
  view = NULL,
  call = rlang::caller_env()
)

Arguments

img

An annot_image.

level_max

Optional maximum level to expose; the image maximum by default.

tile_size

Tile size in pixels. Default 512.

embed

Logical; embed a downsampled base image as a data URI (for the self-contained canvas). Default TRUE.

view

Optional band view: a list with operation (see at_band_operations()), bands and params. NULL shows natural-colour RGB (nearest bands to 640/550/460 nm for spectral cubes). Display only. A view that does not apply to img (for example bands it does not have) falls back to the default view and is reported in viewError.

call

The calling environment, for error reporting.

Value

A list describing the image for the widget: width, height (level-0 pixels), nBands, and the pyramid description tileSize, minLevel and maxLevel (informational: the built-in canvas displays a single embedded image rather than streaming tiles). When embed is TRUE it also has dataUri (a PNG data URI); when no image could be encoded, dataUri is absent and displayError says why, and the canvas shows that message instead of an image. viewError says why view was not applied, when it was not.