本文整理汇总了C++中QBitmap::setMask方法的典型用法代码示例。如果您正苦于以下问题:C++ QBitmap::setMask方法的具体用法?C++ QBitmap::setMask怎么用?C++ QBitmap::setMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QBitmap
的用法示例。
在下文中一共展示了QBitmap::setMask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListBoxLink
ListBoxDevice::ListBoxDevice(const QPixmap & pixmap, const QString & title, const QString & url, const QString & name, const QString & mountPoint, bool mounted, bool ejectable, bool removable, int id) : ListBoxLink(pixmap, title, url), name_(name), mountPoint_(mountPoint), mounted_(mounted), ejectable_(ejectable), removable_(removable),id_(id)
{
if (!eject.mask())
eject.setMask(eject);
if (!locked.mask())
locked.setMask(locked);
}
示例2: paintColorStop
void KarbonGradientWidget::paintColorStop(QPainter& p, int x, const QColor& color)
{
QBitmap bitmap = QBitmap::fromData(QSize(colorStop_width, colorStop_height), colorStop_bits);
bitmap.setMask(bitmap);
p.setPen(color);
p.drawPixmap(x - 4, 1, bitmap);
bitmap = QBitmap::fromData(QSize(colorStopBorder_width, colorStopBorder_height), colorStopBorder_bits);
bitmap.setMask(bitmap);
p.setPen(Qt::black);
p.drawPixmap(x - 5, 1, bitmap);
}
示例3: paintMidPoint
void KarbonGradientWidget::paintMidPoint(QPainter& p, int x)
{
QBitmap bitmap = QBitmap::fromData(QSize(midPoint_width, midPoint_height), midPoint_bits);
bitmap.setMask(bitmap);
p.setPen(Qt::black);
p.drawPixmap(x - 3, 1, bitmap);
}
示例4: 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();
}
示例5: pixmap
/*!
Returns a pixmap with size \a s and mode \a m, generating one if
needed. Generated pixmaps are cached.
*/
QPixmap QIconSet::pixmap( Size s, Mode m ) const
{
if ( !d ) {
QPixmap r;
return r;
}
QImage i;
QIconSetPrivate * p = ((QIconSet *)this)->d;
QPixmap * pm = 0;
if ( s == Large ) {
switch( m ) {
case Normal:
if ( !p->large.pm ) {
ASSERT( p->small.pm );
i = p->small.pm->convertToImage();
i = i.smoothScale( i.width() * 3 / 2, i.height() * 3 / 2 );
p->large.pm = new QPixmap;
p->large.generated = TRUE;
p->large.pm->convertFromImage( i );
if ( !p->large.pm->mask() ) {
i = i.createHeuristicMask();
QBitmap tmp;
tmp.convertFromImage( i, Qt::MonoOnly + Qt::ThresholdDither );
p->large.pm->setMask( tmp );
}
}
pm = p->large.pm;
break;
case Active:
if ( !p->largeActive.pm ) {
p->largeActive.pm = new QPixmap( pixmap( Large, Normal ) );
p->largeActive.generated = TRUE;
}
pm = p->largeActive.pm;
break;
case Disabled:
if ( !p->largeDisabled.pm ) {
#if defined(_WS_QWS_) && !defined(QT_NO_DEPTH_32)
p->largeDisabled.pm = newDisablePixmap(pixmap(Large,Normal));
#else
QBitmap tmp;
if ( p->large.generated && !p->smallDisabled.generated &&
p->smallDisabled.pm && !p->smallDisabled.pm->isNull() ) {
// if there's a hand-drawn disabled small image,
// but the normal big one is generated, use the
// hand-drawn one to generate this one.
i = p->smallDisabled.pm->convertToImage();
i = i.smoothScale( i.width() * 3 / 2, i.height() * 3 / 2 );
p->largeDisabled.pm = new QPixmap;
p->largeDisabled.pm->convertFromImage( i );
if ( !p->largeDisabled.pm->mask() ) {
i = i.createHeuristicMask();
tmp.convertFromImage( i, Qt::MonoOnly + Qt::ThresholdDither );
}
} else {
if (pixmap( Large, Normal).mask())
tmp = *pixmap( Large, Normal).mask();
else {
QPixmap conv = pixmap( Large, Normal );
if ( !conv.isNull() ) {
i = conv.convertToImage();
i = i.createHeuristicMask();
tmp.convertFromImage( i, Qt::MonoOnly + Qt::ThresholdDither );
}
}
p->largeDisabled.pm
= new QPixmap( p->large.pm->width()+1,
p->large.pm->height()+1);
QColorGroup dis( QApplication::palette().disabled() );
p->largeDisabled.pm->fill( dis.background() );
QPainter painter( p->largeDisabled.pm );
painter.setPen( dis.base() );
painter.drawPixmap( 1, 1, tmp );
painter.setPen( dis.foreground() );
painter.drawPixmap( 0, 0, tmp );
}
if ( !p->largeDisabled.pm->mask() ) {
if ( !tmp.mask() )
tmp.setMask( tmp );
QBitmap mask( d->largeDisabled.pm->size() );
mask.fill( Qt::color0 );
QPainter painter( &mask );
painter.drawPixmap( 0, 0, tmp );
painter.drawPixmap( 1, 1, tmp );
painter.end();
p->largeDisabled.pm->setMask( mask );
}
#endif
p->largeDisabled.generated = TRUE;
}
pm = p->largeDisabled.pm;
break;
}
} else {
switch( m ) {
//.........这里部分代码省略.........