Subversion Repositories Scribus

Rev

Rev 22518 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15127 jghali 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
 
8
#include "sclcms2colortransformimpl.h"
9
#include "sclcms2colormgmtengineimpl.h"
10
 
11
ScLcms2ColorTransformImpl::ScLcms2ColorTransformImpl(ScColorMgmtEngine& engine, cmsHTRANSFORM lcmsTransform)
12
                        : ScColorTransformImplBase(engine), m_transformHandle(lcmsTransform)
13
{
14
 
15
}
16
 
17
ScLcms2ColorTransformImpl::~ScLcms2ColorTransformImpl()
18
{
19
        deleteTransform();
20
}
21
 
22
bool ScLcms2ColorTransformImpl::isNull() const
23
{
24
        return (m_transformHandle == NULL);
25
}
26
 
27
bool ScLcms2ColorTransformImpl::apply(void* input, void* output, uint numElem)
28
{
29
        if (m_transformHandle)
30
        {
31
                cmsDoTransform(m_transformHandle, input, output, numElem);
32
                return true;
33
        }
34
        return false;
35
}
36
 
37
bool ScLcms2ColorTransformImpl::apply(QByteArray& input, QByteArray& output, uint numElem)
38
{
39
        if (m_transformHandle)
40
        {
41
                cmsDoTransform(m_transformHandle, input.data(), output.data(), numElem);
42
                return true;
43
        }
44
        return false;
45
}
46
 
47
void ScLcms2ColorTransformImpl::deleteTransform(void)
48
{
49
        if (m_transformHandle)
50
        {
51
                cmsDeleteTransform(m_transformHandle);
52
                m_transformHandle = NULL;
53
        }
54
}
55