00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __UT_Pixel__
00020 #define __UT_Pixel__
00021
00022 #include "UT_API.h"
00023 #include <SYS/SYS_Types.h>
00024
00025 class UT_Color;
00026 class UT_BIG_RGBA;
00027
00028 class UT_API UT_RGBA {
00029 public:
00030 UT_RGBA() {}
00031 UT_RGBA(char cr, char cg, char cb, char ca)
00032 { a = (unsigned char)ca; b = (unsigned char)cb;
00033 g = (unsigned char)cg; r = (unsigned char)cr; }
00034
00035 UT_RGBA(const UT_BIG_RGBA &rgba) { *this = rgba; }
00036
00037 UT_RGBA &operator=(const UT_BIG_RGBA &big);
00038 UT_RGBA &operator=(const UT_RGBA &mysmall);
00039
00040 unsigned char r, g, b, a;
00041 };
00042
00043 class UT_API UT_BIG_RGBA {
00044 public:
00045 UT_BIG_RGBA() {}
00046 UT_BIG_RGBA(unsigned short cr, unsigned short cg,
00047 unsigned short cb, unsigned short ca)
00048 { a = ca; b = cb; g = cg; r = cr; }
00049
00050 UT_BIG_RGBA(const UT_RGBA &rgba) { *this = rgba; }
00051
00052 UT_BIG_RGBA &operator=(const UT_RGBA &mysmall);
00053 UT_BIG_RGBA &operator=(const UT_BIG_RGBA &big);
00054
00055 unsigned short r, g, b, a;
00056 };
00057
00058
00059
00060
00061
00062
00063
00064 class UT_RGBA;
00065 class UT_BIG_RGBA;
00066
00067 class UT_API UT_LONG_RGBA
00068 {
00069 public:
00070 UT_LONG_RGBA() { a = b = g = r = 0; }
00071 UT_LONG_RGBA(unsigned short cr, unsigned short cg,
00072 unsigned short cb, unsigned short ca)
00073 { a = (long)ca; b = (long)cb; g = (long)cg; r = (long)cr; }
00074
00075 UT_LONG_RGBA(const UT_RGBA &rgba) { *this = rgba; }
00076 UT_LONG_RGBA(const UT_BIG_RGBA &rgba) { *this = rgba; }
00077
00078 UT_LONG_RGBA &operator=(const UT_RGBA &mysmall);
00079 UT_LONG_RGBA &operator=(const UT_BIG_RGBA &big);
00080
00081 void scale (fpreal);
00082 void offset(fpreal);
00083
00084 long a, b, g, r;
00085 };
00086
00087 class UT_API UT_HSVA {
00088 public:
00089 UT_HSVA() {}
00090 UT_HSVA(unsigned short ch, unsigned short cs, char cv, char ca)
00091 { h = (short)ch; s = (short)cs;
00092 v = (unsigned short)((cv << 8) | cv);
00093 a = (unsigned short)((ca << 8) | cv); }
00094
00095 UT_HSVA(unsigned short ch, unsigned short cs,
00096 unsigned short cv, unsigned short ca)
00097 { h = (short)ch; s = (short)cs; v = cv; a = ca; }
00098
00099 UT_HSVA(const UT_RGBA &rgba) { *this = rgba; }
00100 UT_HSVA(const UT_BIG_RGBA &rgba) { *this = rgba; }
00101 UT_HSVA(const UT_HSVA &hsva) { *this = hsva; }
00102
00103 UT_HSVA &operator=(const UT_RGBA &rgba);
00104 UT_HSVA &operator=(const UT_BIG_RGBA &rgba);
00105 UT_HSVA &operator=(const UT_HSVA &hsva);
00106 UT_HSVA &operator=(const UT_Color &c);
00107
00108 operator UT_RGBA() const;
00109 operator UT_BIG_RGBA() const;
00110
00111
00112 static int enableAlphaDivide(int state);
00113 static int getAlphaDivide() { return hsvDoAlphaDivide; }
00114
00115 short h, s;
00116 unsigned short v, a;
00117
00118 private:
00119 static char hsvDoAlphaDivide;
00120 };
00121
00122 class UT_API UT_BUMP {
00123 public:
00124 UT_BUMP() {}
00125 UT_BUMP(short u, short v) { du = u; dv = v; }
00126
00127 short du, dv;
00128 };
00129
00130 class UT_API UT_BIG_BUMP {
00131 public:
00132 UT_BIG_BUMP() {}
00133 UT_BIG_BUMP(long u, long v) { du = (int)u; dv = (int)v; }
00134
00135 int du, dv;
00136 };
00137
00138 #endif