本文整理汇总了C++中QuillImage::targetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QuillImage::targetSize方法的具体用法?C++ QuillImage::targetSize怎么用?C++ QuillImage::targetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuillImage
的用法示例。
在下文中一共展示了QuillImage::targetSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
QuillImage LoadFilter::apply(const QuillImage &tile) const
{
if (priv->fileFormatQt.isEmpty() && !priv->isInvalid)
const_cast<LoadFilter *>(this)->detectFormat();
if (priv->isInvalid)
return QuillImage();
bool isNew = !reader
|| (filterAddress != this)
|| !priv->bufferInitialized
|| !tile.isFragment()
|| (priv->fileFormatQt != reader->format())
|| (!tile.targetSize().isEmpty()
&& (tile.targetSize() != tile.area().size()));
filterAddress = const_cast<LoadFilter*>(this);
priv->bufferInitialized = true;
if (priv->iODevice) {
delete reader;
reader = new QImageReader(priv->iODevice, priv->fileFormatQt.toAscii());
if (!priv->fileFormatQt.isEmpty())
reader->setFormat(priv->fileFormatQt.toAscii());
}
else {
if (isNew) {
delete reader;
reader = 0;
if (!const_cast<LoadFilter*>(this)->readFileToByteArray())
return QuillImage();
buffer.seek(0);
priv->orientation = readOrientation();
reader = new QImageReader(&buffer, priv->fileFormatQt.toAscii());
if (!priv->fileFormatQt.isEmpty())
reader->setFormat(priv->fileFormatQt.toAscii());
}
else {
buffer.seek(0);
}
}
QuillImage input = tile;
if (input.fullImageSize().isEmpty())
input.setFullImageSize(reader->size());
if (input.area().isEmpty())
input.setArea(QRect(QPoint(0, 0), input.fullImageSize()));
QImage newImage;
QSize targetSize = input.targetSize();
QSize fullImageSize = input.fullImageSize();
QRect area = rotateArea(fullImageSize, input.area(), input);
if ((priv->orientation == Exif_Orientation_Rotated90) ||
(priv->orientation == Exif_Orientation_Rotated270)) {
targetSize.transpose();
fullImageSize.transpose();
}
/*
Resetting reader for ScaledSize and ClipRect. This resetting
will make sure that the reader will have all the options set
correctly if the same reader has been used previously.
Does not do the calculation in all cases since it is time consuming.
*/
if (reader->scaledSize().isValid() || reader->clipRect().isValid()) {
QSize readerSize = reader->size();
reader->setScaledSize(readerSize);
reader->setClipRect(QRect(QPoint(0,0),readerSize));
}
if (!input.isFragment()){
fullImage = QImage();
if (!targetSize.isEmpty()) {
reader->setScaledSize(targetSize);
}
newImage = readFromReader();
}
else if (!targetSize.isEmpty() &&
(targetSize != area.size())) {
// Both cropping and scaling have been requested
// Current implementation: ask plugin for the scaled image, then crop
// This can be later optimized with a plugin that effectively
// supports the ScaledClipRect option.
reader->setScaledSize(QSize(targetSize.width() *
fullImageSize.width() /
area.width(),
targetSize.height() *
fullImageSize.height() /
//.........这里部分代码省略.........