00001
00009 #ifndef _VU_FIXEL_H_
00010 #define _VU_FIXEL_H_
00011
00012 #include <iostream.h>
00013 #include <stdio.h>
00014 #include "vuSimpleTypes.h"
00015 #include "vuFixelType.h"
00016
00017
00018 template <int SIZE, class TYPE>
00019 class vuFixel
00020 {
00021 public:
00023 vuFixel();
00024
00026 vuFixel(const vuFixel<SIZE,TYPE>& inst);
00027
00029 vuFixel(const TYPE *array);
00030
00032 vuFixel(const TYPE value);
00033
00035 ~vuFixel();
00036
00038 TYPE& operator[](unsigned int index);
00039
00041 TYPE operator[](unsigned int index) const;
00042
00044 TYPE *getBuffer();
00045
00047 TYPE const *getBuffer() const;
00048
00050 vuFixel<SIZE,TYPE>& operator=(const TYPE* rhs);
00051
00053 vuFixel<SIZE,TYPE>& operator=(TYPE* rhs);
00054
00056 vuFixel<SIZE,TYPE>& operator=(const vuFixel<SIZE,TYPE>& rhs);
00057
00060 bool operator==(const vuFixel<SIZE,TYPE>& rhs) const;
00061
00065 vuFixel<SIZE,TYPE> operator+(const vuFixel<SIZE,TYPE>& rhs) const;
00066
00069 vuFixel<SIZE,TYPE> operator+(TYPE a) const;
00070
00073 vuFixel<SIZE,TYPE> operator-(const vuFixel<SIZE,TYPE>& rhs) const;
00074
00077 vuFixel<SIZE,TYPE> operator*(const vuFixel<SIZE,TYPE>& rhs) const;
00078
00081 vuFixel<SIZE,TYPE> operator/(const vuFixel<SIZE,TYPE>& rhs) const;
00082
00086 vuFixel<SIZE,TYPE> operator*(TYPE rhs) const;
00087
00089 vuFixel<SIZE,TYPE>& operator+=(const vuFixel<SIZE,TYPE>& rhs);
00090
00092 vuFixel<SIZE,TYPE>& operator-=(const vuFixel<SIZE,TYPE>& rhs);
00093
00095 vuFixel<SIZE,TYPE>& operator*=(const vuFixel<SIZE,TYPE>& rhs);
00096
00098 vuFixel<SIZE,TYPE>& operator/=(const vuFixel<SIZE,TYPE>& rhs);
00099
00101 vuFixel<SIZE,TYPE>& operator*=(TYPE rhs);
00102
00104 vuFixel<SIZE,TYPE>& operator/=(TYPE rhs);
00105
00108 word size() const;
00109
00111 TYPE maxComponent() const;
00112
00114 TYPE minComponent() const;
00115
00116 #if 0
00117
00121 friend vuFixel<SIZE,TYPE>
00122 operator*(TYPE lhs, const vuFixel<SIZE,TYPE>& rhs);
00123
00125 friend ostream& operator<<(ostream& os, const vuFixel<SIZE,TYPE>& A);
00126
00128 friend istream& operator>>(istream& is, vuFixel<SIZE,TYPE>& A);
00129 #endif
00130
00132 istream& read (istream& is);
00133
00135 ostream& write(ostream& os) const;
00136
00137 protected:
00138 TYPE m_buffer[SIZE];
00139 };
00140
00141 template class vuFixel<1,byte>;
00142 template class vuFixel<2,byte>;
00143 template class vuFixel<3,byte>;
00144
00145 template class vuFixel<1,float>;
00146 template class vuFixel<2,float>;
00147 template class vuFixel<3,float>;
00148
00149
00150 typedef vuFixel<1,byte> vuFixel1B;
00151 typedef vuFixel<2,byte> vuFixel2B;
00152 typedef vuFixel<3,byte> vuFixel3B;
00153
00154 typedef vuFixel<1,float> vuFixel1F;
00155 typedef vuFixel<2,float> vuFixel2F;
00156 typedef vuFixel<3,float> vuFixel3F;
00157
00158 #endif