5 Copyright (C) 2006 Yangli Hector Yee
7 This program is free software; you can redistribute it and/or modify it under the terms of the
8 GNU General Public License as published by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along with this program;
16 if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 Code from http://pdiff.sourceforge.net
24 virtual int Get_Width(void) const = 0;
25 virtual int Get_Height(void) const = 0;
26 virtual unsigned char Get_Red(unsigned int i
) = 0;
27 virtual unsigned char Get_Green(unsigned int i
) = 0;
28 virtual unsigned char Get_Blue(unsigned int i
) = 0;
29 virtual unsigned char Get_Alpha(unsigned int i
) = 0;
30 virtual void Set(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
, unsigned int i
) = 0;
31 virtual unsigned int Get(int i
) const = 0;
34 class RGBAImageData
: RGBAImage
37 RGBAImageData(int w
, int h
)
41 Data
= new unsigned int[w
* h
];
43 ~RGBAImageData() { if (Data
) delete[] Data
; }
44 unsigned char Get_Red(unsigned int i
) { return (Data
[i
] & 0xFF); }
45 unsigned char Get_Green(unsigned int i
) { return ((Data
[i
]>>8) & 0xFF); }
46 unsigned char Get_Blue(unsigned int i
) { return ((Data
[i
]>>16) & 0xFF); }
47 unsigned char Get_Alpha(unsigned int i
) { return ((Data
[i
]>>24) & 0xFF); }
48 void Set(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
, unsigned int i
)
49 { Data
[i
] = r
| (g
<< 8) | (b
<< 16) | (a
<< 24); }
50 int Get_Width(void) const { return Width
; }
51 int Get_Height(void) const { return Height
; }
52 void Set(int x
, int y
, unsigned int d
) { Data
[x
+ y
* Width
] = d
; }
53 unsigned int Get(int x
, int y
) const { return Data
[x
+ y
* Width
]; }
54 unsigned int Get(int i
) const { return Data
[i
]; }
70 float FieldOfView
; // Field of view in degrees
71 float Gamma
; // The gamma to convert to linear color space
72 float Luminance
; // the display's luminance
75 #define DIFFERENT_SIZES (unsigned long)-1
76 #define IDENTICAL (unsigned long)0
78 unsigned long Yee_Compare(CompareArgs
&args
);