Standard type for blit
functions, and reusable code for validating blit
arguments.
If blit : (src, dst) blit
, then blit ~src ~src_pos ~len ~dst ~dst_pos
blits len
values from src
starting at position src_pos
to dst
at position dst_pos
.
Furthermore, blit
raises if src_pos
, len
, and dst_pos
don't specify valid
slices of src
and dst
.
blito
is like blit
, except that the src_pos
, src_len
, and dst_pos
are
optional (hence the "o" in "blito"). Also, we use src_len
rather than len
as a
reminder that if src_len
isn't supplied, then the default is to take the slice
running from src_pos
to the end of src
.
If sub : (src, dst) sub
, then sub ~src ~pos ~len
returns a sequence of type dst
containing len
characters of src
starting at pos
.
subo
is like sub
, except pos
and len
are optional.
Users of modules matching the blit signatures S
, S1
, and S1_distinct
only need
to understand the code above. The code below is only for those that need to implement
modules that match those signatures.