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_PLANAR_PTR_H #define GIL_PLANAR_PTR_H //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief planar pixel pointer class /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on February 12, 2007 /// //////////////////////////////////////////////////////////////////////////////////////// #include
#include
#include
#include "gil_config.hpp" #include "pixel.hpp" #include "step_iterator.hpp" namespace boost { namespace gil { //forward declaration (as this file is included in planar_pixel_reference.hpp) template
struct planar_pixel_reference; /// \defgroup ColorBaseModelPlanarPtr planar_pixel_iterator /// \ingroup ColorBaseModel /// \brief A homogeneous color base whose element is a channel iterator. Models HomogeneousColorBaseValueConcept /// This class is used as an iterator to a planar pixel. /// \defgroup PixelIteratorModelPlanarPtr planar_pixel_iterator /// \ingroup PixelIteratorModel /// \brief An iterator over planar pixels. Models PixelIteratorConcept, HomogeneousPixelBasedConcept, MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept //////////////////////////////////////////////////////////////////////////////////////// /// \brief An iterator over planar pixels. Models HomogeneousColorBaseConcept, PixelIteratorConcept, HomogeneousPixelBasedConcept, MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept /// /// Planar pixels have channel data that is not consecutive in memory. /// To abstract this we use classes to represent references and pointers to planar pixels. /// /// \ingroup PixelIteratorModelPlanarPtr ColorBaseModelPlanarPtr PixelBasedModel template
struct planar_pixel_iterator : public iterator_facade
, pixel
::value_type,layout
>, random_access_traversal_tag, const planar_pixel_reference
::reference,ColorSpace> >, public detail::homogeneous_color_base
,mpl::size
::value > { private: typedef iterator_facade
, pixel
::value_type,layout
>, random_access_traversal_tag, const planar_pixel_reference
::reference,ColorSpace> > parent_t; typedef detail::homogeneous_color_base
,mpl::size
::value> color_base_parent_t; typedef typename std::iterator_traits
::value_type channel_t; public: typedef typename parent_t::value_type value_type; typedef typename parent_t::reference reference; typedef typename parent_t::difference_type difference_type; planar_pixel_iterator() : color_base_parent_t(0) {} planar_pixel_iterator(bool) {} // constructor that does not fill with zero (for performance) planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1) : color_base_parent_t(v0,v1) {} planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2) : color_base_parent_t(v0,v1,v2) {} planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3) : color_base_parent_t(v0,v1,v2,v3) {} planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3, const ChannelPtr& v4) : color_base_parent_t(v0,v1,v2,v3,v4) {} template
planar_pixel_iterator(const planar_pixel_iterator
& ptr) : color_base_parent_t(ptr) {} /// Copy constructor and operator= from pointers to compatible planar pixels or planar pixel references. /// That allow constructs like pointer = &value or pointer = &reference /// Since we should not override operator& that's the best we can do. template
planar_pixel_iterator(P* pix) : color_base_parent_t(pix, true) { function_requires
>(); } struct address_of { template
T* operator()(T& t) { return &t; } }; template
planar_pixel_iterator& operator=(P* pix) { function_requires
>(); static_transform(*pix,*this, address_of()); // PERFORMANCE_CHECK: Compare to this: //this->template semantic_at_c<0>()=&pix->template semantic_at_c<0>(); //this->template semantic_at_c<1>()=&pix->template semantic_at_c<1>(); //this->template semantic_at_c<2>()=&pix->template semantic_at_c<2>(); return *this; } /// For some reason operator[] provided by iterator_facade 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 memunit_advanced_ref(*this,d*sizeof(channel_t));} reference operator->() const { return **this; } // PERFORMANCE_CHECK: Remove? bool operator< (const planar_pixel_iterator& ptr) const { return at_c<0>(*this)< at_c<0>(ptr); } bool operator!=(const planar_pixel_iterator& ptr) const { return at_c<0>(*this)!=at_c<0>(ptr); } private: friend class boost::iterator_core_access; void increment() { static_transform(*this,*this,detail::inc
()); } void decrement() { static_transform(*this,*this,detail::dec
()); } void advance(ptrdiff_t d) { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric
(),d)); } reference dereference() const { return this->template deref
(); } ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return at_c<0>(it)-at_c<0>(*this); } bool equal(const planar_pixel_iterator& it) const { return at_c<0>(*this)==at_c<0>(it); } }; namespace detail { template
struct channel_iterator_is_mutable : public mpl::true_ {}; template
struct channel_iterator_is_mutable
: public mpl::false_ {}; } template
struct const_iterator_type
> { private: typedef typename std::iterator_traits
::value_type channel_t; public: typedef planar_pixel_iterator
::const_pointer,C> type; }; // The default implementation when the iterator is a C pointer is to use the standard constness semantics template
struct iterator_is_mutable
> : public detail::channel_iterator_is_mutable
{}; ///////////////////////////// // ColorBasedConcept ///////////////////////////// template
struct kth_element_type
, K> { typedef IC type; }; template
struct kth_element_reference_type
, K> : public add_reference
{}; template
struct kth_element_const_reference_type
, K> : public add_reference
::type> {}; ///////////////////////////// // HomogeneousPixelBasedConcept ///////////////////////////// template
struct color_space_type
> { typedef C type; }; template
struct channel_mapping_type
> : public channel_mapping_type
::value_type> {}; template
struct is_planar
> : public mpl::true_ {}; template
struct channel_type
> { typedef typename std::iterator_traits
::value_type type; }; ///////////////////////////// // MemoryBasedIteratorConcept ///////////////////////////// template
inline std::ptrdiff_t memunit_step(const planar_pixel_iterator
&) { return sizeof(typename std::iterator_traits
::value_type); } template
inline std::ptrdiff_t memunit_distance(const planar_pixel_iterator
& p1, const planar_pixel_iterator
& p2) { return memunit_distance(at_c<0>(p1),at_c<0>(p2)); } template
struct memunit_advance_fn { memunit_advance_fn(std::ptrdiff_t diff) : _diff(diff) {} IC operator()(const IC& p) const { return memunit_advanced(p,_diff); } std::ptrdiff_t _diff; }; template
inline void memunit_advance(planar_pixel_iterator
& p, std::ptrdiff_t diff) { static_transform(p, p, memunit_advance_fn
(diff)); } template
inline planar_pixel_iterator
memunit_advanced(const planar_pixel_iterator
& p, std::ptrdiff_t diff) { planar_pixel_iterator
ret=p; memunit_advance(ret, diff); return ret; } template
inline planar_pixel_reference
::reference,ColorSpace> memunit_advanced_ref(const planar_pixel_iterator
& ptr, std::ptrdiff_t diff) { return planar_pixel_reference
::reference,ColorSpace>(ptr, diff); } ///////////////////////////// // HasDynamicXStepTypeConcept ///////////////////////////// template
struct dynamic_x_step_type
> { typedef memory_based_step_iterator
> type; }; } } // namespace boost::gil #endif
planar_pixel_iterator.hpp
Page URL
File URL
Prev
26/34
Next
Download
( 10 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.