Commit 01419977 authored by Halla Rempt's avatar Halla Rempt

Centralize the code for creating the colorspace checks

parent b25172f2
......@@ -519,7 +519,7 @@ if(X11_FOUND)
target_link_libraries(kritaui Qt5::X11Extras ${X11_LIBRARIES})
endif()
target_link_libraries(kritaui LINK_INTERFACE_LIBRARIES kritaimage kritalibbrush kritapigment kritawidgets KF5::Completion KF5::I18n ${GL_INTERFACE_LIBRARIES})
target_link_libraries(kritaui LINK_INTERFACE_LIBRARIES kritaimage kritaimpex kritalibbrush kritapigment kritawidgets KF5::Completion KF5::I18n ${GL_INTERFACE_LIBRARIES})
target_include_directories(kritaui
PUBLIC
......
......@@ -24,7 +24,10 @@ Boston, MA 02110-1301, USA.
#include <kis_debug.h>
#include <QStack>
#include "KisImportExportManager.h"
#include <KoColorSpaceRegistry.h>
#include <KoColorModelStandardIds.h>
#include <KisExportCheckBase.h>
#include <KisExportCheckRegistry.h>
#include "KoUpdater.h"
#include <klocalizedstring.h>
......@@ -50,6 +53,7 @@ public:
};
KisImportExportFilter::KisImportExportFilter(QObject *parent)
: QObject(parent)
, d(new Private)
......@@ -218,3 +222,55 @@ void KisImportExportFilter::addCapability(KisExportCheckBase *capability)
{
d->capabilities[capability->id()] = capability;
}
void KisImportExportFilter::addSupportedColorModels(QList<QPair<KoID, KoID> > supportedColorModels, const QString &name, KisExportCheckBase::Level level)
{
Q_ASSERT(level != KisExportCheckBase::SUPPORTED);
QString layerMessage;
QString imageMessage;
if (level == KisExportCheckBase::PARTIALLY) {
imageMessage = i18nc("image conversion warning",
"%1 cannot save images with color model <b>%2</b> and depth <b>%3</b>. The image will be converted.");
layerMessage =
i18nc("image conversion warning",
"%1 cannot save layers with color model <b>%2</b> and depth <b>%3</b>. The layers will be converted or skipped.");
}
else {
imageMessage = i18nc("image conversion warning",
"%1 cannot save images with color model <b>%2</b> and depth <b>%3</b>. The image will not be saved.");
layerMessage =
i18nc("image conversion warning",
"%1 cannot save layers with color model <b>%2</b> and depth <b>%3</b>. The layers will be skipped.");
}
QList<KoID> allColorModels = KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorModelID, allColorModels) {
QList<KoID> allColorDepths = KoColorSpaceRegistry::instance()->colorDepthList(colorModelID.id(), KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorDepthID, allColorDepths) {
KisExportCheckFactory *colorModelCheckFactory = KisExportCheckRegistry::instance()->get("ColorModelCheck/" + colorModelID.id() + "/" + colorDepthID.id());
KisExportCheckFactory *colorModelPerLayerCheckFactory = KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + colorModelID.id() + "/" + colorDepthID.id());
if(!colorModelCheckFactory || !colorModelPerLayerCheckFactory) {
qDebug() << "No factory for" << colorModelID << colorDepthID;
continue;
}
if (supportedColorModels.contains(QPair<KoID, KoID>(colorModelID, colorDepthID))) {
addCapability(colorModelCheckFactory->create(KisExportCheckBase::SUPPORTED));
addCapability(colorModelPerLayerCheckFactory->create(KisExportCheckBase::SUPPORTED));
}
else {
addCapability(colorModelCheckFactory->create(level, imageMessage.arg(name).arg(colorModelID.name()).arg(colorDepthID.name())));
addCapability(colorModelPerLayerCheckFactory->create(level, layerMessage.arg(name).arg(colorModelID.name()).arg(colorDepthID.name())));
}
}
}
}
......@@ -26,14 +26,17 @@ Boston, MA 02110-1301, USA.
#include <QMap>
#include <QPointer>
#include <QString>
#include <QPair>
#include <QList>
#include <KoID.h>
#include <QSharedPointer>
#include <kis_properties_configuration.h>
#include <kis_types.h>
#include <KisExportCheckBase.h>
class KoUpdater;
class KisDocument;
class KisConfigWidget;
class KisExportCheckBase;
#include "kritaui_export.h"
......@@ -163,6 +166,7 @@ protected:
void setProgress(int value);
virtual void initializeCapabilities();
void addCapability(KisExportCheckBase *capability);
void addSupportedColorModels(QList<QPair<KoID, KoID> > supportedColorModels, const QString &name, KisExportCheckBase::Level level = KisExportCheckBase::PARTIALLY);
private:
......
......@@ -26,6 +26,7 @@
#include <QFileInfo>
#include <QApplication>
#include <KisMimeDatabase.h>
#include <KisExportCheckRegistry.h>
#include <kis_paint_device.h>
#include <KisDocument.h>
......@@ -52,7 +53,12 @@ KisImportExportFilter::ConversionStatus KisBMPExport::convert(KisDocument *docum
void KisBMPExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, KisMimeDatabase::descriptionForMimeType(mimeType()));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
}
#include "kis_bmp_export.moc"
......
......@@ -198,8 +198,11 @@ KisConfigWidget *KisBrushExport::createConfigurationWidget(QWidget *parent, cons
void KisBrushExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "Gimp Brushes");
if (mimeType() == "image/x-gimp-brush-animated") {
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
}
......
......@@ -68,7 +68,10 @@ KisImportExportFilter::ConversionStatus KisCSVExport::convert(KisDocument *docum
void KisCSVExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "CSV");
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
}
......
......@@ -137,43 +137,17 @@ void EXRExport::initializeCapabilities()
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
QList<KoID> supportedColorModels;
supportedColorModels << RGBAColorModelID << GrayAColorModelID << GrayColorModelID << XYZAColorModelID;
QList<KoID> supportedColorDepths;
supportedColorDepths << Float32BitsColorDepthID << Float16BitsColorDepthID;
QList<KoID> allColorModels = KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorModelID, allColorModels) {
QList<KoID> allColorDepths = KoColorSpaceRegistry::instance()->colorDepthList(colorModelID.id(), KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorDepthID, allColorDepths) {
KisExportCheckFactory *f1 = KisExportCheckRegistry::instance()->get("ColorModelCheck/" + colorModelID.id() + "/" + colorDepthID.id());
KisExportCheckFactory *f2 = KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + colorModelID.id() + "/" + colorDepthID.id());
if(!f1 || !f2) {
qDebug() << "No factory for" << colorModelID << colorDepthID;
continue;
}
if (supportedColorModels.contains(colorModelID) && supportedColorDepths.contains(colorDepthID)) {
addCapability(f1->create(KisExportCheckBase::SUPPORTED));
addCapability(f2->create(KisExportCheckBase::SUPPORTED));
}
else {
addCapability(f1->create(KisExportCheckBase::UNSUPPORTED,
i18nc("image conversion warning",
"EXR cannot save images with color model <b>%1</b> and depth <b>%2</b>. The image will not be saved.",
colorModelID.name(),
colorDepthID.name())));
addCapability(f2->create(KisExportCheckBase::PARTIALLY,
i18nc("image conversion warning",
"EXR cannot save layers with color model <b>%1</b> and depth <b>%2</b>. The layers will be skipped.",
colorModelID.name(),
colorDepthID.name())));
}
}
}
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Float32BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Float32BitsColorDepthID)
<< QPair<KoID, KoID>(GrayColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(GrayColorModelID, Float32BitsColorDepthID)
<< QPair<KoID, KoID>(XYZAColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(XYZAColorModelID, Float32BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "TIFF");
}
......
......@@ -76,10 +76,16 @@ KisConfigWidget *KisHeightMapExport::createConfigurationWidget(QWidget *parent,
void KisHeightMapExport::initializeCapabilities()
{
if (mimeType() == "image/x-r8") {
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "R8 Heightmap");
}
else if (mimeType() == "image/x-r16") {
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "R16 Heightmap");
}
}
......
......@@ -157,10 +157,13 @@ void KisJPEGExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ExifCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + CMYKAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(CMYKAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "JPEG");
}
......
......@@ -96,10 +96,13 @@ void OraExport::initializeCapabilities()
addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisAdjustmentLayer")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelHomogenousCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "OpenRaster");
}
......
......@@ -162,10 +162,13 @@ KisConfigWidget *KisPNGExport::createConfigurationWidget(QWidget *parent, const
void KisPNGExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "PNG");
}
void KisWdgOptionsPNG::setConfiguration(const KisPropertiesConfigurationSP cfg)
......
......@@ -278,6 +278,14 @@ void KisPPMExport::initializeCapabilities()
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "PPM");
}
......
......@@ -100,43 +100,19 @@ void psdExport::initializeCapabilities()
addCapability(factory->create(30000, 30000, KisExportCheckBase::SUPPORTED));
}
QList<KoID> supportedColorModels;
supportedColorModels << RGBAColorModelID << GrayAColorModelID << LABAColorModelID << CMYKAColorModelID;
QList<KoID> supportedColorDepths;
supportedColorDepths << Float32BitsColorDepthID << Float16BitsColorDepthID << Integer8BitsColorDepthID << Integer16BitsColorDepthID;
QList<KoID> allColorModels = KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorModelID, allColorModels) {
QList<KoID> allColorDepths = KoColorSpaceRegistry::instance()->colorDepthList(colorModelID.id(), KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorDepthID, allColorDepths) {
KisExportCheckFactory *f1 = KisExportCheckRegistry::instance()->get("ColorModelCheck/" + colorModelID.id() + "/" + colorDepthID.id());
KisExportCheckFactory *f2 = KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + colorModelID.id() + "/" + colorDepthID.id());
if(!f1 || !f2) {
qDebug() << "No factory for" << colorModelID << colorDepthID;
continue;
}
if (supportedColorModels.contains(colorModelID) && supportedColorDepths.contains(colorDepthID)) {
addCapability(f1->create(KisExportCheckBase::SUPPORTED));
addCapability(f2->create(KisExportCheckBase::SUPPORTED));
}
else {
addCapability(f1->create(KisExportCheckBase::UNSUPPORTED,
i18nc("image conversion warning",
"EXR cannot save images with color model <b>%1</b> and depth <b>%2</b>. The image will not be saved.",
colorModelID.name(),
colorDepthID.name())));
addCapability(f2->create(KisExportCheckBase::UNSUPPORTED,
i18nc("image conversion warning",
"EXR cannot save layers with color model <b>%1</b> and depth <b>%2</b>. The layers will be skipped.",
colorModelID.name(),
colorDepthID.name())));
}
}
}
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Float32BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(CMYKAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(CMYKAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(LABAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(LABAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "PSD");
}
......
......@@ -59,11 +59,13 @@ KisImportExportFilter::ConversionStatus QMLExport::convert(KisDocument *document
void QMLExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
}
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "QML");
}
......
......@@ -598,10 +598,10 @@ KisImportExportFilter::ConversionStatus KisSpriterExport::convert(KisDocument *d
void KisSpriterExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + GrayAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "Spriter");
}
......
......@@ -80,7 +80,11 @@ KisImportExportFilter::ConversionStatus KisTGAExport::convert(KisDocument *docum
void KisTGAExport::initializeCapabilities()
{
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "TGA");
}
......
......@@ -175,54 +175,19 @@ void KisTIFFExport::initializeCapabilities()
addCapability(KisExportCheckRegistry::instance()->get("MultiLayerCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("sRGBProfileCheck")->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Float16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + RGBAColorModelID.id() + "/" + Float32BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelCheck/" + LABAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Integer8BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Float16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + RGBAColorModelID.id() + "/" + Float32BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
addCapability(KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + LABAColorModelID.id() + "/" + Integer16BitsColorDepthID.id())->create(KisExportCheckBase::SUPPORTED));
QList<KoID> supportedColorModels;
supportedColorModels << RGBAColorModelID << GrayAColorModelID << CMYKAColorModelID;
QList<KoID> supportedColorDepths;
supportedColorDepths << Integer8BitsColorDepthID << Integer16BitsColorDepthID;
QList<KoID> allColorModels = KoColorSpaceRegistry::instance()->colorModelsList(KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorModelID, allColorModels) {
QList<KoID> allColorDepths = KoColorSpaceRegistry::instance()->colorDepthList(colorModelID.id(), KoColorSpaceRegistry::AllColorSpaces);
Q_FOREACH(const KoID &colorDepthID, allColorDepths) {
KisExportCheckFactory *f1 = KisExportCheckRegistry::instance()->get("ColorModelCheck/" + colorModelID.id() + "/" + colorDepthID.id());
KisExportCheckFactory *f2 = KisExportCheckRegistry::instance()->get("ColorModelPerLayerCheck/" + colorModelID.id() + "/" + colorDepthID.id());
if(!f1 || !f2) {
qDebug() << "No factory for" << colorModelID << colorDepthID;
continue;
}
if (!supportedColorModels.contains(colorModelID) || !supportedColorDepths.contains(colorDepthID)) {
addCapability(f1->create(KisExportCheckBase::UNSUPPORTED,
i18nc("image conversion warning",
"Tiff cannot save images with color model <b>%1</b> and depth <b>%2</b>. The image will not be saved.",
colorModelID.name(),
colorDepthID.name())));
addCapability(f2->create(KisExportCheckBase::UNSUPPORTED,
i18nc("image conversion warning",
"Tiff cannot save layers with color model <b>%1</b> and depth <b>%2</b>. The layers will be skipped.",
colorModelID.name(),
colorDepthID.name())));
}
}
}
QList<QPair<KoID, KoID> > supportedColorModels;
supportedColorModels << QPair<KoID, KoID>()
<< QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Float16BitsColorDepthID)
<< QPair<KoID, KoID>(RGBAColorModelID, Float32BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(CMYKAColorModelID, Integer8BitsColorDepthID)
<< QPair<KoID, KoID>(CMYKAColorModelID, Integer16BitsColorDepthID)
<< QPair<KoID, KoID>(LABAColorModelID, Integer16BitsColorDepthID);
addSupportedColorModels(supportedColorModels, "TIFF");
}
#include <kis_tiff_export.moc>
......
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