
Hi Phil,
PSEUDO-CODE!!!!
class iterator { buffer_t& buffer; size_t pending_advance_rows;
public: const buffer_t& operator*() { while (pending_advance_rows > 1) { format_specific_skip_row(); --pending_advance_rows; } if (pending_advance_rows == 1) { format_specific_read_row_into(buffer); --pending_advance_rows; } return buffer; }
void operator++() { ++pending_advance_rows; } };
I think the scanline_read_iterator is a little more complicated. I have uploaded the lateted "iteration" here: http://svn.boost.org/svn/boost/trunk/boost/gil/extension/io/detail/scanline_... It's crucial that the reader's "read" and "skip" functions are called appropriately. These two functions behave very differently for different image formats. For instance two calls to operator* should not result in two reads. Or when a user does std::advance( it, 20 ) the iterator needs to call "skip" 20 times without any "reads". Jeffery suggested to use two booleans to get the order of calls correct. Let's hope I got it right this time. Thanks, Christian