OpenImageIO/oiio — pull request #466 by lgritz (2012-11-15 07:51:27+00:00)
Title: Change channel range notation for ImageInput methods to [chbegin,chend).

I've recently become deeply bothered by the inconsistency in ImageInput between how we specify spatial extends as [begin,end) but channel ranges as firstchan,nchans. I think we should change the ImageInput API calls to specify [chbegin,chend) as well.

This patch altered the ImageInput::read_scanlines, read_tiles, read_native_scanlines, read_native_tiles, read_native_deep_scanlines, read_native_deep_tiles so that instead of specifying channel subsets as (firstchan, nchans), they are specified as [chbegin, chend), to match how spatial extents are done, as well as how channel ranges already were specified in ROI and ImageBuf.

We hate changing API meanings, but we really think this is better and more consistent. Note that the two common uses of channel subsets were firstchan=0,nchans=nchannels (select all channels) and firstchan=foo,nchans=1, and we have rigged it so that [chbegin,chend) returns the same channels in both of these cases (in the latter case, because we retrieve a minimum of 1 channel), so we believe this is unlikely to break working code in the vast majority of cases.

I realize that this may be controversial. One possibility is to commit this to 1.1 -- despite promising that we don't break APIs once we have stable releases, it just went out so it probably won't inconvenience people too much if we do it quickly. Another possibility is to leave 1.1 as it is, and commit this to master only, essentially making the API change be part of 1.2. Opinions wanted.