本文整理汇总了C++中KisImageWSP::projection方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageWSP::projection方法的具体用法?C++ KisImageWSP::projection怎么用?C++ KisImageWSP::projection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageWSP
的用法示例。
在下文中一共展示了KisImageWSP::projection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkLayers
bool checkLayers(KisImageWSP image,
const QString &prefix)
{
KisNodeSP layer1 = image->rootLayer()->firstChild();
KisNodeSP layer2 = layer1->nextSibling();
QVector<QImage> images(3);
images[0] = image->projection()->convertToQImage(0, 0, 0, 300, 300);
images[1] = layer1->paintDevice()->convertToQImage(0, 0, 0, 300, 300);
images[2] = layer2->paintDevice()->convertToQImage(0, 0, 0, 300, 300);
QVector<QString> names(3);
names[0] = QString("applicator_") + prefix + "_projection.png";
names[1] = QString("applicator_") + prefix + "_layer1.png";
names[2] = QString("applicator_") + prefix + "_layer2.png";
bool valid = true;
for(int i = 0; i < 3; i++) {
QImage ref(QString(FILES_DATA_DIR) + QDir::separator() +
"applicator" + QDir::separator() + names[i]);
QPoint temp;
if(!TestUtil::compareQImages(temp, ref, images[i], 1)) {
qDebug() << "--- Wrong image:" << names[i];
valid = false;
images[i].save(QString(FILES_OUTPUT_DIR) + QDir::separator() + names[i]);
}
}
return valid;
}
示例2: saveAsImage
void Imagesplit::saveAsImage(QRect imgSize, QString mimeType, QUrl url)
{
KisImageWSP image = m_view->image();
KisDocument *d = KisPart::instance()->createDocument();
d->prepareForImport();
KisImageWSP dst = new KisImage(d->createUndoStore(), imgSize.width(), imgSize.height(), image->colorSpace(), image->objectName());
dst->setResolution(image->xRes(), image->yRes());
d->setCurrentImage(dst);
KisPaintLayer* paintLayer = new KisPaintLayer(dst, dst->nextLayerName(), 255);
KisPainter gc(paintLayer->paintDevice());
gc.bitBlt(QPoint(0, 0), image->projection(), imgSize);
dst->addNode(paintLayer, KisNodeSP(0));
dst->refreshGraph();
d->setOutputMimeType(mimeType.toLatin1());
d->exportDocument(url);
delete d;
}
示例3: convert
KisImportExportFilter::ConversionStatus KisHeightMapExport::convert(const QByteArray& from, const QByteArray& to)
{
dbgFile << "HeightMap export! From:" << from << ", To:" << to;
if (from != "application/x-krita")
return KisImportExportFilter::NotImplemented;
KisDocument *inputDoc = inputDocument();
QString filename = outputFile();
if (!inputDoc)
return KisImportExportFilter::NoDocumentCreated;
if (filename.isEmpty()) return KisImportExportFilter::FileNotFound;
KisImageWSP image = inputDoc->image();
Q_CHECK_PTR(image);
if (inputDoc->image()->width() != inputDoc->image()->height()) {
inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not square"));
return KisImportExportFilter::WrongFormat;
}
if (inputDoc->image()->colorSpace()->colorModelId() != GrayAColorModelID) {
inputDoc->setErrorMessage(i18n("Cannot export this image to a heightmap: it is not grayscale"));
return KisImportExportFilter::WrongFormat;
}
KoDialog* kdb = new KoDialog(0);
kdb->setWindowTitle(i18n("HeightMap Export Options"));
kdb->setButtons(KoDialog::Ok | KoDialog::Cancel);
Ui::WdgOptionsHeightMap optionsHeightMap;
QWidget* wdg = new QWidget(kdb);
optionsHeightMap.setupUi(wdg);
kdb->setMainWidget(wdg);
QApplication::restoreOverrideCursor();
QString filterConfig = KisConfig().exportConfiguration("HeightMap");
KisPropertiesConfiguration cfg;
cfg.fromXML(filterConfig);
optionsHeightMap.intSize->setValue(image->width());
int endianness = cfg.getInt("endianness", 0);
QDataStream::ByteOrder bo = QDataStream::LittleEndian;
optionsHeightMap.radioPC->setChecked(true);
if (endianness == 0) {
bo = QDataStream::BigEndian;
optionsHeightMap.radioMac->setChecked(true);
}
if (!getBatchMode()) {
if (kdb->exec() == QDialog::Rejected) {
return KisImportExportFilter::UserCancelled;
}
}
if (optionsHeightMap.radioMac->isChecked()) {
cfg.setProperty("endianness", 0);
bo = QDataStream::BigEndian;
}
else {
cfg.setProperty("endianness", 1);
bo = QDataStream::LittleEndian;
}
KisConfig().setExportConfiguration("HeightMap", cfg);
bool downscale = false;
if (to == "image/x-r8" && image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) {
downscale = (QMessageBox::question(0,
i18nc("@title:window", "Downscale Image"),
i18n("You specified the .r8 extension for a 16 bit/channel image. Do you want to save as 8 bit? Your image data will not be changed."),
QMessageBox::Yes | QMessageBox::No)
== QMessageBox::Yes);
}
// the image must be locked at the higher levels
KIS_SAFE_ASSERT_RECOVER_NOOP(image->locked());
KisPaintDeviceSP pd = new KisPaintDevice(*image->projection());
QFile f(filename);
f.open(QIODevice::WriteOnly);
QDataStream s(&f);
s.setByteOrder(bo);
KisRandomConstAccessorSP it = pd->createRandomConstAccessorNG(0, 0);
bool r16 = ((image->colorSpace()->colorDepthId() == Integer16BitsColorDepthID) && !downscale);
for (int i = 0; i < image->height(); ++i) {
for (int j = 0; j < image->width(); ++j) {
it->moveTo(i, j);
if (r16) {
s << KoGrayU16Traits::gray(const_cast<quint8*>(it->rawDataConst()));
}
else {
//.........这里部分代码省略.........