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_BIT_ALIGNED_PIXEL_ITERATOR_HPP #define GIL_BIT_ALIGNED_PIXEL_ITERATOR_HPP //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief A model of a heterogeneous pixel that is not byte aligned. Examples are bitmap (1-bit pixels) or 6-bit RGB (222) /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on September 28, 2006 /// //////////////////////////////////////////////////////////////////////////////////////// #include
#include
#include "gil_config.hpp" #include "bit_aligned_pixel_reference.hpp" #include "pixel_iterator.hpp" namespace boost { namespace gil { /// \defgroup PixelIteratorNonAlignedPixelIterator bit_aligned_pixel_iterator /// \ingroup PixelIteratorModel /// \brief An iterator over non-byte-aligned pixels. Models PixelIteratorConcept, PixelBasedConcept, MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept //////////////////////////////////////////////////////////////////////////////////////// /// \brief An iterator over non-byte-aligned pixels. Models PixelIteratorConcept, PixelBasedConcept, MemoryBasedIteratorConcept, HasDynamicXStepTypeConcept /// /// An iterator over pixels that correspond to non-byte-aligned bit ranges. Examples of such pixels are single bit grayscale pixel, or a 6-bit RGB 222 pixel. /// /// \ingroup PixelIteratorNonAlignedPixelIterator PixelBasedModel template
struct bit_aligned_pixel_iterator : public iterator_facade
, typename NonAlignedPixelReference::value_type, random_access_traversal_tag, const NonAlignedPixelReference, typename NonAlignedPixelReference::bit_range_t::difference_type> { private: typedef iterator_facade
, typename NonAlignedPixelReference::value_type, random_access_traversal_tag, const NonAlignedPixelReference, typename NonAlignedPixelReference::bit_range_t::difference_type> parent_t; template
friend struct bit_aligned_pixel_iterator; typedef typename NonAlignedPixelReference::bit_range_t bit_range_t; public: typedef typename parent_t::difference_type difference_type; typedef typename parent_t::reference reference; bit_aligned_pixel_iterator() {} bit_aligned_pixel_iterator(const bit_aligned_pixel_iterator& p) : _bit_range(p._bit_range) {} bit_aligned_pixel_iterator& operator=(const bit_aligned_pixel_iterator& p) { _bit_range=p._bit_range; return *this; } template
bit_aligned_pixel_iterator(const bit_aligned_pixel_iterator
& p) : _bit_range(p._bit_range) {} bit_aligned_pixel_iterator(reference* ref) : _bit_range(ref->bit_range()) {} explicit bit_aligned_pixel_iterator(typename bit_range_t::byte_t* data, int bit_offset=0) : _bit_range(data,bit_offset) {} /// 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 { bit_aligned_pixel_iterator it=*this; it.advance(d); return *it; } reference operator->() const { return **this; } const bit_range_t& bit_range() const { return _bit_range; } bit_range_t& bit_range() { return _bit_range; } private: bit_range_t _bit_range; BOOST_STATIC_CONSTANT(int, bit_size = NonAlignedPixelReference::bit_size); friend class boost::iterator_core_access; reference dereference() const { return NonAlignedPixelReference(_bit_range); } void increment() { ++_bit_range; } void decrement() { --_bit_range; } void advance(difference_type d) { _bit_range.bit_advance(d*bit_size); } difference_type distance_to(const bit_aligned_pixel_iterator& it) const { return _bit_range.bit_distance_to(it._bit_range) / bit_size; } bool equal(const bit_aligned_pixel_iterator& it) const { return _bit_range==it._bit_range; } }; template
struct const_iterator_type
> { typedef bit_aligned_pixel_iterator
type; }; template
struct iterator_is_mutable
> : public mpl::bool_
{}; template
struct is_iterator_adaptor
> : public mpl::false_ {}; ///////////////////////////// // PixelBasedConcept ///////////////////////////// template
struct color_space_type
> : public color_space_type
{}; template
struct channel_mapping_type
> : public channel_mapping_type
{}; template
struct is_planar
> : public is_planar
{}; // == false ///////////////////////////// // MemoryBasedIteratorConcept ///////////////////////////// template
struct byte_to_memunit
> : public mpl::int_<8> {}; template
inline std::ptrdiff_t memunit_step(const bit_aligned_pixel_iterator
&) { return NonAlignedPixelReference::bit_size; } template
inline std::ptrdiff_t memunit_distance(const bit_aligned_pixel_iterator
& p1, const bit_aligned_pixel_iterator
& p2) { return (p2.bit_range().current_byte() - p1.bit_range().current_byte())*8 + p2.bit_range().bit_offset() - p1.bit_range().bit_offset(); } template
inline void memunit_advance(bit_aligned_pixel_iterator
& p, std::ptrdiff_t diff) { p.bit_range().bit_advance(diff); } template
inline bit_aligned_pixel_iterator
memunit_advanced(const bit_aligned_pixel_iterator
& p, std::ptrdiff_t diff) { bit_aligned_pixel_iterator
ret=p; memunit_advance(ret, diff); return ret; } template
inline NonAlignedPixelReference memunit_advanced_ref(bit_aligned_pixel_iterator
it, std::ptrdiff_t diff) { return *memunit_advanced(it,diff); } ///////////////////////////// // HasDynamicXStepTypeConcept ///////////////////////////// template
struct dynamic_x_step_type
> { typedef memory_based_step_iterator
> type; }; ///////////////////////////// // iterator_type_from_pixel ///////////////////////////// template
struct iterator_type_from_pixel
,false,false,false> { typedef bit_aligned_pixel_iterator
> type; }; template
struct iterator_type_from_pixel
,false,false,true> { typedef bit_aligned_pixel_iterator
> type; }; template
struct iterator_type_from_pixel
,IsPlanar,IsStep,IsMutable> : public iterator_type_from_pixel
,IsPlanar,IsStep,IsMutable> {}; } } // namespace boost::gil namespace std { // It is important to provide an overload of uninitialized_copy for bit_aligned_pixel_iterator. The default STL implementation calls placement new, // which is not defined for bit_aligned_pixel_iterator. template
boost::gil::bit_aligned_pixel_iterator
uninitialized_copy(boost::gil::bit_aligned_pixel_iterator
first, boost::gil::bit_aligned_pixel_iterator
last, boost::gil::bit_aligned_pixel_iterator
dst) { return std::copy(first,last,dst); } } // namespace std #endif
bit_aligned_pixel_iterator.hpp
Page URL
File URL
Prev
2/34
Next
Download
( 9 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.