本文整理汇总了C++中DImg::bitBlendImage方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::bitBlendImage方法的具体用法?C++ DImg::bitBlendImage怎么用?C++ DImg::bitBlendImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::bitBlendImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例2: composeImage
//.........这里部分代码省略.........
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();
}
else
{
textNotDrawn = textArea;
}
// We have no direct pixel access to font rendering, so now we need to use Qt/X11 for the drawing
// convert text area to pixmap
QPixmap pixmap;
if (destPainter)
{
// We working on tool preview, deal with CM as well
pixmap = d->iface->convertToPixmap(textNotDrawn);
}
else
{
// We working on target image. Do no apply double CM adjustment here.
pixmap = textNotDrawn.convertToPixmap();
}
int fontScaleWidth = qRound(fontWidth / fontScale);