CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

HSV.H (3534B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /* $Header: /CounterStrike/HSV.H 1     3/03/97 10:24a Joe_bostic $ */
     17 /*********************************************************************************************** 
     18  ***              C O N F I D E N T I A L  ---  W E S T W O O D  S T U D I O S               ***
     19  ***********************************************************************************************
     20  *                                                                                             *
     21  *                 Project Name : Command & Conquer                                            *
     22  *                                                                                             *
     23  *                    File Name : HSV.H                                                        *
     24  *                                                                                             *
     25  *                   Programmer : Joe L. Bostic                                                *
     26  *                                                                                             *
     27  *                   Start Date : 12/02/95                                                     *
     28  *                                                                                             *
     29  *                  Last Update : December 2, 1995 [JLB]                                       *
     30  *                                                                                             *
     31  *---------------------------------------------------------------------------------------------*
     32  * Functions:                                                                                  *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 
     35 
     36 #ifndef HSV_H
     37 #define HSV_H
     38 
     39 class RGBClass;
     40 class HSVClass;
     41 
     42 /*
     43 **	Each color entry is represented by this class. It holds the values for the color
     44 **	attributes. The values are recorded in a range from 0 to 255 with 255 being the
     45 **	maximum.
     46 */
     47 class HSVClass
     48 {
     49 	private:
     50 		static HSVClass const BlackColor;
     51 
     52 	public:
     53 		HSVClass(void) : Hue(0), Saturation(0), Value(0) {};
     54 		HSVClass(unsigned char hue, unsigned char saturation, unsigned char value) :
     55 				Hue(hue),
     56 				Saturation(saturation),
     57 				Value(value)
     58 			{};
     59 		operator RGBClass (void) const;
     60 
     61 		enum {
     62 			MAX_VALUE=255
     63 		};
     64 
     65 		void Adjust(int ratio, HSVClass const & hsv);
     66 		int Difference(HSVClass const & hsv) const;
     67 		int Hue_Component(void) const {return(Hue);};
     68 		int Saturation_Component(void) const {return(Saturation);};
     69 		int Value_Component(void) const {return(Value);};
     70 		void Set(int color) const;
     71 
     72 	private:
     73 		unsigned char Hue;
     74 		unsigned char Saturation;
     75 		unsigned char Value;
     76 };
     77 
     78 #endif