starting work to allow full resolution slicing

This commit is contained in:
John Evans 2014-09-12 10:06:09 -04:00
commit 276a74ecaa

View file

@ -770,10 +770,19 @@ class Jp2k(Jp2kBox):
else: else:
raise IndexError("Illegal syntax.") raise IndexError("Illegal syntax.")
if isinstance(pargs[0], tuple): if not isinstance(pargs[0], tuple):
msg = "Unexpected situation, slicing invoked, but not passed "
msg += "a slice or tuple."
raise RuntimeError(msg)
# Assuming tuple from now on.
ridx = pargs[0][0] ridx = pargs[0][0]
cidx = pargs[0][1] cidx = pargs[0][1]
if ((ridx.step is None) and (cidx.step is None)):
# Slicing with full resolution.
return self.read()[ridx, cidx]
if ((ridx.start is not None) or if ((ridx.start is not None) or
(ridx.stop is not None) or (ridx.stop is not None) or
(cidx.start is not None) or (cidx.start is not None) or