OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
ossimRgbVector Class Reference

#include <ossimRgbVector.h>

Public Member Functions

 ossimRgbVector (unsigned char r=0, unsigned char g=0, unsigned char b=0)
 
 ossimRgbVector (const ossimRgbVector &copy_this)
 
 ossimRgbVector (unsigned char grey)
 
 ossimRgbVector (unsigned char colorData[3])
 
 ossimRgbVector (const ossimJpegYCbCrVector &YCbCr)
 
 ossimRgbVector (const ossimHsiVector &hsi)
 
 ossimRgbVector (const ossimHsvVector &hsv)
 
 ossimRgbVector (const ossimCmyVector &cmy)
 
ossimRgbVector operator- (const ossimRgbVector &rgb) const
 
ossimRgbVector operator+ (const ossimRgbVector &rgb) const
 
ossimRgbVector operator* (double t) const
 
const ossimRgbVectoroperator= (const ossimJpegYCbCrVector &data)
 
const ossimRgbVectoroperator= (const ossimHsiVector &hsi)
 
const ossimRgbVectoroperator= (const ossimHsvVector &hsv)
 
const ossimRgbVectoroperator= (const ossimCmyVector &cmy)
 
bool operator== (const ossimRgbVector &rgb)
 
bool operator!= (const ossimRgbVector &rgb)
 
unsigned char getR () const
 
unsigned char getG () const
 
unsigned char getB () const
 
void setR (unsigned char R)
 
void setG (unsigned char G)
 
void setB (unsigned char B)
 

Static Public Member Functions

static long clamp (long colorValue, unsigned char min=0, unsigned char max=255)
 

Protected Attributes

unsigned char theBuf [3]
 

Friends

ostream & operator<< (ostream &out, const ossimRgbVector &data)
 

Detailed Description

Definition at line 21 of file ossimRgbVector.h.

Constructor & Destructor Documentation

◆ ossimRgbVector() [1/8]

ossimRgbVector::ossimRgbVector ( unsigned char  r = 0,
unsigned char  g = 0,
unsigned char  b = 0 
)
inline

Definition at line 32 of file ossimRgbVector.h.

33  {
34  theBuf[0] = r;
35  theBuf[1] = g;
36  theBuf[2] = b;
37  }
unsigned char theBuf[3]

◆ ossimRgbVector() [2/8]

ossimRgbVector::ossimRgbVector ( const ossimRgbVector copy_this)
inline

Definition at line 38 of file ossimRgbVector.h.

References theBuf.

39  {
40  theBuf[0] = copy_this.theBuf[0];
41  theBuf[1] = copy_this.theBuf[1];
42  theBuf[2] = copy_this.theBuf[2];
43  }
unsigned char theBuf[3]

◆ ossimRgbVector() [3/8]

ossimRgbVector::ossimRgbVector ( unsigned char  grey)
inline

Definition at line 44 of file ossimRgbVector.h.

45  {
46  theBuf[0] = grey;
47  theBuf[1] = grey;
48  theBuf[2] = grey;
49  }
unsigned char theBuf[3]

◆ ossimRgbVector() [4/8]

ossimRgbVector::ossimRgbVector ( unsigned char  colorData[3])
inline

Definition at line 50 of file ossimRgbVector.h.

51  {
52  theBuf[0] = colorData[0];
53  theBuf[1] = colorData[1];
54  theBuf[2] = colorData[2];
55  }
unsigned char theBuf[3]

◆ ossimRgbVector() [5/8]

ossimRgbVector::ossimRgbVector ( const ossimJpegYCbCrVector YCbCr)

Definition at line 18 of file ossimRgbVector.cpp.

References clamp(), ossimJpegYCbCrVector::getCb(), ossimJpegYCbCrVector::getCr(), ossimJpegYCbCrVector::getY(), and theBuf.

19 {
20  theBuf[0] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() +
21  1.402 * (YCbCr.getCr()-128.0))));
22  theBuf[1] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() -
23  0.34414 *(YCbCr.getCb()-128.0) -
24  0.71414*(YCbCr.getCr()-128.0))));
25  theBuf[2] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() +
26  1.772 * ( YCbCr.getCb()-128.0))));
27 
28 }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
unsigned char getY() const
unsigned char getCr() const
unsigned char getCb() const

◆ ossimRgbVector() [6/8]

ossimRgbVector::ossimRgbVector ( const ossimHsiVector hsi)

Definition at line 30 of file ossimRgbVector.cpp.

References clamp(), ossimHsiVector::getH(), ossimHsiVector::getI(), ossimHsiVector::getS(), RAD_PER_DEG, and theBuf.

31 {
32  float h = hsi.getH();
33  float s = hsi.getS();
34  float i = hsi.getI();
35 
36  float r=0;
37  float g=0;
38  float b=0;
39 
40  if(h <= 120.0)
41  {
42  b = i*(1-s);
43 
44  r = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
45  g = 3*i - (r+b);
46  }
47  else if(h <= 240.0)
48  {
49  h-=120;
50 
51  r = i*(1-s);
52  g = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
53  b = 3*i - (r+g);
54  }
55  else if(h <= 360.0)
56  {
57  h-=240;
58 
59  g = i*(1-s);
60  b = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
61  r = 3*i - (g+b);
62  }
63 
64  theBuf[0] = clamp((long)(r*255));
65  theBuf[1] = clamp((long)(g*255));
66  theBuf[2] = clamp((long)(b*255));
67 }
unsigned char theBuf[3]
ossim_float64 getS() const
ossim_float64 getH() const
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
ossim_float64 getI() const
#define RAD_PER_DEG

◆ ossimRgbVector() [7/8]

ossimRgbVector::ossimRgbVector ( const ossimHsvVector hsv)

Definition at line 69 of file ossimRgbVector.cpp.

References clamp(), ossimHsvVector::getH(), ossimHsvVector::getS(), ossimHsvVector::getV(), n, ossimHsvVector::OSSIM_HSV_UNDEFINED, and theBuf.

70 {
71  // H is given on [0, 6] or UNDEFINED. S and V are given on [0, 1].
72  // RGB are each returned on [0, 1].
73  float h = hsv.getH(), // unnormalize it
74  s = hsv.getS(),
75  v = hsv.getV();
76  float m, n, f;
77  int i;
79  {
80  theBuf[0] = clamp(ossim::round<int>(v*255));
81  theBuf[1] = clamp(ossim::round<int>(v*255));
82  theBuf[2] = clamp(ossim::round<int>(v*255));
83  }
84  else
85  {
86  h*=6.0; // unnormalize h
87  i = (int)floor(h);
88  f = h - i;
89  if(!(i & 1)) f = 1 - f; // if i is even
90  m = v * (1 - s);
91  n = v * (1 - s * f);
92  switch (i)
93  {
94  case 6:
95  case 0:
96  {
97  theBuf[0] = clamp(ossim::round<int>(v*255));
98  theBuf[1] = clamp(ossim::round<int>(n*255));
99  theBuf[2] = clamp(ossim::round<int>(m*255));
100  break;
101  }
102  case 1:
103  {
104  theBuf[0] = clamp(ossim::round<int>(n*255));
105  theBuf[1] = clamp(ossim::round<int>(v*255));
106  theBuf[2] = clamp(ossim::round<int>(m*255));
107  break;
108  }
109  case 2:
110  {
111  theBuf[0] = clamp(ossim::round<int>(m*255));
112  theBuf[1] = clamp(ossim::round<int>(v*255));
113  theBuf[2] = clamp(ossim::round<int>(n*255));
114  break;
115  }
116  case 3:
117  {
118  theBuf[0] = clamp(ossim::round<int>(m*255));
119  theBuf[1] = clamp(ossim::round<int>(n*255));
120  theBuf[2] = clamp(ossim::round<int>(v*255));
121  break;
122  }
123  case 4:
124  {
125  theBuf[0] = clamp(ossim::round<int>(n*255));
126  theBuf[1] = clamp(ossim::round<int>(m*255));
127  theBuf[2] = clamp(ossim::round<int>(v*255));
128  break;
129  }
130  case 5:
131  {
132  theBuf[0] = clamp(ossim::round<int>(v*255));
133  theBuf[1] = clamp(ossim::round<int>(m*255));
134  theBuf[2] = clamp(ossim::round<int>(n*255));
135  break;
136  }
137  }
138  }
139 }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
static const float OSSIM_HSV_UNDEFINED
float getS() const
os2<< "> n<< " > nendobj n
float getH() const
float getV() const

◆ ossimRgbVector() [8/8]

ossimRgbVector::ossimRgbVector ( const ossimCmyVector cmy)

Definition at line 141 of file ossimRgbVector.cpp.

References ossimCmyVector::getC(), ossimCmyVector::getM(), ossimCmyVector::getY(), and theBuf.

142 {
143  theBuf[0] = 255 - cmy.getC();
144  theBuf[1] = 255 - cmy.getM();
145  theBuf[2] = 255 - cmy.getY();
146 }
unsigned char theBuf[3]
ossim_uint8 getC() const
ossim_uint8 getM() const
ossim_uint8 getY() const

Member Function Documentation

◆ clamp()

static long ossimRgbVector::clamp ( long  colorValue,
unsigned char  min = 0,
unsigned char  max = 255 
)
inlinestatic

Definition at line 97 of file ossimRgbVector.h.

References max, and min.

Referenced by ossimBumpShadeTileSource::computeColor(), operator=(), and ossimRgbVector().

98  {
99  colorValue = colorValue > (long)max? (long)max:colorValue;
100  colorValue = colorValue < (long)min? (long)min:colorValue;
101 
102  return colorValue;
103  }
#define max(a, b)
Definition: auxiliary.h:76
#define min(a, b)
Definition: auxiliary.h:75

◆ getB()

unsigned char ossimRgbVector::getB ( ) const
inline

Definition at line 106 of file ossimRgbVector.h.

Referenced by ossimMapCompositionSource::addGeographicBottomGridLabels(), ossimMapCompositionSource::addGeographicGridLines(), ossimMapCompositionSource::addGeographicGridReseaux(), ossimMapCompositionSource::addGeographicLeftGridLabels(), ossimMapCompositionSource::addGeographicRightGridLabels(), ossimMapCompositionSource::addMeterGridLabels(), ossimMapCompositionSource::addMeterGridLines(), ossimMapCompositionSource::addMeterGridReseaux(), ossimMapCompositionSource::addTitle(), ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimGdalOgrVectorAnnotation::drawAnnotations(), ossimImageDataHelper::fill(), ossimRgbLutDataObject::findIndex(), ossimColorProperty::getBlue(), ossimHsvToRgbSource::getTile(), ossimIntensityAdjustmentFilter::getTile(), ossimHsiToRgbSource::getTile(), ossimJpegYCbCrToRgbSource::getTile(), ossimIndexToRgbLutFilter::getTile(), ossimEsriShapeFileFilter::loadArc(), ossimGdalOgrVectorAnnotation::loadLineString(), ossimGdalOgrVectorAnnotation::loadMultiLineString(), ossimGdalOgrVectorAnnotation::loadMultiPoint(), ossimGdalOgrVectorAnnotation::loadMultiPolygon(), ossimGdalOgrVectorAnnotation::loadPoint(), ossimGdalOgrVectorAnnotation::loadPolygon(), ossimEsriShapeFileFilter::loadPolygon(), ossimHsvVector::operator=(), ossimHsiVector::operator=(), ossimCmyVector::operator=(), ossimJpegYCbCrVector::operator=(), ossimCmyVector::ossimCmyVector(), ossimHsiVector::ossimHsiVector(), ossimHsvVector::ossimHsvVector(), ossimJpegYCbCrVector::ossimJpegYCbCrVector(), ossimNormRgbVector::ossimNormRgbVector(), ossimGdalOgrVectorAnnotation::saveState(), ossimRgbLutDataObject::saveState(), ossimVpfAnnotationFeatureInfo::saveState(), ossimEsriShapeFileFilter::saveState(), ossimVpfAnnotationFeatureInfo::setDrawingFeaturesToAnnotation(), ossimGdalOgrVectorAnnotation::updateAnnotationSettings(), and ossimColorProperty::valueToString().

106 { return theBuf[2]; }
unsigned char theBuf[3]

◆ getG()

unsigned char ossimRgbVector::getG ( ) const
inline

Definition at line 105 of file ossimRgbVector.h.

Referenced by ossimMapCompositionSource::addGeographicBottomGridLabels(), ossimMapCompositionSource::addGeographicGridLines(), ossimMapCompositionSource::addGeographicGridReseaux(), ossimMapCompositionSource::addGeographicLeftGridLabels(), ossimMapCompositionSource::addGeographicRightGridLabels(), ossimMapCompositionSource::addMeterGridLabels(), ossimMapCompositionSource::addMeterGridLines(), ossimMapCompositionSource::addMeterGridReseaux(), ossimMapCompositionSource::addTitle(), ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimGdalOgrVectorAnnotation::drawAnnotations(), ossimImageDataHelper::fill(), ossimRgbLutDataObject::findIndex(), ossimColorProperty::getGreen(), ossimHsvToRgbSource::getTile(), ossimIntensityAdjustmentFilter::getTile(), ossimHsiToRgbSource::getTile(), ossimJpegYCbCrToRgbSource::getTile(), ossimIndexToRgbLutFilter::getTile(), ossimEsriShapeFileFilter::loadArc(), ossimGdalOgrVectorAnnotation::loadLineString(), ossimGdalOgrVectorAnnotation::loadMultiLineString(), ossimGdalOgrVectorAnnotation::loadMultiPoint(), ossimGdalOgrVectorAnnotation::loadMultiPolygon(), ossimGdalOgrVectorAnnotation::loadPoint(), ossimGdalOgrVectorAnnotation::loadPolygon(), ossimEsriShapeFileFilter::loadPolygon(), ossimHsvVector::operator=(), ossimHsiVector::operator=(), ossimCmyVector::operator=(), ossimJpegYCbCrVector::operator=(), ossimCmyVector::ossimCmyVector(), ossimHsiVector::ossimHsiVector(), ossimHsvVector::ossimHsvVector(), ossimJpegYCbCrVector::ossimJpegYCbCrVector(), ossimNormRgbVector::ossimNormRgbVector(), ossimGdalOgrVectorAnnotation::saveState(), ossimRgbLutDataObject::saveState(), ossimVpfAnnotationFeatureInfo::saveState(), ossimEsriShapeFileFilter::saveState(), ossimVpfAnnotationFeatureInfo::setDrawingFeaturesToAnnotation(), ossimGdalOgrVectorAnnotation::updateAnnotationSettings(), and ossimColorProperty::valueToString().

105 { return theBuf[1]; }
unsigned char theBuf[3]

◆ getR()

unsigned char ossimRgbVector::getR ( ) const
inline

Definition at line 104 of file ossimRgbVector.h.

Referenced by ossimMapCompositionSource::addGeographicBottomGridLabels(), ossimMapCompositionSource::addGeographicGridLines(), ossimMapCompositionSource::addGeographicGridReseaux(), ossimMapCompositionSource::addGeographicLeftGridLabels(), ossimMapCompositionSource::addGeographicRightGridLabels(), ossimMapCompositionSource::addMeterGridLabels(), ossimMapCompositionSource::addMeterGridLines(), ossimMapCompositionSource::addMeterGridReseaux(), ossimMapCompositionSource::addTitle(), ossimVpfAnnotationFeatureInfo::buildEdgFeature(), ossimVpfAnnotationFeatureInfo::buildPointFeature(), ossimVpfAnnotationFeatureInfo::buildTxtFeature(), ossimGdalOgrVectorAnnotation::drawAnnotations(), ossimImageDataHelper::fill(), ossimRgbLutDataObject::findIndex(), ossimColorProperty::getRed(), ossimHsvToRgbSource::getTile(), ossimIntensityAdjustmentFilter::getTile(), ossimHsiToRgbSource::getTile(), ossimJpegYCbCrToRgbSource::getTile(), ossimIndexToRgbLutFilter::getTile(), ossimEsriShapeFileFilter::loadArc(), ossimGdalOgrVectorAnnotation::loadLineString(), ossimGdalOgrVectorAnnotation::loadMultiLineString(), ossimGdalOgrVectorAnnotation::loadMultiPoint(), ossimGdalOgrVectorAnnotation::loadMultiPolygon(), ossimGdalOgrVectorAnnotation::loadPoint(), ossimGdalOgrVectorAnnotation::loadPolygon(), ossimEsriShapeFileFilter::loadPolygon(), ossimHsvVector::operator=(), ossimHsiVector::operator=(), ossimCmyVector::operator=(), ossimJpegYCbCrVector::operator=(), ossimCmyVector::ossimCmyVector(), ossimHsiVector::ossimHsiVector(), ossimHsvVector::ossimHsvVector(), ossimJpegYCbCrVector::ossimJpegYCbCrVector(), ossimNormRgbVector::ossimNormRgbVector(), ossimGdalOgrVectorAnnotation::saveState(), ossimVpfAnnotationFeatureInfo::saveState(), ossimEsriShapeFileFilter::saveState(), ossimVpfAnnotationFeatureInfo::setDrawingFeaturesToAnnotation(), ossimGdalOgrVectorAnnotation::updateAnnotationSettings(), and ossimColorProperty::valueToString().

104 { return theBuf[0]; }
unsigned char theBuf[3]

◆ operator!=()

bool ossimRgbVector::operator!= ( const ossimRgbVector rgb)
inline

Definition at line 91 of file ossimRgbVector.h.

References theBuf.

92  {
93  return ( (rgb.theBuf[0] != theBuf[0])||
94  (rgb.theBuf[1] != theBuf[1])||
95  (rgb.theBuf[2] != theBuf[2]));
96  }
unsigned char theBuf[3]

◆ operator*()

ossimRgbVector ossimRgbVector::operator* ( double  t) const
inline

Definition at line 75 of file ossimRgbVector.h.

References ossim::clamp().

76  {
77  return ossimRgbVector((unsigned char)clamp((long)(theBuf[0]*t)),
78  (unsigned char)clamp((long)(theBuf[1]*t)),
79  (unsigned char)clamp((long)(theBuf[2]*t)));
80  }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
ossimRgbVector(unsigned char r=0, unsigned char g=0, unsigned char b=0)

◆ operator+()

ossimRgbVector ossimRgbVector::operator+ ( const ossimRgbVector rgb) const
inline

Definition at line 69 of file ossimRgbVector.h.

References ossim::clamp(), and theBuf.

70  {
71  return ossimRgbVector((unsigned char)clamp((long)theBuf[0] + (long)rgb.theBuf[0]),
72  (unsigned char)clamp((long)theBuf[1] + (long)rgb.theBuf[1]),
73  (unsigned char)clamp((long)theBuf[2] + (long)rgb.theBuf[2]));
74  }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
ossimRgbVector(unsigned char r=0, unsigned char g=0, unsigned char b=0)

◆ operator-()

ossimRgbVector ossimRgbVector::operator- ( const ossimRgbVector rgb) const
inline

Definition at line 62 of file ossimRgbVector.h.

References ossim::clamp(), and theBuf.

63  {
64  return ossimRgbVector((unsigned char)clamp((long)theBuf[0] - (long)rgb.theBuf[0]),
65  (unsigned char)clamp((long)theBuf[1] - (long)rgb.theBuf[1]),
66  (unsigned char)clamp((long)theBuf[2] - (long)rgb.theBuf[2]));
67  }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
ossimRgbVector(unsigned char r=0, unsigned char g=0, unsigned char b=0)

◆ operator=() [1/4]

const ossimRgbVector & ossimRgbVector::operator= ( const ossimJpegYCbCrVector data)

Definition at line 221 of file ossimRgbVector.cpp.

References clamp(), ossimJpegYCbCrVector::getCb(), ossimJpegYCbCrVector::getCr(), ossimJpegYCbCrVector::getY(), and theBuf.

222 {
223  theBuf[0] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() +
224  1.402 * (YCbCr.getCr()-128.0))));
225  theBuf[1] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() -
226  0.34414 *(YCbCr.getCb()-128.0) -
227  0.71414*(YCbCr.getCr()-128.0))));
228  theBuf[2] = static_cast<unsigned char>(clamp(ossim::round<int>(YCbCr.getY() +
229  1.772 * ( YCbCr.getCb()-128.0))));
230 
231  return *this;
232 }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)

◆ operator=() [2/4]

const ossimRgbVector & ossimRgbVector::operator= ( const ossimHsiVector hsi)

Definition at line 234 of file ossimRgbVector.cpp.

References clamp(), ossimHsiVector::getH(), ossimHsiVector::getI(), ossimHsiVector::getS(), RAD_PER_DEG, and theBuf.

235 {
236  float h = hsi.getH();
237  float s = hsi.getS();
238  float i = hsi.getI();
239 
240  float r=0;
241  float g=0;
242  float b=0;
243 
244  if(h <= 120.0)
245  {
246  b = i*(1-s);
247 
248  r = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
249  g = 3*i - (r+b);
250  }
251  else if(h <= 240.0)
252  {
253  h-=120;
254 
255  r = i*(1-s);
256  g = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
257  b = 3*i - (r+g);
258  }
259  else if(h <= 360.0)
260  {
261  h-=240;
262 
263  g = i*(1-s);
264  b = i*(1 + s*cos(RAD_PER_DEG*h)/cos((60-h)*RAD_PER_DEG));
265  r = 3*i - (g+b);
266  }
267 
268  theBuf[0] = clamp((long)(r*255));
269  theBuf[1] = clamp((long)(g*255));
270  theBuf[2] = clamp((long)(b*255));
271 
272  return *this;
273 }
unsigned char theBuf[3]
ossim_float64 getS() const
ossim_float64 getH() const
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
ossim_float64 getI() const
#define RAD_PER_DEG

◆ operator=() [3/4]

const ossimRgbVector & ossimRgbVector::operator= ( const ossimHsvVector hsv)

Definition at line 148 of file ossimRgbVector.cpp.

References clamp(), ossimHsvVector::getH(), ossimHsvVector::getS(), ossimHsvVector::getV(), n, ossimHsvVector::OSSIM_HSV_UNDEFINED, and theBuf.

149 {
150  // H is given on [0, 6] or UNDEFINED. S and V are given on [0, 1].
151  // RGB are each returned on [0, 1].
152  float h = hsv.getH(), // unnormalize it
153  s = hsv.getS(),
154  v = hsv.getV();
155  float m, n, f;
156  int i;
158  {
159  theBuf[0] = clamp(ossim::round<int>(v*255));
160  theBuf[1] = clamp(ossim::round<int>(v*255));
161  theBuf[2] = clamp(ossim::round<int>(v*255));
162  }
163  else
164  {
165  h*=6.0; // unnormalize h
166  i = (int)floor(h);
167  f = h - i;
168  if(!(i & 1)) f = 1 - f; // if i is even
169  m = v * (1 - s);
170  n = v * (1 - s * f);
171  switch (i)
172  {
173  case 6:
174  case 0:
175  {
176  theBuf[0] = clamp(ossim::round<int>(v*255));
177  theBuf[1] = clamp(ossim::round<int>(n*255));
178  theBuf[2] = clamp(ossim::round<int>(m*255));
179  break;
180  }
181  case 1:
182  {
183  theBuf[0] = clamp(ossim::round<int>(n*255));
184  theBuf[1] = clamp(ossim::round<int>(v*255));
185  theBuf[2] = clamp(ossim::round<int>(m*255));
186  break;
187  }
188  case 2:
189  {
190  theBuf[0] = clamp(ossim::round<int>(m*255));
191  theBuf[1] = clamp(ossim::round<int>(v*255));
192  theBuf[2] = clamp(ossim::round<int>(n*255));
193  break;
194  }
195  case 3:
196  {
197  theBuf[0] = clamp(ossim::round<int>(m*255));
198  theBuf[1] = clamp(ossim::round<int>(n*255));
199  theBuf[2] = clamp(ossim::round<int>(v*255));
200  break;
201  }
202  case 4:
203  {
204  theBuf[0] = clamp(ossim::round<int>(n*255));
205  theBuf[1] = clamp(ossim::round<int>(m*255));
206  theBuf[2] = clamp(ossim::round<int>(v*255));
207  break;
208  }
209  case 5:
210  {
211  theBuf[0] = clamp(ossim::round<int>(v*255));
212  theBuf[1] = clamp(ossim::round<int>(m*255));
213  theBuf[2] = clamp(ossim::round<int>(n*255));
214  break;
215  }
216  }
217  }
218  return *this;
219 }
unsigned char theBuf[3]
static long clamp(long colorValue, unsigned char min=0, unsigned char max=255)
static const float OSSIM_HSV_UNDEFINED
float getS() const
os2<< "> n<< " > nendobj n
float getH() const
float getV() const

◆ operator=() [4/4]

const ossimRgbVector & ossimRgbVector::operator= ( const ossimCmyVector cmy)

Definition at line 275 of file ossimRgbVector.cpp.

References ossimCmyVector::getC(), ossimCmyVector::getM(), ossimCmyVector::getY(), and theBuf.

276 {
277  theBuf[0] = 255 - cmy.getC();
278  theBuf[1] = 255 - cmy.getM();
279  theBuf[2] = 255 - cmy.getY();
280 
281  return *this;
282 }
unsigned char theBuf[3]
ossim_uint8 getC() const
ossim_uint8 getM() const
ossim_uint8 getY() const

◆ operator==()

bool ossimRgbVector::operator== ( const ossimRgbVector rgb)
inline

Definition at line 85 of file ossimRgbVector.h.

References theBuf.

86  {
87  return ( (rgb.theBuf[0] == theBuf[0])&&
88  (rgb.theBuf[1] == theBuf[1])&&
89  (rgb.theBuf[2] == theBuf[2]));
90  }
unsigned char theBuf[3]

◆ setB()

void ossimRgbVector::setB ( unsigned char  B)
inline

◆ setG()

void ossimRgbVector::setG ( unsigned char  G)
inline

◆ setR()

void ossimRgbVector::setR ( unsigned char  R)
inline

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  out,
const ossimRgbVector data 
)
friend

Definition at line 24 of file ossimRgbVector.h.

25  {
26  out << "<" << (long)data.theBuf[0] << ", "
27  << (long)data.theBuf[1] << ", "
28  << (long)data.theBuf[2] << ">";
29 
30  return out;
31  }
unsigned char theBuf[3]

Member Data Documentation

◆ theBuf

unsigned char ossimRgbVector::theBuf[3]
protected

The documentation for this class was generated from the following files: