本文整理汇总了C++中KisImageWSP::yRes方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageWSP::yRes方法的具体用法?C++ KisImageWSP::yRes怎么用?C++ KisImageWSP::yRes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageWSP
的用法示例。
在下文中一共展示了KisImageWSP::yRes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundingRect
QRectF KisNodeShape::boundingRect() const
{
QRect br = m_d->node->extent();
KisImageWSP image = getImage();
return QRectF(int(br.left()) / image->xRes(), int(br.top()) / image->yRes(),
int(1 + br.right()) / image->xRes(), int(1 + br.bottom()) / image->yRes());
}
示例2: Private
Private(KisDocument *document, int fromTime, int toTime)
: document(document),
image(document->image()),
firstFrame(fromTime),
lastFrame(toTime),
tmpDoc(KisPart::instance()->createDocument()),
exporting(false),
batchMode(false)
{
tmpDoc->setAutoSave(0);
tmpImage = new KisImage(tmpDoc->createUndoStore(),
image->bounds().width(),
image->bounds().height(),
image->colorSpace(),
QString());
tmpImage->setResolution(image->xRes(), image->yRes());
tmpDoc->setCurrentImage(tmpImage);
KisPaintLayer* paintLayer = new KisPaintLayer(tmpImage, "paint device", 255);
tmpImage->addNode(paintLayer, tmpImage->rootLayer(), KisLayerSP(0));
tmpDevice = paintLayer->paintDevice();
}
示例3: saveXML
QDomElement KisKraSaver::saveXML(QDomDocument& doc, KisImageWSP image)
{
QDomElement imageElement = doc.createElement("IMAGE"); // Legacy!
Q_ASSERT(image);
imageElement.setAttribute(NAME, m_d->imageName);
imageElement.setAttribute(MIME, NATIVE_MIMETYPE);
imageElement.setAttribute(WIDTH, image->width());
imageElement.setAttribute(HEIGHT, image->height());
imageElement.setAttribute(COLORSPACE_NAME, image->colorSpace()->id());
imageElement.setAttribute(DESCRIPTION, m_d->doc->documentInfo()->aboutInfo("comment"));
// XXX: Save profile as blob inside the image, instead of the product name.
if (image->profile() && image->profile()-> valid()) {
imageElement.setAttribute(PROFILE, image->profile()->name());
}
imageElement.setAttribute(X_RESOLUTION, image->xRes()*72.0);
imageElement.setAttribute(Y_RESOLUTION, image->yRes()*72.0);
quint32 count = 1; // We don't save the root layer, but it does count
KisSaveXmlVisitor visitor(doc, imageElement, count, true);
image->rootLayer()->accept(visitor);
m_d->nodeFileNames = visitor.nodeFileNames();
return imageElement;
}
示例4: getLayer
KisImageBuilder_Result CSVSaver::getLayer(CSVLayerRecord* layer, KisDocument* exportDoc, KisKeyframeSP keyframe, const QString &path, int frame, int idx)
{
//render to the temp layer
KisImageWSP image = exportDoc->image();
KisPaintDeviceSP device = image->rootLayer()->firstChild()->projection();
layer->channel->fetchFrame(keyframe, device);
QRect bounds = device->exactBounds();
if (bounds.isEmpty()) {
layer->last = ""; //empty frame
return KisImageBuilder_RESULT_OK;
}
layer->last = QString("frame%1-%2.png").arg(idx + 1,5,10,QChar('0')).arg(frame,5,10,QChar('0'));
QString filename = path;
filename.append(layer->last);
//save to PNG
KisSequentialConstIterator it(device, image->bounds());
const KoColorSpace* cs = device->colorSpace();
bool isThereAlpha = false;
do {
if (cs->opacityU8(it.oldRawData()) != OPACITY_OPAQUE_U8) {
isThereAlpha = true;
break;
}
} while (it.nextPixel());
if (!KisPNGConverter::isColorSpaceSupported(cs)) {
device = new KisPaintDevice(*device.data());
KUndo2Command *cmd= device->convertTo(KoColorSpaceRegistry::instance()->rgb8());
delete cmd;
}
KisPNGOptions options;
options.alpha = isThereAlpha;
options.interlace = false;
options.compression = 8;
options.tryToSaveAsIndexed = false;
options.transparencyFillColor = QColor(0,0,0);
options.saveSRGBProfile = true; //TVPaint can use only sRGB
options.forceSRGB = false;
KisPNGConverter kpc(exportDoc);
KisImageBuilder_Result result = kpc.buildFile(QUrl::fromLocalFile(filename), image->bounds(),
image->xRes(), image->yRes(), device,
image->beginAnnotations(), image->endAnnotations(),
options, (KisMetaData::Store* )0 );
return result;
}
示例5: slotOnScreenResolutionChanged
void KisCanvasResourceProvider::slotOnScreenResolutionChanged()
{
KisImageWSP image = m_view->image();
KisCanvas2 *canvas = m_view->canvasBase();
if(!image || !canvas) return;
qreal zoomX, zoomY;
canvas->coordinatesConverter()->zoom(&zoomX, &zoomY);
qreal scaleX = zoomX / image->xRes();
qreal scaleY = zoomY / image->yRes();
emit sigOnScreenResolutionChanged(scaleX, scaleY);
}
示例6: size
QSizeF KisNodeShape::size() const
{
Q_ASSERT(m_d);
Q_ASSERT(m_d->node);
QRect br = m_d->node->extent();
KisImageWSP image = getImage();
if (!image) return QSizeF(0.0, 0.0);
dbgUI << "KisNodeShape::size extent:" << br << ", x res:" << image->xRes() << ", y res:" << image->yRes();
return QSizeF(br.width() / image->xRes(), br.height() / image->yRes());
}
示例7: setPosition
void KisNodeShape::setPosition(const QPointF & position)
{
Q_ASSERT(m_d);
Q_ASSERT(m_d->node);
KisImageWSP image = getImage();
if (image) {
// XXX: Does flake handle undo for us?
QPointF pf(position.x() / image->xRes(), position.y() / image->yRes());
QPoint p = pf.toPoint();
m_d->node->setX(p.x());
m_d->node->setY(p.y());
}
}
示例8: 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;
}