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_PIXEL_H #define GIL_PIXEL_H //////////////////////////////////////////////////////////////////////////////////////// /// \file /// \brief pixel class and related utilities /// \author Lubomir Bourdev and Hailin Jin \n /// Adobe Systems Incorporated /// \date 2005-2007 \n Last updated on September 28, 2006 /// //////////////////////////////////////////////////////////////////////////////////////// #include
#include
#include
#include
#include
#include "gil_config.hpp" #include "color_base.hpp" #include "gil_concept.hpp" #include "channel.hpp" #include "metafunctions.hpp" #include "utilities.hpp" #include "color_base_algorithm.hpp" namespace boost { namespace gil { // Forward-declare gray_t struct gray_color_t; typedef mpl::vector1
gray_t; template
struct color_space_type; template
struct channel_mapping_type; template
struct channel_type; template
struct is_planar; template
struct color_space_type
: public color_space_type
{}; template
struct channel_mapping_type
: public channel_mapping_type
{}; template
struct channel_type
: public channel_type
{}; template
struct is_planar
: public is_planar
{}; template
struct is_pixel : public mpl::false_{}; template
struct is_pixel
: public is_pixel
{}; /// \ingroup PixelBasedAlgorithm /// \brief Returns the number of channels of a pixel-based GIL construct template
struct num_channels : public mpl::size
::type> {}; /** \addtogroup PixelBasedAlgorithm Example: \code BOOST_STATIC_ASSERT((num_channels
::value==3)); BOOST_STATIC_ASSERT((num_channels
::value==4)); BOOST_STATIC_ASSERT((is_planar
::value)); BOOST_STATIC_ASSERT((is_same
::type, rgb_t>::value)); BOOST_STATIC_ASSERT((is_same
::type, channel_mapping_type
::type>::value)); BOOST_STATIC_ASSERT((is_same
::type, bits8>::value)); \endcode */ /// \defgroup ColorBaseModelPixel pixel /// \ingroup ColorBaseModel /// \brief A homogeneous color base whose element is a channel value. Models HomogeneousColorBaseValueConcept /// \defgroup PixelModelPixel pixel /// \ingroup PixelModel /// \brief A homogeneous pixel value. Models HomogeneousPixelValueConcept /// \ingroup PixelModelPixel ColorBaseModelPixel PixelBasedModel /// \brief Represents a pixel value (a container of channels). Models: HomogeneousColorBaseValueConcept, PixelValueConcept, HomogeneousPixelBasedConcept /// /// A pixel is a set of channels defining the color at a given point in an image. Conceptually, a pixel is little more than a color base whose elements /// model \p ChannelConcept. The class \p pixel defines a simple, homogeneous pixel value. It is used to store /// the value of a color. The built-in C++ references to \p pixel, \p pixel& and \p const \p pixel& are used to represent a reference to a pixel /// inside an interleaved image view (a view in which all channels are together in memory). Similarly, built-in pointer types \p pixel* and \p const \p pixel* /// are used as the standard iterator over a row of interleaved homogeneous pixels. /// /// Since \p pixel inherits the properties of color base, assigning, equality comparison and copy-construcion are allowed between compatible pixels. /// This means that an 8-bit RGB pixel may be assigned to an 8-bit BGR pixel, or to an 8-bit planar reference. The channels are properly paired semantically. /// /// The single-channel (grayscale) instantiation of the class pixel, (i.e. \p pixel
) is also convertible to/from a channel value. /// This allows grayscale pixels to be used in simpler expressions like *gray_pix1 = *gray_pix2 instead of more complicated at_c<0>(gray_pix1) = at_c<0>(gray_pix2) /// or get_color
(gray_pix1) = get_color
(gray_pix2) template
// = mpl::range_c
> struct pixel : public detail::homogeneous_color_base
::value> { private: typedef ChannelValue channel_t; typedef detail::homogeneous_color_base
::value> parent_t; public: typedef pixel value_type; typedef value_type& reference; typedef const value_type& const_reference; BOOST_STATIC_CONSTANT(bool, is_mutable = channel_traits
::is_mutable); pixel(){} explicit pixel(channel_t v) : parent_t(v) {} // sets all channels to v pixel(channel_t v0, channel_t v1) : parent_t(v0,v1) {} pixel(channel_t v0, channel_t v1, channel_t v2) : parent_t(v0,v1,v2) {} pixel(channel_t v0, channel_t v1, channel_t v2, channel_t v3) : parent_t(v0,v1,v2,v3) {} pixel(channel_t v0, channel_t v1, channel_t v2, channel_t v3, channel_t v4) : parent_t(v0,v1,v2,v3,v4) {} pixel(channel_t v0, channel_t v1, channel_t v2, channel_t v3, channel_t v4, channel_t v5) : parent_t(v0,v1,v2,v3,v4,v5) {} pixel(const pixel& p) : parent_t(p) {} pixel& operator=(const pixel& p) { static_copy(p,*this); return *this; } // Construct from another compatible pixel type template
pixel(const Pixel& p, typename enable_if_c
::value>::type* dummy = 0) : parent_t(p) { check_compatible
(); } template
pixel& operator=(const P& p) { assign(p, mpl::bool_
::value>()); return *this; } template
bool operator==(const P& p) const { return equal(p, mpl::bool_
::value>()); } template
bool operator!=(const P& p) const { return !(*this==p); } // homogeneous pixels have operator[] typename channel_traits
::reference operator[](std::size_t i) { return dynamic_at_c(*this,i); } typename channel_traits
::const_reference operator[](std::size_t i) const { return dynamic_at_c(*this,i); } private: template
void assign(const Pixel& p, mpl::true_) { check_compatible
(); static_copy(p,*this); } template
bool equal(const Pixel& p, mpl::true_) const { check_compatible
(); return static_equal(*this,p); } template
void check_compatible() const { gil_function_requires
>(); } // Support for assignment/equality comparison of a channel with a grayscale pixel private: static void check_gray() { BOOST_STATIC_ASSERT((is_same
::value)); } template
void assign(const Channel& chan, mpl::false_) { check_gray(); at_c<0>(*this)=chan; } template
bool equal (const Channel& chan, mpl::false_) const { check_gray(); return at_c<0>(*this)==chan; } public: pixel& operator= (channel_t chan) { check_gray(); at_c<0>(*this)=chan; return *this; } bool operator==(channel_t chan) const { check_gray(); return at_c<0>(*this)==chan; } }; ///////////////////////////// // ColorBasedConcept ///////////////////////////// template
struct kth_element_type
, K> { typedef ChannelValue type; }; template
struct kth_element_reference_type
, K> { typedef typename channel_traits
::reference type; }; template
struct kth_element_reference_type
, K> { typedef typename channel_traits
::const_reference type; }; template
struct kth_element_const_reference_type
, K> { typedef typename channel_traits
::const_reference type; }; ///////////////////////////// // PixelConcept ///////////////////////////// template
struct is_pixel
> : public mpl::true_{}; ///////////////////////////// // HomogeneousPixelBasedConcept ///////////////////////////// template
struct color_space_type
> { typedef typename Layout::color_space_t type; }; template
struct channel_mapping_type
> { typedef typename Layout::channel_mapping_t type; }; template
struct is_planar
> : public mpl::false_ {}; template
struct channel_type
> { typedef ChannelValue type; }; } } // namespace boost::gil namespace boost { template
struct has_trivial_constructor
> : public has_trivial_constructor
{}; } #endif
pixel.hpp
Page URL
File URL
Prev
23/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.