DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
/* Copyright 2005-2007 Adobe Systems Incorporated Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). See http://opensource.adobe.com/gil for most recent version including documentation. */ /*************************************************************************************************/ #ifndef GIL_ITERATOR_FROM_2D_H #define GIL_ITERATOR_FROM_2D_H //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief pixel step iterator, pixel image iterator and pixel dereference iterator /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on September 18, 2007 /// //////////////////////////////////////////////////////////////////////////////////////// #include
#include
#include "gil_concept.hpp" #include "gil_config.hpp" #include "pixel_iterator.hpp" #include "locator.hpp" namespace boost { namespace gil { //////////////////////////////////////////////////////////////////////////////////////// /// /// ITERATOR FROM 2D ADAPTOR /// //////////////////////////////////////////////////////////////////////////////////////// /// \defgroup PixelIteratorModelFromLocator iterator_from_2d /// \ingroup PixelIteratorModel /// \brief An iterator over two-dimensional locator. Useful for iterating over the pixels of an image view. Models PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept /// \ingroup PixelIteratorModelFromLocator PixelBasedModel /// \brief Provides 1D random-access navigation to the pixels of the image. Models: PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept /// /// Pixels are traversed from the top to the bottom row and from the left to the right /// within each row template
// Models PixelLocatorConcept class iterator_from_2d : public iterator_facade
, typename Loc2::value_type, random_access_traversal_tag, typename Loc2::reference, typename Loc2::coord_t> { GIL_CLASS_REQUIRE(Loc2, boost::gil, PixelLocatorConcept) public: typedef iterator_facade
, typename Loc2::value_type, random_access_traversal_tag, typename Loc2::reference, typename Loc2::coord_t> parent_t; typedef typename parent_t::reference reference; typedef typename parent_t::difference_type difference_type; typedef typename Loc2::x_iterator x_iterator; typedef typename Loc2::point_t point_t; std::ptrdiff_t width() const { return _width; } // number of pixels per image row std::ptrdiff_t x_pos() const { return _coords.x; } // current x position std::ptrdiff_t y_pos() const { return _coords.y; } // current y position /// For some reason operator[] provided by iterator_adaptor returns a custom class that is convertible to reference /// We require our own reference because it is registered in iterator_traits reference operator[](difference_type d) const { return *(*this+d); } bool is_1d_traversable() const { return _p.is_1d_traversable(width()); } // is there no gap at the end of each row? x_iterator& x() { return _p.x(); } iterator_from_2d(){} iterator_from_2d(const Loc2& p, std::ptrdiff_t width, std::ptrdiff_t x=0, std::ptrdiff_t y=0) : _coords(x,y), _width(width), _p(p) {} iterator_from_2d(const iterator_from_2d& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {} template
iterator_from_2d(const iterator_from_2d
& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {} private: template
friend class iterator_from_2d; friend class boost::iterator_core_access; reference dereference() const { return *_p; } void increment() { ++_coords.x; ++_p.x(); if (_coords.x>=_width) { _coords.x=0; ++_coords.y; _p+=point_t(-_width,1); } } void decrement() { --_coords.x; --_p.x(); if (_coords.x<0) { _coords.x=_width-1; --_coords.y; _p+=point_t(_width,-1); } } GIL_FORCEINLINE void advance(difference_type d) { if (_width==0) return; // unfortunately we need to check for that. Default-constructed images have width of 0 and the code below will throw if executed. point_t delta; if (_coords.x+d>=0) { // not going back to a previous row? delta.x=(_coords.x+(std::ptrdiff_t)d)%_width - _coords.x; delta.y=(_coords.x+(std::ptrdiff_t)d)/_width; } else { delta.x=(_coords.x+(std::ptrdiff_t)d*(1-_width))%_width -_coords.x; delta.y=-(_width-_coords.x-(std::ptrdiff_t)d-1)/_width; } _p+=delta; _coords.x+=delta.x; _coords.y+=delta.y; } difference_type distance_to(const iterator_from_2d& it) const { if (_width==0) return 0; return (it.y_pos()-_coords.y)*_width + (it.x_pos()-_coords.x); } bool equal(const iterator_from_2d& it) const { assert(_width==it.width()); // they must belong to the same image return _coords==it._coords && _p==it._p; } point2
_coords; std::ptrdiff_t _width; Loc2 _p; }; template
// Models PixelLocatorConcept struct const_iterator_type
> { typedef iterator_from_2d
type; }; template
// Models PixelLocatorConcept struct iterator_is_mutable
> : public iterator_is_mutable
{}; ///////////////////////////// // HasDynamicXStepTypeConcept ///////////////////////////// template
struct dynamic_x_step_type
> { typedef iterator_from_2d
::type> type; }; ///////////////////////////// // PixelBasedConcept ///////////////////////////// template
// Models PixelLocatorConcept struct color_space_type
> : public color_space_type
{}; template
// Models PixelLocatorConcept struct channel_mapping_type
> : public channel_mapping_type
{}; template
// Models PixelLocatorConcept struct is_planar
> : public is_planar
{}; template
// Models PixelLocatorConcept struct channel_type
> : public channel_type
{}; } } // namespace boost::gil #endif
iterator_from_2d.hpp
Page URL
File URL
Prev
19/34
Next
Download
( 7 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.