OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimNormRgbVector.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2005 Garrett Potts
3 //
4 // License: MIT
5 // Author: Garrett Potts
6 // Description:
7 //
8 //*************************************************************************
9 // $Id: ossimNormRgbVector.h 9094 2006-06-13 19:12:40Z dburken $
10 #ifndef ossimNormRgbVector_HEADER
11 #define ossimNormRgbVector_HEADER
12 #include <iostream>
14 
16 class ossimHsiVector;
17 class ossimHsvVector;
18 class ossimCmyVector;
19 class ossimRgbVector;
20 
22 {
23 public:
25  {
26  out << "<" << data.theBuf[0] << ", "
27  << data.theBuf[1] << ", "
28  << data.theBuf[2] << ">";
29 
30  return out;
31  }
33  {
34  theBuf[0] = r;
35  theBuf[1] = g;
36  theBuf[2] = b;
37  }
39  {
40  theBuf[0] = grey;
41  theBuf[1] = grey;
42  theBuf[2] = grey;
43  }
45  {
46  theBuf[0] = colorData[0];
47  theBuf[1] = colorData[1];
48  theBuf[2] = colorData[2];
49  }
51  {
52  theBuf[0] = rgb.theBuf[0];
53  theBuf[1] = rgb.theBuf[1];
54  theBuf[2] = rgb.theBuf[2];
55  }
62  {
63  return ossimNormRgbVector(clamp(theBuf[0] - rgb.theBuf[0]),
64  clamp(theBuf[1] - rgb.theBuf[1]),
65  clamp(theBuf[2] - rgb.theBuf[2]));
66  }
68  {
69  return ossimNormRgbVector(clamp(theBuf[0]*t),
70  clamp(theBuf[1]*t),
71  clamp(theBuf[2]*t));
72  }
73 
74  const ossimNormRgbVector& operator =(const ossimJpegYCbCrVector& data);
75  const ossimNormRgbVector& operator =(const ossimHsiVector& hsi);
76  const ossimNormRgbVector& operator =(const ossimHsvVector& hsv);
77  const ossimNormRgbVector& operator =(const ossimCmyVector& cmy);
79  {
80  return ( (rgb.theBuf[0] == theBuf[0])&&
81  (rgb.theBuf[1] == theBuf[1])&&
82  (rgb.theBuf[2] == theBuf[2]));
83  }
85  {
86  return ( (rgb.theBuf[0] != theBuf[0])||
87  (rgb.theBuf[1] != theBuf[1])||
88  (rgb.theBuf[2] != theBuf[2]));
89  }
91  {
92  colorValue = colorValue > max? max:colorValue;
93  colorValue = colorValue < min? min:colorValue;
94 
95  return colorValue;
96  }
97  ossim_float64 getR() const { return theBuf[0]; }
98  ossim_float64 getG()const { return theBuf[1]; }
99  ossim_float64 getB()const { return theBuf[2]; }
100  void setR(ossim_float64 r) { theBuf[0] = r; }
101  void setG(ossim_float64 g) { theBuf[1] = g; }
102  void setB(ossim_float64 b) { theBuf[2] = b; }
103 
104 protected:
105  ossim_float64 theBuf[3];
106 
107 };
108 
109 #endif
ossimRationalNumber operator-(ossim_int32 i, ossimRationalNumber &r)
ossimNormRgbVector(ossim_float64 r=0, ossim_float64 g=0, ossim_float64 b=0)
ossimNormRgbVector(const ossimNormRgbVector &rgb)
T clamp(T x, T a, T b)
Definition: ossimCommon.h:168
bool operator!=(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:111
ossimNormRgbVector(ossim_float64 colorData[3])
ossimRationalNumber operator*(ossim_int32 i, ossimRationalNumber &r)
double ossim_float64
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
void setB(ossim_float64 b)
ossimNormRgbVector(ossim_float64 grey)
static ossim_float64 clamp(ossim_float64 colorValue, ossim_float64 min=0.0, ossim_float64 max=1.0)
void setR(ossim_float64 r)
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
ossim_float64 getB() const
#define max(a, b)
Definition: auxiliary.h:76
#define OSSIM_DLL
ossim_float64 theBuf[3]
ossim_float64 getG() const
ossim_float64 getR() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
#define min(a, b)
Definition: auxiliary.h:75
void setG(ossim_float64 g)