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


C++ DImg::size方法代码示例

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


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

示例1: preparePreview

void LensAutoFixTool::preparePreview()
{
    // Settings information must be get before to disable settings view.
    LensFunContainer settings = d->cameraSelector->settings();
    d->settingsView->assignFilterSettings(settings);
    ImageIface* const iface   = d->previewWidget->imageIface();
    DImg preview              = iface->preview();

    if (d->showGrid->isChecked())
    {
        QBitmap pattern(9, 9);
        pattern.clear();
        QPainter p1(&pattern);
        p1.setPen(QPen(Qt::black, 1));
        p1.drawLine(5, 0, 5, 9);
        p1.drawLine(0, 5, 9, 5);
        p1.end();

        QPixmap pix(preview.size());
        pix.fill(Qt::transparent);
        QPainter p2(&pix);
        p2.setPen(QPen(Qt::gray, 1));
        p2.fillRect(0, 0, pix.width(), pix.height(), QBrush(pattern));
        p2.end();
        DImg grid(pix.toImage());

        DColorComposer* const composer            = DColorComposer::getComposer(DColorComposer::PorterDuffNone);
        DColorComposer::MultiplicationFlags flags = DColorComposer::NoMultiplication;

        // Do alpha blending of template on dest image
        preview.bitBlendImage(composer, &grid, 0, 0, preview.width(), preview.height(), 0, 0, flags);
    }

    setFilter(new LensFunFilter(&preview, this, settings));
}
开发者ID:KDE,项目名称:digikam,代码行数:35,代码来源:lensautofixtool.cpp

示例2: testActions

void DImageFilterActionTest::testActions()
{
    QStringList files = QDir(imagePath()).entryList(QDir::Files);
    files.removeOne(originalImage());

    DImg original(imagePath() + originalImage());
    QVERIFY(!original.isNull());

    foreach (const QString& fileName, files)
    {
        DImg ref(imagePath() + fileName);
        QVERIFY(!ref.isNull());
        DImageHistory history = ref.getImageHistory();

        FilterActionFilter filter;
        filter.setFilterActions(history.allActions());
        QVERIFY(filter.isReproducible() || filter.isComplexAction());

        filter.setupFilter(original.copy());
        filter.startFilterDirectly();
        qDebug() << filter.filterActions().size();

        DImg img = filter.getTargetImage();

        QVERIFY(ref.size() == img.size());

        bool isEqual = true;
        DImg diff(ref.width(), ref.height(), ref.sixteenBit());
        diff.fill(DColor(Qt::black));

        for (uint x=0; x<ref.width(); x++)
        {
            for (uint y=0; y<ref.height(); y++)
            {
                DColor cref = ref.getPixelColor(x,y);
                DColor cres = img.getPixelColor(x,y);

                if (cref.red() != cres.red() || cref.green() != cres.green() || cref.blue() != cres.blue())
                {
                    //qDebug() << x << y;
                    diff.setPixelColor(x,y, DColor(Qt::white));
                    isEqual = false;
                }
            }
        }

        if (!isEqual)
        {
            showDiff(original, ref, img, diff);
        }

        QVERIFY(isEqual);
    }
开发者ID:UIKit0,项目名称:digikam,代码行数:53,代码来源:dimagefilteractiontest.cpp

示例3: setSelection

void ImageIface::setSelection(const QString& caller, const FilterAction& action, const DImg& img)
{
    if (img.hasAlpha()   != originalHasAlpha()     ||
        img.sixteenBit() != originalSixteenBit()   ||
        img.size()       != selectionRect().size()
       )
    {
        kDebug() << "Properties of image to overwrite selection differs than original image";
        return;
    }

    if (img.isNull())
    {
        kDebug() << "No image data to handle";
        return;
    }

    d->core->putImgSelection(caller, action, img);
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:19,代码来源:imageiface.cpp

示例4: setImage

void PanIconWidget::setImage(int previewWidth, int previewHeight, const DImg& image)
{
    DImg img = DImg(image).smoothScale(previewWidth, previewHeight, Qt::KeepAspectRatio);
    setImage(img.copyQImage(), image.size());
}
开发者ID:rosedu,项目名称:digikam,代码行数:5,代码来源:paniconwidget.cpp


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