当前位置: 首页>>代码示例>>C++>>正文


C++ QuillImage::fullImageSize方法代码示例

本文整理汇总了C++中QuillImage::fullImageSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QuillImage::fullImageSize方法的具体用法?C++ QuillImage::fullImageSize怎么用?C++ QuillImage::fullImageSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QuillImage的用法示例。


在下文中一共展示了QuillImage::fullImageSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getCenter

QPoint EnlargeShrink::getCenter(const QuillImage &img) const
{
    QPoint center = m_Center;
    if (!img.isFragment() || (img.width() == 170 && img.height() == 170)) {
        center.setX(center.x() * img.width()  / img.fullImageSize().width());
        center.setY(center.y() * img.height() / img.fullImageSize().height());
    }
    return center;
}
开发者ID:Igalia,项目名称:gallery-enlarge-shrink-plugin,代码行数:9,代码来源:enlargeshrink.cpp

示例2: getRadius

double EnlargeShrink::getRadius(const QuillImage &img) const
{
    double radius = m_Radius;
    if (!img.isFragment() || (img.width() == 170 && img.height() == 170)) {
        if (img.fullImageSize().width() < img.fullImageSize().height()) {
            radius = radius * img.width() / img.fullImageSize().width();
        } else {
            radius = radius * img.height() / img.fullImageSize().height();
        }
    }
    return radius;
}
开发者ID:Igalia,项目名称:gallery-enlarge-shrink-plugin,代码行数:12,代码来源:enlargeshrink.cpp

示例3: apply

QuillImage EnlargeShrink::apply(const QuillImage& image) const
{
    if (image.fullImageSize().isEmpty()) {
        return QImage();
    }

    QuillImage out;
    enlargeShrink(image, &out);
    return out;
}
开发者ID:Igalia,项目名称:gallery-enlarge-shrink-plugin,代码行数:10,代码来源:enlargeshrink.cpp

示例4: testFilter

void ut_tileloading::testFilter()
{
    QFile testFile("/usr/share/libquill-tests/images/image_16x4.jpg");
    TileCache *tileCache = new TileCache(100);
    QVERIFY(tileCache);

    QuillImageFilter *filter =
        QuillImageFilterFactory::createImageFilter(QuillImageFilter::Role_Load);
    QVERIFY(filter);
    filter->setOption(QuillImageFilter::FileName,
                      testFile.fileName());

    TileMap tileMap(QSize(8, 2), QSize(2, 2), tileCache);

    for (int i=0; i<4; i++) {
        QCOMPARE(tileMap.tile(i).fullImageSize(), QSize(8, 2));
        QuillImage tile = filter->apply(tileMap.tile(i));
        QCOMPARE(tile.fullImageSize(), QSize(8, 2));;
        tileMap.setTile(i, tile);
        QCOMPARE(tileMap.tile(i).fullImageSize(), QSize(8, 2));
    }

    QImage image("/usr/share/libquill-tests/images/image_16x4.png");
    QCOMPARE(tileMap.tile(0).area(), QRect(0, 0, 2, 2));
    test_utils::analyze((QImage)tileMap.tile(0), image.copy(0, 0, 2, 2), 13);

    QCOMPARE(tileMap.tile(1).area(), QRect(2, 0, 2, 2));
    test_utils::analyze((QImage)tileMap.tile(1), image.copy(2, 0, 2, 2), 13);

    QCOMPARE(tileMap.tile(2).area(), QRect(4, 0, 2, 2));
    test_utils::analyze((QImage)tileMap.tile(2), image.copy(4, 0, 2, 2), 13);

    QCOMPARE(tileMap.tile(3).area(), QRect(6, 0, 2, 2));
    test_utils::analyze((QImage)tileMap.tile(3), image.copy(6, 0, 2, 2), 13);
    
    delete filter;
    delete tileCache;
}
开发者ID:alinelena,项目名称:quill,代码行数:38,代码来源:ut_tileloading.cpp

示例5: saveJpeg

QuillImage SaveFilter::saveJpeg(const QuillImage &image) const
{
    // For thumbnail saving, set save target size to the thumbnail size
    QSize targetSize = image.fullImageSize();
    if (!image.isFragment())
        targetSize = image.size();

    if (priv->serialSaver == 0)
        priv->serialSaver = new SerialSaver(priv->fileName,
                                            targetSize,
                                            priv->rawExifData);

    bool result = priv->serialSaver->process(image);

    priv->tileCount--;

    setFileModificationDateTime();

    if (result)
        return image;
    else
        return QuillImage();
}
开发者ID:amtep,项目名称:quillimagefilters,代码行数:23,代码来源:savefilter.cpp

示例6: 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() /
//.........这里部分代码省略.........
开发者ID:matthewvogt,项目名称:quillimagefilters,代码行数:101,代码来源:loadfilter.cpp

示例7: testMultiOperation

void ut_tileloading::testMultiOperation()
{
    QTemporaryFile tempFile;
    tempFile.open();

    // The original file may be write protected and edits are disabled for
    // such files so we need to make a copy
    QImage originalImage("/usr/share/libquill-tests/images/image_16x4.png");
    originalImage.save(tempFile.fileName(), "jpg");
    Quill::setDefaultTileSize(QSize(2, 2));

    QuillFile *file =
        new QuillFile(tempFile.fileName(), Strings::jpg);

    file->setViewPort(QRect(-8, -2, 16, 4));
    file->setDisplayLevel(1);

    QuillImageFilter *filter =
        QuillImageFilterFactory::createImageFilter(QuillImageFilter::Name_BrightnessContrast);
    filter->setOption(QuillImageFilter::Brightness,
                      QVariant(20));

    QImage referenceImage = filter->apply(originalImage);

    file->runFilter(filter);
    Quill::releaseAndWait(); // preview load
    Quill::releaseAndWait(); // preview filter

    QCOMPARE(file->allImageLevels().count(), 1);

    QuillImage previewImage = file->allImageLevels().at(0);

    QCOMPARE(previewImage.size(), QSize(4, 1));
    QCOMPARE(previewImage.fullImageSize(), QSize(16, 4));

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 1);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 2);
    QuillImage fragment = file->allImageLevels().at(1);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(0, 0, 2, 2));

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 2);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 3);
    fragment = file->allImageLevels().at(2);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(2, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(2, 0, 2, 2),13);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 3);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 4);
    fragment = file->allImageLevels().at(3);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(4, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(4, 0, 2, 2),13);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 4);

    Quill::releaseAndWait();
    QCOMPARE(file->allImageLevels().count(), 5);
    fragment = file->allImageLevels().at(4);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(6, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(6, 0, 2, 2),13);

    delete file;
}
开发者ID:alinelena,项目名称:quill,代码行数:84,代码来源:ut_tileloading.cpp

示例8: testQuill

void ut_tileloading::testQuill()
{
    QFile testFile("/usr/share/libquill-tests/images/image_16x4.jpg");

    QImage referenceImage("/usr/share/libquill-tests/images/image_16x4.png");
    Quill::setDefaultTileSize(QSize(2, 2));

    QuillFile *file =
        new QuillFile(testFile.fileName());

    file->setViewPort(QRect(-8, -2, 16, 4));

    file->setDisplayLevel(1);

    Quill::releaseAndWait(); // preview

    QCOMPARE(file->allImageLevels().count(), 1);

    QuillImage previewImage = file->allImageLevels().at(0);

    QCOMPARE(previewImage.size(), QSize(4, 1));
    QCOMPARE(previewImage.fullImageSize(), QSize(16, 4));

    Quill::releaseAndWait();

    QCOMPARE(file->allImageLevels().count(), 2);
    QuillImage fragment = file->allImageLevels().at(1);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(0, 0, 2, 2));
 
    Quill::releaseAndWait();

    QCOMPARE(file->allImageLevels().count(), 3);
    fragment = file->allImageLevels().at(2);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(2, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(2, 0, 2, 2), 13);

    Quill::releaseAndWait();

    QCOMPARE(file->allImageLevels().count(), 4);
    fragment = file->allImageLevels().at(3);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(4, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(4, 0, 2, 2), 13);

    Quill::releaseAndWait();

    QCOMPARE(file->allImageLevels().count(), 5);
    fragment = file->allImageLevels().at(4);

    QCOMPARE(fragment.size(), QSize(2, 2));
    QCOMPARE(fragment.fullImageSize(), QSize(16, 4));
    QCOMPARE(fragment.area(), QRect(6, 0, 2, 2));
    test_utils::analyze((QImage)fragment, referenceImage.copy(6, 0, 2, 2), 13);

    delete file;
}
开发者ID:alinelena,项目名称:quill,代码行数:64,代码来源:ut_tileloading.cpp

示例9: apply

QuillImage SaveFilter::apply(const QuillImage &image) const
{

    if(image.isNull())
        return QuillImage();
    // Simple format detection (1. given format 2. suffix)
    QString format = priv->fileFormatQt.toLatin1();
    if (format.isEmpty())
        format = QFileInfo(priv->fileName).suffix().toLatin1();

    // Jpeg always uses serial access saving, also for non-tiles,
    // to be able to insert EXIF data
    format = format.toLower();
    if ((format == "jpeg") || (format == "jpg"))
        return saveJpeg(image);

    // For non-tiles, just save
    if (!image.isFragment())
    {
        bool ok = saveFullImage(image);
        if (ok) {
            setFileModificationDateTime();
            return image;
        }
        else
            return QuillImage();
    }

    // First execute - prepare target

    if (priv->fullImageSize == QSize())
    {
            priv->fullImageSize = image.fullImageSize();

            priv->fullImage = QImage(priv->fullImageSize, QImage::Format_RGB32);
    }

    QPainter painter(&(priv->fullImage));
    painter.setCompositionMode(QPainter::CompositionMode_Source);

    painter.drawImage(image.area().topLeft(), image);

    priv->tileCount--;

    // Target full image has everything necessary, so do the final save.

    if (priv->tileCount == 0)
    {
        bool ok = saveFullImage(priv->fullImage);

        if (ok) {
            setFileModificationDateTime();
            // Return non-empty image to represent success
            return image;
        }
        else
            // Return empty image to represent failure
            return QuillImage();
    }
    else
        // No actual save was made, return non-empty image to represent success
        return image;
}
开发者ID:amtep,项目名称:quillimagefilters,代码行数:63,代码来源:savefilter.cpp


注:本文中的QuillImage::fullImageSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。