Example #1
0
QRegion KstViewArrow::clipRegion() {
  if (_clipMask.isNull()) {
    _myClipMask = QRegion();
    QBitmap bm1(_geom.bottomRight().x(), _geom.bottomRight().y(), true);
    if (!bm1.isNull()) {
      KstPainter p;
      p.setMakingMask(true);
      p.begin(&bm1);
      p.setViewXForm(true);
      KstViewLine::paintSelf(p, QRegion());
      p.end();
      _clipMask = QRegion(bm1);
    }
    QBitmap bm2(_geom.bottomRight().x(), _geom.bottomRight().y(), true);
    if (!bm2.isNull()) {
      KstPainter p;
      p.setMakingMask(true);
      p.begin(&bm2);
      p.setViewXForm(true);
      paintSelf(p, QRegion());
      p.end();
      _myClipMask = QRegion(bm2);
    }
  }

  return _myClipMask | _clipMask;
}
Example #2
0
QRegion KstViewPicture::clipRegion() {
  if (_clipMask.isNull()) {
    _myClipMask = QRegion();
    QBitmap bm1(_geom.bottomRight().x() + 1, _geom.bottomRight().y() + 1, true);
    if (!bm1.isNull()) {
      KstPainter p;
      p.setMakingMask(true);
      p.begin(&bm1);
      p.setViewXForm(true);
      KstBorderedViewObject::paintSelf(p, QRegion());
      p.flush();
      p.end();
      _clipMask = QRegion(bm1);
    }
    QBitmap bm2(_geom.bottomRight().x() + 1, _geom.bottomRight().y() + 1, true);
    if (!bm2.isNull()) {
      KstPainter p;
      p.setMakingMask(true);
      p.begin(&bm2);
      p.setViewXForm(true);
      paintSelf(p, QRegion());
      p.flush();
      p.end();
      _myClipMask = QRegion(bm2);
    }
  }

  return _myClipMask | _clipMask;
}
Example #3
0
QRegion KstViewLegend::clipRegion() {
  if (!_transparent) {
    return KstBorderedViewObject::clipRegion();
  }

  if (_clipMask.isNull() && _myClipMask.isNull()) {
    const QRect cr(contentsRect());
    QBitmap bm = _backBuffer.buffer().createHeuristicMask(false); // slow but preserves antialiasing...
    _myClipMask = QRegion(bm);
    _myClipMask.translate(cr.topLeft().x(), cr.topLeft().y());

    QBitmap bm1(_geom.bottomRight().x() + 1, _geom.bottomRight().y() + 1, true);
    if (!bm1.isNull()) {
      KstPainter p;
      p.setMakingMask(true);
      p.begin(&bm1);
      p.setViewXForm(true);
      KstBorderedViewObject::paintSelf(p, QRegion());
      p.end();
      _clipMask = QRegion(bm1);
    }
  }

  return _clipMask | _myClipMask;
}