upgraded to ocio v2
This commit is contained in:
+47
-47
@@ -24,41 +24,41 @@
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
Color Color::fromHsv(const float &h, const float &s, const float &v)
|
||||
Color Color::fromHsv(const double &h, const double &s, const double &v)
|
||||
{
|
||||
float C = s * v;
|
||||
float X = C * (1.0f - abs(fmod(h / 60.0f, 2.0f) - 1.0f));
|
||||
float m = v - C;
|
||||
float Rs, Gs, Bs;
|
||||
double C = s * v;
|
||||
double X = C * (1.0 - abs(fmod(h / 60.0, 2.0) - 1.0));
|
||||
double m = v - C;
|
||||
double Rs, Gs, Bs;
|
||||
|
||||
if(h >= 0.0f && h < 60.0f) {
|
||||
if(h >= 0.0 && h < 60.0) {
|
||||
Rs = C;
|
||||
Gs = X;
|
||||
Bs = 0.0f;
|
||||
Bs = 0.0;
|
||||
}
|
||||
else if(h >= 60.0f && h < 120.0f) {
|
||||
else if(h >= 60.0 && h < 120.0) {
|
||||
Rs = X;
|
||||
Gs = C;
|
||||
Bs = 0.0f;
|
||||
Bs = 0.0;
|
||||
}
|
||||
else if(h >= 120.0f && h < 180.0f) {
|
||||
Rs = 0.0f;
|
||||
else if(h >= 120.0 && h < 180.0) {
|
||||
Rs = 0.0;
|
||||
Gs = C;
|
||||
Bs = X;
|
||||
}
|
||||
else if(h >= 180.0f && h < 240.0f) {
|
||||
Rs = 0.0f;
|
||||
else if(h >= 180.0 && h < 240.0) {
|
||||
Rs = 0.0;
|
||||
Gs = X;
|
||||
Bs = C;
|
||||
}
|
||||
else if(h >= 240.0f && h < 300.0f) {
|
||||
else if(h >= 240.0 && h < 300.0) {
|
||||
Rs = X;
|
||||
Gs = 0.0f;
|
||||
Gs = 0.0;
|
||||
Bs = C;
|
||||
}
|
||||
else {
|
||||
Rs = C;
|
||||
Gs = 0.0f;
|
||||
Gs = 0.0;
|
||||
Bs = X;
|
||||
}
|
||||
|
||||
@@ -78,11 +78,11 @@ Color::Color(const QColor &c)
|
||||
set_alpha(c.alphaF());
|
||||
}
|
||||
|
||||
void Color::toHsv(float *hue, float *sat, float *val) const
|
||||
void Color::toHsv(double *hue, double *sat, double *val) const
|
||||
{
|
||||
float fCMax = qMax(qMax(red(), green()), blue());
|
||||
float fCMin = qMin(qMin(red(), green()), blue());
|
||||
float fDelta = fCMax - fCMin;
|
||||
double fCMax = qMax(qMax(red(), green()), blue());
|
||||
double fCMin = qMin(qMin(red(), green()), blue());
|
||||
double fDelta = fCMax - fCMin;
|
||||
|
||||
if(fDelta > 0) {
|
||||
if(fCMax == red()) {
|
||||
@@ -111,31 +111,31 @@ void Color::toHsv(float *hue, float *sat, float *val) const
|
||||
}
|
||||
}
|
||||
|
||||
float Color::hsv_hue() const
|
||||
double Color::hsv_hue() const
|
||||
{
|
||||
float h, s, v;
|
||||
double h, s, v;
|
||||
toHsv(&h, &s, &v);
|
||||
return h;
|
||||
}
|
||||
|
||||
float Color::hsv_saturation() const
|
||||
double Color::hsv_saturation() const
|
||||
{
|
||||
float h, s, v;
|
||||
double h, s, v;
|
||||
toHsv(&h, &s, &v);
|
||||
return s;
|
||||
}
|
||||
|
||||
float Color::value() const
|
||||
double Color::value() const
|
||||
{
|
||||
float h, s, v;
|
||||
double h, s, v;
|
||||
toHsv(&h, &s, &v);
|
||||
return v;
|
||||
}
|
||||
|
||||
void Color::toHsl(float *hue, float *sat, float *lightness) const
|
||||
void Color::toHsl(double *hue, double *sat, double *lightness) const
|
||||
{
|
||||
float fCMin = qMin(red(), qMin(green(), blue()));
|
||||
float fCMax = qMax(red(), qMax(green(), blue()));
|
||||
double fCMin = qMin(red(), qMin(green(), blue()));
|
||||
double fCMax = qMax(red(), qMax(green(), blue()));
|
||||
|
||||
*lightness = 0.5 * (fCMin + fCMax);
|
||||
|
||||
@@ -173,30 +173,30 @@ void Color::toHsl(float *hue, float *sat, float *lightness) const
|
||||
}
|
||||
}
|
||||
|
||||
float Color::hsl_hue() const
|
||||
double Color::hsl_hue() const
|
||||
{
|
||||
float h, s, l;
|
||||
double h, s, l;
|
||||
toHsl(&h, &s, &l);
|
||||
return h;
|
||||
}
|
||||
|
||||
float Color::hsl_saturation() const
|
||||
double Color::hsl_saturation() const
|
||||
{
|
||||
float h, s, l;
|
||||
double h, s, l;
|
||||
toHsl(&h, &s, &l);
|
||||
return s;
|
||||
}
|
||||
|
||||
float Color::lightness() const
|
||||
double Color::lightness() const
|
||||
{
|
||||
float h, s, l;
|
||||
double h, s, l;
|
||||
toHsl(&h, &s, &l);
|
||||
return l;
|
||||
}
|
||||
|
||||
void Color::toData(char *data, const PixelFormat::Format &format) const
|
||||
{
|
||||
OIIO::convert_types(OIIO::TypeDesc::FLOAT,
|
||||
OIIO::convert_types(OIIO::TypeDesc::DOUBLE,
|
||||
data_,
|
||||
PixelFormat::GetOIIOTypeDesc(format),
|
||||
data,
|
||||
@@ -209,7 +209,7 @@ Color Color::fromData(const char *data, const PixelFormat::Format &format)
|
||||
|
||||
OIIO::convert_types(PixelFormat::GetOIIOTypeDesc(format),
|
||||
data,
|
||||
OIIO::TypeDesc::FLOAT,
|
||||
OIIO::TypeDesc::DOUBLE,
|
||||
c.data_,
|
||||
kRGBAChannels);
|
||||
|
||||
@@ -221,17 +221,17 @@ QColor Color::toQColor() const
|
||||
QColor c;
|
||||
|
||||
// QColor only supports values from 0.0 to 1.0 and are only used for UI representations
|
||||
c.setRedF(clamp(red(), 0.0f, 1.0f));
|
||||
c.setGreenF(clamp(green(), 0.0f, 1.0f));
|
||||
c.setBlueF(clamp(blue(), 0.0f, 1.0f));
|
||||
c.setAlphaF(clamp(alpha(), 0.0f, 1.0f));
|
||||
c.setRedF(clamp(red(), 0.0, 1.0));
|
||||
c.setGreenF(clamp(green(), 0.0, 1.0));
|
||||
c.setBlueF(clamp(blue(), 0.0, 1.0));
|
||||
c.setAlphaF(clamp(alpha(), 0.0, 1.0));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
float Color::GetRoughLuminance() const
|
||||
double Color::GetRoughLuminance() const
|
||||
{
|
||||
return (2*red()+blue()+3*green())/6.0f;
|
||||
return (2*red()+blue()+3*green())/6.0;
|
||||
}
|
||||
|
||||
const Color &Color::operator+=(const Color &rhs)
|
||||
@@ -252,7 +252,7 @@ const Color &Color::operator-=(const Color &rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Color &Color::operator*=(const float &rhs)
|
||||
const Color &Color::operator*=(const double &rhs)
|
||||
{
|
||||
for (int i=0;i<kRGBAChannels;i++) {
|
||||
data_[i] *= rhs;
|
||||
@@ -261,7 +261,7 @@ const Color &Color::operator*=(const float &rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Color &Color::operator/=(const float &rhs)
|
||||
const Color &Color::operator/=(const double &rhs)
|
||||
{
|
||||
for (int i=0;i<kRGBAChannels;i++) {
|
||||
data_[i] /= rhs;
|
||||
@@ -284,14 +284,14 @@ Color Color::operator-(const Color &rhs) const
|
||||
return c;
|
||||
}
|
||||
|
||||
Color Color::operator*(const float &rhs) const
|
||||
Color Color::operator*(const double &rhs) const
|
||||
{
|
||||
Color c(*this);
|
||||
c *= rhs;
|
||||
return c;
|
||||
}
|
||||
|
||||
Color Color::operator/(const float &rhs) const
|
||||
Color Color::operator/(const double &rhs) const
|
||||
{
|
||||
Color c(*this);
|
||||
c /= rhs;
|
||||
|
||||
Reference in New Issue
Block a user