Warning, file /office/calligra/libs/pigment/KoColorSpaceFactory.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org>
0003  *  Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public License
0016  * along with this library; see the file COPYING.LIB.  If not, write to
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  * Boston, MA 02110-1301, USA.
0019  */
0020 #ifndef KOCOLORSPACEFACTORY_H
0021 #define KOCOLORSPACEFACTORY_H
0022 
0023 #include "KoColorSpaceConstants.h"
0024 #include "KoColorConversionTransformation.h"
0025 #include <KoID.h>
0026 #include "pigment_export.h"
0027 
0028 class KoColorProfile;
0029 class KoColorConversionTransformationFactory;
0030 
0031 /**
0032  * This class is used to create color spaces.
0033  */
0034 class PIGMENTCMS_EXPORT KoColorSpaceFactory
0035 {
0036 protected:
0037     KoColorSpaceFactory();
0038 public:
0039     virtual ~KoColorSpaceFactory();
0040     /**
0041      * Return the unchanging name of this color space
0042      */
0043     virtual QString id() const = 0;
0044 
0045     /**
0046      * return the i18n'able description.
0047      */
0048     virtual QString name() const = 0;
0049 
0050     /**
0051      * @return true if the color space should be shown in a User Interface, or false
0052      *         other wise.
0053      */
0054     virtual bool userVisible() const = 0;
0055 
0056     /**
0057      * @return a string that identify the color model (for instance "RGB" or "CMYK" ...)
0058      * @see KoColorModelStandardIds.h
0059      */
0060     virtual KoID colorModelId() const = 0;
0061 
0062     /**
0063      * @return a string that identify the bit depth (for instance "U8" or "F16" ...)
0064      * @see KoColorModelStandardIds.h
0065      */
0066     virtual KoID colorDepthId() const = 0;
0067 
0068     /**
0069      * @param profile a pointer to a color profile
0070      * @return true if the color profile can be used by a color space created by
0071      * this factory
0072      */
0073     virtual bool profileIsCompatible(const KoColorProfile* profile) const = 0;
0074 
0075     /**
0076      * @return the name of the color space engine for this color space, or "" if none
0077      */
0078     virtual QString colorSpaceEngine() const = 0;
0079 
0080     /**
0081      * @return true if the color space supports High-Dynamic Range.
0082      */
0083     virtual bool isHdr() const = 0;
0084 
0085     /**
0086      * @return the reference depth, that is for a color space where all channels have the same
0087      * depth, this is the depth of one channel, for a color space with different bit depth for
0088      * each channel, it's usually the highest bit depth. This value is used by the Color
0089      * Conversion System to check if a lost of bit depth during a color conversion is
0090      * acceptable, for instance when converting from RGB32bit to XYZ16bit, it's acceptable to go
0091      * through a conversion to RGB16bit, while it's not the case for RGB32bit to XYZ32bit.
0092      */
0093     virtual int referenceDepth() const = 0;
0094 
0095     /**
0096      * @return the list of color conversion provided by this colorspace, the factories
0097      * constructed by this functions are owned by the caller of the function
0098      */
0099     virtual QList<KoColorConversionTransformationFactory*> colorConversionLinks() const = 0;
0100 
0101     /**
0102      * Returns the default icc profile for use with this colorspace. This may be ""
0103      *
0104      * @return the default icc profile name
0105      */
0106     virtual QString defaultProfile() const = 0;
0107 
0108     /**
0109      * Create a color profile from a memory array, if possible, otherwise return 0.
0110      * This will replace the existing profile with the name in the KoColorSpaceRegistry
0111      *
0112      * This will call the decendant's createColorProfile()
0113      */
0114     const KoColorProfile* colorProfile(const QByteArray& rawData) const;
0115 
0116     /**
0117      * Create or reuse the existing colorspace for the given profile.
0118      *
0119      * This will call the decendant's createColorSpace
0120      */
0121     const KoColorSpace *grabColorSpace(const KoColorProfile *profile);
0122 
0123 protected:
0124     /**
0125      * creates a color space using the given profile.
0126      */
0127     virtual KoColorSpace *createColorSpace(const KoColorProfile *) const = 0;
0128     virtual KoColorProfile* createColorProfile(const QByteArray& rawData) const = 0;
0129 private:
0130     struct Private;
0131     Private* const d;
0132 };
0133 
0134 #endif // KOCOLORSPACEFACTORY_H