Commit 273a0e71 authored by Emanuele Tamponi's avatar Emanuele Tamponi

More work.

svn path=/trunk/koffice/; revision=752114
parent e14644cf
......@@ -96,7 +96,7 @@ bool KisIlluminantProfile::load() // TODO Info
int l;
double c;
data >> l;
if ((size_t)l != 3*m_T->size2) {
if ((size_t)l != m_T->size2) {
gsl_matrix_free(m_T); m_T = 0;
return false;
}
......
......@@ -47,6 +47,8 @@ class KisIlluminantProfile : public KoColorProfile {
gsl_matrix *T() const { return m_T; }
gsl_vector *P() const { return m_P; }
int wavelenghts() { return m_P->size; }
private:
gsl_matrix *m_T;
gsl_vector *m_P;
......
......@@ -22,11 +22,19 @@
#include "kis_illuminant_profile.h"
#include <KoColorProfile.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_cblas.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_vector.h>
KisKS3ColorSpace::KisKS3ColorSpace(KoColorProfile *p)
: parent( "KS3CS" + p->name(),
"KS 3 Color Space with profile " + p->name(),
KoColorSpaceRegistry::instance()->rgb16("") )
{
if (!profileIsCompatible(p))
return;
m_profile = dynamic_cast<KisIlluminantProfile *>(p);
// TODO Add channels
......@@ -48,13 +56,20 @@ const KoColorProfile *KisKS3ColorSpace::profile() const
bool KisKS3ColorSpace::profileIsCompatible(const KoColorProfile *profile) const
{
if (!dynamic_cast<const KisIlluminantProfile *>(profile))
const KisIlluminantProfile *p = dynamic_cast<const KisIlluminantProfile *>(profile);
if (!p)
return false;
if (p->wavelenghts() != 3)
return false;
return true;
}
void KisKS3ColorSpace::fromRgbA16(const quint8 *srcU8, quint8 *dstU8, quint32 nPixels) const
{
// For each pixel we do this:
// 1 - convert raw bytes to quint16
// 2 - find reflectances using the T matrix of the profile
// 3 - convert reflectances to K/S
}
void KisKS3ColorSpace::toRgbA16(const quint8 *srcU8, quint8 *dstU8, quint32 nPixels) const
......
/*
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
\ No newline at end of file
/*
* Copyright (c) 2007 Emanuele Tamponi <emanuele@valinor.it>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KS_REF_CONVERSIONS_H_
#define KS_REF_CONVERSIONS_H_
class KSReflectanceConverter {
};
#endif // KS_REF_CONVERSIONS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment