hsv.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** 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 ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Command & Conquer *
  23. * *
  24. * $Archive:: /Commando/Library/HSV.H $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 7/22/97 11:37a $*
  29. * *
  30. * $Revision:: 1 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef HSV_H
  36. #define HSV_H
  37. class RGBClass;
  38. class HSVClass;
  39. /*
  40. ** Each color entry is represented by this class. It holds the values for the color
  41. ** attributes. The values are recorded in a range from 0 to 255 with 255 being the
  42. ** maximum.
  43. */
  44. class HSVClass
  45. {
  46. private:
  47. static HSVClass const BlackColor;
  48. public:
  49. HSVClass(void) : Hue(0), Saturation(0), Value(0) {};
  50. HSVClass(unsigned char hue, unsigned char saturation, unsigned char value) :
  51. Hue(hue),
  52. Saturation(saturation),
  53. Value(value)
  54. {};
  55. operator RGBClass (void) const;
  56. enum {
  57. MAX_VALUE=255
  58. };
  59. void Adjust(int ratio, HSVClass const & hsv);
  60. int Difference(HSVClass const & hsv) const;
  61. int Get_Hue(void) const {return(Hue);};
  62. int Get_Saturation(void) const {return(Saturation);};
  63. int Get_Value(void) const {return(Value);};
  64. void Set_Hue(unsigned char value) {Hue = value;}
  65. void Set_Saturation(unsigned char value) {Saturation = value;}
  66. void Set_Value(unsigned char value) {Value = value;}
  67. private:
  68. unsigned char Hue;
  69. unsigned char Saturation;
  70. unsigned char Value;
  71. };
  72. #endif