OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimJpegYCbCrVector.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: ossimJpegYCbCrVector.h 14789 2009-06-29 16:48:14Z dburken $
10 #ifndef ossimJpegYCbCrVector_HEADER
11 #define ossimJpegYCbCrVector_HEADER
12 #include <iostream>
13 using namespace std;
15 
16 class ossimRgbVector;
17 
19 {
20 public:
21  friend ostream& operator << (ostream& out, const ossimJpegYCbCrVector& data)
22  {
23  out << "<" << (long)data.theBuf[0] << ", "
24  << (long)data.theBuf[1] << ", "
25  << (long)data.theBuf[2] << ">";
26 
27  return out;
28  }
29 
30  ossimJpegYCbCrVector(unsigned char Y=0,
31  unsigned char Cb=0,
32  unsigned char Cr=0)
33  {
34  theBuf[0] = Y;
35  theBuf[1] = Cb;
36  theBuf[2] = Cr;
37  }
38 
40 
41  long clamp(long colorValue, unsigned char min=0, unsigned char max=255)const
42  {
43  colorValue = colorValue > max? max:colorValue;
44  colorValue = colorValue < min? min:colorValue;
45 
46  return colorValue;
47  }
48 
49 
50  ossimJpegYCbCrVector& operator =(const ossimRgbVector&);
51 
52  unsigned char getY() const { return theBuf[0]; }
53  unsigned char getCb()const { return theBuf[1]; }
54  unsigned char getCr()const { return theBuf[2]; }
55  void setY(unsigned char Y) { theBuf[0] = Y; }
56  void setCb(unsigned char Cb) { theBuf[1] = Cb; }
57  void setCr(unsigned char Cr) { theBuf[2] = Cr; }
58 
59 protected:
67  unsigned char theBuf[3];
68 };
69 
70 #endif
#define OSSIMDLLEXPORT
ossimJpegYCbCrVector(unsigned char Y=0, unsigned char Cb=0, unsigned char Cr=0)
unsigned char getY() const
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
void setCb(unsigned char Cb)
void setCr(unsigned char Cr)
long clamp(long colorValue, unsigned char min=0, unsigned char max=255) const
#define max(a, b)
Definition: auxiliary.h:76
unsigned char getCr() const
void setY(unsigned char Y)
unsigned char getCb() const
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
#define min(a, b)
Definition: auxiliary.h:75