These functions should generally be faster than the more generic read and write functions.
val make_block_offset : block:(int * int) ‑> offset:(int * int) ‑> offset_t
pixel_of_block_offset t
returns a function which may be used to convert
offsets within a block to pixel offsets within the band t
.
block
and an offset
within that block offset
returns the index of the matching pixel.block_of_pixel_offset t
returns a function which returns the
block_offset_t matching the pixel offset provided.
val get_block_count : (_, _) t ‑> int * int
get_block_count t
returns (nx, ny)
giving the number of blocks in the
band's x direction (nx
) and the number of blocks in the band's y
direction (ny
).
val get_size : (_, _) t ‑> int * int
get_size t
returns the native (x, y)
dimensions of the individual
blocks making up t
.
val read : ?data:('v, 'e, Bigarray.c_layout) Bigarray.Array2.t ‑> ('v, 'e) t ‑> column:int ‑> row:int ‑> ('v, 'e, Bigarray.c_layout) Bigarray.Array2.t
read ?data t ~column ~row
returns the block at given offset in t
.
data
must be
large enough to hold at least on block of values.data
is provided and does not have enough
elements to hold a block.val write : ('v, 'e) t ‑> column:int ‑> row:int ‑> ('v, 'e, Bigarray.c_layout) Bigarray.Array2.t ‑> unit
write t ~column ~row data
writes data
to the block at the given offset
in t
.
val iter : ('v, 'e) t ‑> read:bool ‑> write:bool ‑> (int ‑> int ‑> ('v, 'e, Bigarray.c_layout) Bigarray.Array2.t ‑> unit) ‑> unit
iter t ~read ~write f
applies f
to each block in t
. The read
and write
arguments determine if values are from t
, written to t
or
both.
i
index, j
index and a
bigarray with the contents of the current block. If read
is true
then the bigarray will contain the current contents of the block at
(i, j)
. If write
is true
then the contents of the bigarray will be
written to the block at (i, j)
after f
returns.val iter_read : ('v, 'e) t ‑> (int ‑> int ‑> ('v, 'e, Bigarray.c_layout) Bigarray.Array2.t ‑> unit) ‑> unit
iter_read t f
applies f
to each block in t
.
column
index, row
index and a
bigarray with the contents of the current block.val iter_write : ('v, 'e) t ‑> (int ‑> int ‑> ('v, 'e, Bigarray.c_layout) Bigarray.Array2.t ‑> unit) ‑> unit
iter_write t f
applies f
to each block in t
.
column
index, row
index and a
bigarray which should be filled with the values meant for the current
block.