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
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2006 Torus Knot Software Ltd Also see acknowledgements in Readme.html This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt. You may alternatively use this source under the terms of a specific version of the OGRE Unrestricted License provided you have obtained such a license from Torus Knot Software Ltd. ----------------------------------------------------------------------------- */ #ifndef _COLOURVALUE_H__ #define _COLOURVALUE_H__ #include "OgrePrerequisites.h" namespace Ogre { typedef uint32 RGBA; typedef uint32 ARGB; typedef uint32 ABGR; typedef uint32 BGRA; /** Class representing colour. @remarks Colour is represented as 4 components, each of which is a floating-point value from 0.0 to 1.0. @par The 3 'normal' colour components are red, green and blue, a higher number indicating greater amounts of that component in the colour. The forth component is the 'alpha' value, which represents transparency. In this case, 0.0 is completely transparent and 1.0 is fully opaque. */ class _OgreExport ColourValue { public: static const ColourValue ZERO; static const ColourValue Black; static const ColourValue White; static const ColourValue Red; static const ColourValue Green; static const ColourValue Blue; explicit ColourValue( float red = 1.0f, float green = 1.0f, float blue = 1.0f, float alpha = 1.0f ) : r(red), g(green), b(blue), a(alpha) { } bool operator==(const ColourValue& rhs) const; bool operator!=(const ColourValue& rhs) const; float r,g,b,a; /** Retrieves colour as RGBA. */ RGBA getAsRGBA(void) const; /** Retrieves colour as ARGB. */ ARGB getAsARGB(void) const; /** Retrieves colour as BGRA. */ BGRA getAsBGRA(void) const; /** Retrieves colours as ABGR */ ABGR getAsABGR(void) const; /** Sets colour as RGBA. */ void setAsRGBA(const RGBA val); /** Sets colour as ARGB. */ void setAsARGB(const ARGB val); /** Sets colour as BGRA. */ void setAsBGRA(const BGRA val); /** Sets colour as ABGR. */ void setAsABGR(const ABGR val); /** Clamps colour value to the range [0, 1]. */ void saturate(void) { if (r < 0) r = 0; else if (r > 1) r = 1; if (g < 0) g = 0; else if (g > 1) g = 1; if (b < 0) b = 0; else if (b > 1) b = 1; if (a < 0) a = 0; else if (a > 1) a = 1; } /** As saturate, except that this colour value is unaffected and the saturated colour value is returned as a copy. */ ColourValue saturateCopy(void) const { ColourValue ret = *this; ret.saturate(); return ret; } /// Array accessor operator inline float operator [] ( const size_t i ) const { assert( i < 4 ); return *(&r+i); } /// Array accessor operator inline float& operator [] ( const size_t i ) { assert( i < 4 ); return *(&r+i); } /// Pointer accessor for direct copying inline float* ptr() { return &r; } /// Pointer accessor for direct copying inline const float* ptr() const { return &r; } // arithmetic operations inline ColourValue operator + ( const ColourValue& rkVector ) const { ColourValue kSum; kSum.r = r + rkVector.r; kSum.g = g + rkVector.g; kSum.b = b + rkVector.b; kSum.a = a + rkVector.a; return kSum; } inline ColourValue operator - ( const ColourValue& rkVector ) const { ColourValue kDiff; kDiff.r = r - rkVector.r; kDiff.g = g - rkVector.g; kDiff.b = b - rkVector.b; kDiff.a = a - rkVector.a; return kDiff; } inline ColourValue operator * (const float fScalar ) const { ColourValue kProd; kProd.r = fScalar*r; kProd.g = fScalar*g; kProd.b = fScalar*b; kProd.a = fScalar*a; return kProd; } inline ColourValue operator * ( const ColourValue& rhs) const { ColourValue kProd; kProd.r = rhs.r * r; kProd.g = rhs.g * g; kProd.b = rhs.b * b; kProd.a = rhs.a * a; return kProd; } inline ColourValue operator / ( const ColourValue& rhs) const { ColourValue kProd; kProd.r = rhs.r / r; kProd.g = rhs.g / g; kProd.b = rhs.b / b; kProd.a = rhs.a / a; return kProd; } inline ColourValue operator / (const float fScalar ) const { assert( fScalar != 0.0 ); ColourValue kDiv; float fInv = 1.0 / fScalar; kDiv.r = r * fInv; kDiv.g = g * fInv; kDiv.b = b * fInv; kDiv.a = a * fInv; return kDiv; } inline friend ColourValue operator * (const float fScalar, const ColourValue& rkVector ) { ColourValue kProd; kProd.r = fScalar * rkVector.r; kProd.g = fScalar * rkVector.g; kProd.b = fScalar * rkVector.b; kProd.a = fScalar * rkVector.a; return kProd; } // arithmetic updates inline ColourValue& operator += ( const ColourValue& rkVector ) { r += rkVector.r; g += rkVector.g; b += rkVector.b; a += rkVector.a; return *this; } inline ColourValue& operator -= ( const ColourValue& rkVector ) { r -= rkVector.r; g -= rkVector.g; b -= rkVector.b; a -= rkVector.a; return *this; } inline ColourValue& operator *= (const float fScalar ) { r *= fScalar; g *= fScalar; b *= fScalar; a *= fScalar; return *this; } inline ColourValue& operator /= (const float fScalar ) { assert( fScalar != 0.0 ); float fInv = 1.0 / fScalar; r *= fInv; g *= fInv; b *= fInv; a *= fInv; return *this; } /** Set a colour value from Hue, Saturation and Brightness. @param hue Hue value, scaled to the [0,1] range as opposed to the 0-360 @param saturation Saturation level, [0,1] @param brightness Brightness level, [0,1] */ void setHSB(Real hue, Real saturation, Real brightness); /** Function for writing to a stream. */ inline _OgreExport friend std::ostream& operator << ( std::ostream& o, const ColourValue& c ) { o << "ColourValue(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")"; return o; } }; } // namespace #endif
OgreColourValue.h
Page URL
File URL
Prev
26/217
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.