本文整理汇总了C++中DImg::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::copy方法的具体用法?C++ DImg::copy怎么用?C++ DImg::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getThumbnailForEffect
DImg BWSepiaFilter::getThumbnailForEffect(DImg& img)
{
postProgress(10);
DImg thumb = img.copy();
postProgress(25);
if (d->settings.previewType < BWSepiaContainer::BWGeneric)
{
// In Filter view, we will render a preview of the B&W filter with the generic B&W film.
blackAndWhiteConversion(thumb, d->settings.previewType);
postProgress(50);
blackAndWhiteConversion(thumb, BWSepiaContainer::BWGeneric);
postProgress(75);
}
else
{
// In Film and Tone view, we will render the preview without to use the B&W Filter.
postProgress(50);
blackAndWhiteConversion(thumb, d->settings.previewType);
postProgress(75);
}
postProgress(90);
return (thumb);
}
示例2: cacheLookup
DImg SharedLoadSaveThread::cacheLookup(const QString& filePath, AccessMode /*accessMode*/)
{
LoadingCache* cache = LoadingCache::cache();
LoadingCache::CacheLock lock(cache);
DImg* cachedImg = cache->retrieveImage(filePath);
// Qt4: uncomment this code.
// See comments in SharedLoadingTask::execute for explanation.
/*
if (cachedImg)
{
if (accessMode == AccessModeReadWrite)
return cachedImg->copy();
else
return *cachedImg;
}
else
return DImg();
*/
if (cachedImg)
{
return cachedImg->copy();
}
else
{
return DImg();
}
}
示例3: setPreviewImage
void WhiteBalanceTool::setPreviewImage()
{
DImg preview = filter()->getTargetImage();
d->previewWidget->setPreviewImage(preview);
// Update histogram.
d->gboxSettings->histogramBox()->histogram()->updateData(preview.copy(), DImg(), false);
}
示例4: composeImage
//.........这里部分代码省略.........
intersects(QRect(0, 0, maxWidth, maxHeight)) )
{
// emergency fallback - nothing is visible
x = qMax( (maxWidth - boxWidth) / 2, 0);
y = qMax( (maxHeight - boxHeight) / 2, 0);
}
// invalidate position hint, use only once
d->positionHint = QRect();
}
else
{
// use standard position
x = qMax( (maxWidth - boxWidth) / 2, 0);
y = qMax( (maxHeight - boxHeight) / 2, 0);
}
}
// create a rectangle relative to image
QRect drawRect( x, y, fontWidth + 2 * borderWidth + 2 * spacing, fontHeight + 2 * borderWidth + 2 * spacing);
// create a rectangle relative to textArea, excluding the border
QRect textAreaBackgroundRect( borderWidth, borderWidth, fontWidth + 2 * spacing, fontHeight + 2 * spacing);
// create a rectangle relative to textArea, excluding the border and spacing
QRect textAreaTextRect( borderWidth + spacing, borderWidth + spacing, fontWidth, fontHeight );
// create a rectangle relative to textArea, including the border,
// for drawing the rectangle, taking into account that the width of the QPen goes in and out in equal parts
QRect textAreaDrawRect( borderWidth / 2, borderWidth / 2, fontWidth + borderWidth + 2 * spacing,
fontHeight + borderWidth + 2 * spacing );
// cut out the text area
DImg textArea = image->copy(drawRect);
if (textArea.isNull())
{
return QRect();
}
// compose semi-transparent background over textArea
DColorComposer* composer = DColorComposer::getComposer(DColorComposer::PorterDuffNone);
if (transparentBackground)
{
DImg transparentLayer(textAreaBackgroundRect.width(), textAreaBackgroundRect.height(), textArea.sixteenBit(), true);
DColor transparent(backgroundColor);
transparent.setAlpha(d->transparency);
if (image->sixteenBit())
{
transparent.convertToSixteenBit();
}
transparentLayer.fill(transparent);
textArea.bitBlendImage(composer, &transparentLayer, 0, 0, transparentLayer.width(), transparentLayer.height(),
textAreaBackgroundRect.x(), textAreaBackgroundRect.y());
}
DImg textNotDrawn;
if (textArea.sixteenBit())
{
textNotDrawn = textArea.copy();
textNotDrawn.convertToEightBit();
}