本文整理汇总了C++中KisImageSP::convertImageColorSpace方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::convertImageColorSpace方法的具体用法?C++ KisImageSP::convertImageColorSpace怎么用?C++ KisImageSP::convertImageColorSpace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::convertImageColorSpace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testConvertImageColorSpace
void KisImageTest::testConvertImageColorSpace()
{
const KoColorSpace *cs8 = KoColorSpaceRegistry::instance()->rgb8();
KisImageSP image = new KisImage(0, 1000, 1000, cs8, "stest");
KisPaintDeviceSP device1 = new KisPaintDevice(cs8);
KisLayerSP paint1 = new KisPaintLayer(image, "paint1", OPACITY_OPAQUE_U8, device1);
KisFilterSP filter = KisFilterRegistry::instance()->value("blur");
Q_ASSERT(filter);
KisFilterConfiguration *configuration = filter->defaultConfiguration(0);
Q_ASSERT(configuration);
KisLayerSP blur1 = new KisAdjustmentLayer(image, "blur1", configuration, 0);
image->addNode(paint1, image->root());
image->addNode(blur1, image->root());
image->refreshGraph();
const KoColorSpace *cs16 = KoColorSpaceRegistry::instance()->rgb16();
image->lock();
image->convertImageColorSpace(cs16,
KoColorConversionTransformation::InternalRenderingIntent,
KoColorConversionTransformation::InternalConversionFlags);
image->unlock();
QVERIFY(*cs16 == *image->colorSpace());
QVERIFY(*cs16 == *image->root()->colorSpace());
QVERIFY(*cs16 == *paint1->colorSpace());
QVERIFY(*cs16 == *blur1->colorSpace());
QVERIFY(!image->root()->compositeOp());
QVERIFY(*cs16 == *paint1->compositeOp()->colorSpace());
QVERIFY(*cs16 == *blur1->compositeOp()->colorSpace());
image->refreshGraph();
}
示例2: test
void KisOcioDisplayFilterTest::test()
{
KisExposureGammaCorrectionInterface *egInterface =
new KisDumbExposureGammaCorrectionInterface();
OcioDisplayFilter filter(egInterface);
QString configFile = TestUtil::fetchDataFileLazy("./psyfiTestingConfig-master/config.ocio");
dbgKrita << ppVar(configFile);
Q_ASSERT(QFile::exists(configFile));
OCIO::ConstConfigRcPtr ocioConfig =
OCIO::Config::CreateFromFile(configFile.toUtf8());
filter.config = ocioConfig;
filter.inputColorSpaceName = ocioConfig->getColorSpaceNameByIndex(0);
filter.displayDevice = ocioConfig->getDisplay(1);
filter.view = ocioConfig->getView(filter.displayDevice, 0);
filter.gamma = 1.0;
filter.exposure = 0.0;
filter.swizzle = RGBA;
filter.blackPoint = 0.0;
filter.whitePoint = 1.0;
filter.forceInternalColorManagement = false;
filter.setLockCurrentColorVisualRepresentation(false);
filter.updateProcessor();
dbgKrita << ppVar(filter.inputColorSpaceName);
dbgKrita << ppVar(filter.displayDevice);
dbgKrita << ppVar(filter.view);
dbgKrita << ppVar(filter.gamma);
dbgKrita << ppVar(filter.exposure);
const KoColorSpace *paintingCS =
KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), Float32BitsColorDepthID.id(), 0);
KisImageSP image = utils::createImage(0, QSize(100, 100));
image->convertImageColorSpace(paintingCS, KoColorConversionTransformation::InternalRenderingIntent, KoColorConversionTransformation::InternalConversionFlags);
image->waitForDone();
dbgKrita << ppVar(paintingCS) << ppVar(image->root()->firstChild()->colorSpace());
KoCanvasResourceManager *resourceManager =
utils::createResourceManager(image,
image->root(), "");
KisDisplayColorConverter converter(resourceManager, 0);
dbgKrita << ppVar(image->root()->firstChild());
QVariant v;
v.setValue(KisNodeWSP(image->root()->firstChild()));
resourceManager->setResource(KisCanvasResourceProvider::CurrentKritaNode, v);
converter.setDisplayFilter(&filter);
dbgKrita << ppVar(converter.paintingColorSpace());
{
QColor refColor(255, 128, 0);
KoColor realColor = converter.approximateFromRenderedQColor(refColor);
QColor roundTripColor = converter.toQColor(realColor);
dbgKrita << ppVar(refColor);
dbgKrita << ppVar(realColor.colorSpace()) << ppVar(KoColor::toQString(realColor));
dbgKrita << ppVar(roundTripColor);
}
{
KoColor realColor(Qt::red, paintingCS);
QColor roundTripColor = converter.toQColor(realColor);
dbgKrita << ppVar(realColor.colorSpace()) << ppVar(KoColor::toQString(realColor));
dbgKrita << ppVar(roundTripColor);
}
}