本文整理汇总了C++中KstPainter::makingMask方法的典型用法代码示例。如果您正苦于以下问题:C++ KstPainter::makingMask方法的具体用法?C++ KstPainter::makingMask怎么用?C++ KstPainter::makingMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstPainter
的用法示例。
在下文中一共展示了KstPainter::makingMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintSelf
void KstViewPicture::paintSelf(KstPainter& p, const QRegion& bounds) {
p.save();
if (p.type() != KstPainter::P_PRINT && p.type() != KstPainter::P_EXPORT) {
if (p.makingMask()) {
p.setRasterOp(Qt::OrROP);
} else {
const QRegion clip(clipRegion());
KstBorderedViewObject::paintSelf(p, bounds - _myClipMask);
p.setClipRegion(bounds & clip);
}
} else {
KstBorderedViewObject::paintSelf(p, bounds);
}
const QRect cr(contentsRectForDevice(p));
if (_image.isNull()) {
// fill with X
p.setBrush(QBrush(Qt::gray, Qt::SolidPattern));
p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
p.drawRect(cr);
p.drawLine(cr.topLeft(), cr.bottomRight());
p.drawLine(cr.topRight(), cr.bottomLeft());
} else {
assert(!cr.isNull()); // Null view objects are not allowed. I want to see
// how this happens so it can be fixed.
if (_iCache.isNull() || _iCache.size() != cr.size()) {
_iCache = _image.copy();
if (!_iCache.isNull()) {
_iCache = _iCache.smoothScale(cr.size());
}
}
if (!_iCache.isNull()) {
if (p.makingMask()) {
// which indicates clipping / BW mode
if (_iCache.hasAlphaBuffer()) {
p.drawImage(cr.topLeft(), _iCache.createAlphaMask());
} else {
p.setBrush(Qt::color1);
p.drawRect(cr);
}
} else {
p.drawImage(cr.topLeft(), _iCache);
}
}
}
p.restore();
}
示例2: paintSelf
void KstViewLabel::paintSelf(KstPainter& p, const QRegion& bounds) {
p.save();
if (p.type() == KstPainter::P_PRINT || p.type() == KstPainter::P_EXPORT) {
int absFontSizeOld = _absFontSize;
QRect cr(contentsRectForPainter(p));
cr.setSize(sizeForText(_parent->geometry()));
setContentsRectForPainter(p, cr);
KstBorderedViewObject::paintSelf(p, bounds);
p.translate(cr.left(), cr.top());
if (!_transparent) {
p.fillRect(0, 0, cr.width(), cr.height(), backgroundColor());
}
drawToPainter(_parsed, p);
_absFontSize = absFontSizeOld;
} else {
if (p.makingMask()) {
KstBorderedViewObject::paintSelf(p, bounds);
p.setRasterOp(Qt::SetROP);
const QRect cr(contentsRect());
// slow but preserves antialiasing...
QBitmap bm = _backBuffer.buffer().createHeuristicMask(false);
bm.setMask(bm);
p.drawPixmap(cr.left(), cr.top(), bm, 0, 0, cr.width(), cr.height());
} else {
const QRegion clip(clipRegion());
KstBorderedViewObject::paintSelf(p, bounds);
p.setClipRegion(bounds & clip);
_backBuffer.paintInto(p, contentsRect());
}
}
p.restore();
}