
"Christian Henning" <chhenning@gmail.com> wrote in message news:AANLkTimfZVaObSw=2pCxFEJp4AkMbYbq1jXXLej=QC8m@mail.gmail.com...
io_new is also object-oriented but it also provides, as you know, the free floating helper functions like read_image, etc. Even though, I don't state it in the documentation but you could use the underlying classes also. All image formats use the same reader class which is hidden inside the detail namespace. For instance:
[taken from image_read.hpp]
detail::reader< Device , FormatTag , detail::read_and_no_convert > reader( file , settings );
reader.init_image( img , reader.get_info() );
reader.apply( view( img ));
This object can be reused at will.
Isn't it the other way around, the free functions are the official interface while the detail::reader<> class template is the helper implementation detail..? And the reader objects, AFAICT, cannot actually be reused in a meaningful way (e.g. the apply<>() method for the JPEG reader calls jpeg_start_decompress() and jpeg_finish_decompress() ) ...
But I have a question for you. Are you sure you can easily reuse a jpeg_decompress_struct object and jump around a jpeg image without getting it confused? I mean, for instance, imagine you read the last image line first and then try to read the first line. Does that work?
With LibJPEG, you cannot 'jump around easily' (e.g. to go back/rewind the decoding you have to abort and restart the decompression) but 'jumping around' does not really represent a significant use case (io2 does however detect this and automatically handles it)...'Forward/single direction' reading OTOH is a different story as the io2 reader preserves the decompression state so that you can simply and cheaply resume reading a JPEG (e.g. for sequential ROI based access)...
I would love to work with you to create the best image reader/writer possible for the boost community. Let's see what the review brings to the table and afterwards we can start sorting out the major differences. How does that sound?
Well if the change is already inevitable or very probable, a full official review of a library that is going to change (or at least a significant part of it) in a significant way both from within and without might be misplaced...But the review date is here so let's make the best of it :) I'll find some time to reiterate in short the objections from my original post in the official review thread... -- "What Huxley teaches is that in the age of advanced technology, spiritual devastation is more likely to come from an enemy with a smiling face than from one whose countenance exudes suspicion and hate." Neil Postman