OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimHsvVector.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts
6 // Description:
7 //
8 //*************************************************************************
9 // $Id: ossimHsvVector.h 14789 2009-06-29 16:48:14Z dburken $
10 #ifndef ossimHsvVector_HEADER
11 #define ossimHsvVector_HEADER
12 #include <iostream>
13 using namespace std;
15 
16 class ossimRgbVector;
17 
19 {
20 public:
21  friend ostream& operator << (ostream& out, const ossimHsvVector & data)
22  {
23  out << "<" << data.theBuf[0] << ", "
24  << data.theBuf[1] << ", "
25  << data.theBuf[2] << ">";
26 
27  return out;
28  }
29  // assumed normalized floats
30  //
31  //
32  ossimHsvVector(float h=0, float s=0, float i=0)
33  {
34  theBuf[0] = h;
35  theBuf[1] = s;
36  theBuf[2] = i;
37  }
38  ossimHsvVector(const ossimRgbVector& rgb);
39 
40  const ossimHsvVector& operator =(const ossimRgbVector& rgb);
41 
42  float getH()const { return theBuf[0]; }
43  float getS()const { return theBuf[1]; }
44  float getV()const { return theBuf[2]; }
45 
46  unsigned char getVUnNormalized()const
47  {
48  return static_cast<unsigned char>(theBuf[2]*255);
49  }
50  void setH(float H) { theBuf[0] = H; }
51  void setS(float S) { theBuf[1] = S; }
52  void setV(float V) { theBuf[2] = V; }
53 
54  float clamp(float colorValue, float min=0, float max=255)const
55  {
56  colorValue = colorValue > max? max:colorValue;
57  colorValue = colorValue < min? min:colorValue;
58 
59  return colorValue;
60  }
61 
62  static const float OSSIM_HSV_UNDEFINED;
63 protected:
69  float theBuf[3];
70 
71 };
72 
73 #endif
#define OSSIMDLLEXPORT
float clamp(float colorValue, float min=0, float max=255) const
static const float OSSIM_HSV_UNDEFINED
float getS() const
ossimHsvVector(float h=0, float s=0, float i=0)
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
void setS(float S)
float getH() const
void setH(float H)
#define max(a, b)
Definition: auxiliary.h:76
void setV(float V)
unsigned char getVUnNormalized() const
float getV() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
#define min(a, b)
Definition: auxiliary.h:75