/*********************************************************************
 * This file is part of the PRAPI library.
 *
 * Copyright (C) 2001 Topi Mäenpää
 * All rights reserved.
 *
 * This program is free software. You can redistribute and/or modify
 * it under the terms of the free software licence found in the
 * accompanying file "COPYING". The licence terms must always be
 * redistributed with this source file. The above copyright notice
 * must be reproduced in all modified and unmodified copies of this
 * source file.
 *
 * $Revision: 1.3 $
 *********************************************************************/

#include "Image.h"

using namespace util;

namespace prapi {

	Matrix<Color<double,3> > Image::XYZToCIELAB(const Matrix<Color<double,3> >& mat,
																							const Color<double,3>& whitePoint)
	{
		int size = mat.getRows()*mat.getColumns();
		util::Matrix<Color<double,3> > result(mat.getRows(), mat.getColumns(), false);
		const Color<double,3>* sData = mat.getData();
		Color<double,3>* tData = result.getData();
		for (int i=size; i--; sData++,tData++)
			*tData = ColorTransform::XYZToCIELAB(*sData, whitePoint);
		return result;	
	}

}
