[GIL] locator and cached_location_t

Hi, I like the idea of cached_location, but I have some questions about it. //// a simple usage example: // get a temporary locator from the view const SLocator loc_ref = srcView.xy_at(0,0); // from this locator we can extract a cached_location typename SLocator::cached_location_t LT( loc_ref.cache_location(-1,-1) ); DPixel func( const SLocator& src ) { // now instead of doing this: return src(-1, -1); // we can directly retrieve the pixel // from the locator using this cached location return src[LT]; } I have 2 questions: 1) Why can't we directly get a cached_location from a view (without using a locator) ? We have all informations in the view to build it, isn't it ? typename SLocator::cached_location_t LT( srcView.cache_location(-1,-1) ); 2) Is there a good reason to not allows to get a locator from another locator using cached_location ? DLocator func( const SLocator& src ) { // we can do this return src.xy_at(-1, -1); // return a new locator // we can't do the same thing with cached_location return src.xy_at(LT); //< it can be interesting to do this ! } Same remark to get an x_iterator from a locator: src.x_at(-1, -1); //< we can do this src.x_at(LT); //< we can't do this Best regards, Fabien Castan

Hi Fabien, I have never used or even heard of cached_location. So, I don't feel comfortable to answer design decisions. Sorry, Christian On Sun, Dec 12, 2010 at 2:37 PM, fabien <fabien.castan@free.fr> wrote:
Hi, I like the idea of cached_location, but I have some questions about it.
//// a simple usage example: // get a temporary locator from the view const SLocator loc_ref = srcView.xy_at(0,0); // from this locator we can extract a cached_location typename SLocator::cached_location_t LT( loc_ref.cache_location(-1,-1) );
DPixel func( const SLocator& src ) { // now instead of doing this: return src(-1, -1);
// we can directly retrieve the pixel // from the locator using this cached location return src[LT]; }
I have 2 questions: 1) Why can't we directly get a cached_location from a view (without using a locator) ? We have all informations in the view to build it, isn't it ? typename SLocator::cached_location_t LT( srcView.cache_location(-1,-1) );
2) Is there a good reason to not allows to get a locator from another locator using cached_location ?
DLocator func( const SLocator& src ) { // we can do this return src.xy_at(-1, -1); // return a new locator
// we can't do the same thing with cached_location return src.xy_at(LT); //< it can be interesting to do this ! }
Same remark to get an x_iterator from a locator: src.x_at(-1, -1); //< we can do this src.x_at(LT); //< we can't do this
Best regards, Fabien Castan _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Hi Fabien, To answer both of your questions, I don't see any particular obstacle to adding those APIs to image_view, but we didn't add them because that will be a lot of methods for something that is advanced and not frequently used (cached_location). Not to mention it doesn't make sense to use for all image views, but only "memory-based" ones, as opposed to virtual ones, for example. Lubomir On Dec 12, 2010, at 11:37 AM, fabien wrote: I have 2 questions: 1) Why can't we directly get a cached_location from a view (without using a locator) ? We have all informations in the view to build it, isn't it ? typename SLocator::cached_location_t LT( srcView.cache_location(-1,-1) ); 2) Is there a good reason to not allows to get a locator from another locator using cached_location ? DLocator func( const SLocator& src ) { // we can do this return src.xy_at(-1, -1); // return a new locator // we can't do the same thing with cached_location return src.xy_at(LT); //< it can be interesting to do this ! } Same remark to get an x_iterator from a locator: src.x_at(-1, -1); //< we can do this src.x_at(LT); //< we can't do this Best regards, Fabien Castan _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (3)
-
Christian Henning
-
fabien
-
Lubomir Bourdev