Update of /cvsroot/csp/APPLICATIONS/CSPFlightSim/Source
In directory sc8-pr-cvs1:/tmp/cvs-serv7429
Added Files:
Colorspace.cpp
Log Message:
Colorspace conversion library and Color class
--- NEW FILE: Colorspace.cpp ---
/**
* @file Colorspace.cpp
*
* The vast majority of the colorspace manipulation routines
* included here are adapted from Fortran90 functions written
* by John Burkardt. His excellent colorspace library is
* available from the Pittsburgh Supercomputing Center:
*
* http://www.psc.edu/~burkardt/src/colors/colors.html
*
* Translation of John's routines from Fortran90 to C/C++
* was done by Mark Rose <mr...@st...>.
*/
#include "Color.h"
#include <stdio.h>
#define PI 3.14159265358979323846264338327950288419716939937510
[...1031 lines suppressed...]
break;
case HSV:
HSV_to_RGB(a, b, c, R, G, B);
if (internal_check) RGB_check(R, G, B);
RGB_to_HLS(R, G, B, H, L, S);
break;
default:
return Color(0.0, 0.0, 0.0, INVALID);
}
HLS_check(H, L, S);
return Color(H, L, S, HLS);
}
std::ostream &operator<<(std::ostream &os, const Color &c) {
os << "[" << c.getSpaceLabel() << ": "
<< c.getA() << ", "
<< c.getB() << ", "
<< c.getC() << "]";
}
|