当前位置: 首页>>代码示例>>C++>>正文


C++ QPainter::isActive方法代码示例

本文整理汇总了C++中QPainter::isActive方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainter::isActive方法的具体用法?C++ QPainter::isActive怎么用?C++ QPainter::isActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPainter的用法示例。


在下文中一共展示了QPainter::isActive方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: end

bool FLPicturePrivate::end() {
  if ( ownerPte && pte->isActive() )
    return pte->end();
  else
    if ( !ownerPte && pte->isActive() && endPte )
      return pte->end();
  return false;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:8,代码来源:FLPicture.cpp

示例2: platformTransformColorSpace

void ImageBufferDataPrivateUnaccelerated::platformTransformColorSpace(const Vector<int>& lookUpTable)
{
    QPainter* painter = paintDevice()->paintEngine()->painter();

    bool isPainting = painter->isActive();
    if (isPainting)
        painter->end();

    QImage image = toQImage().convertToFormat(QImage::Format_ARGB32);
    ASSERT(!image.isNull());

    uchar* bits = image.bits();
    const int bytesPerLine = image.bytesPerLine();

    for (int y = 0; y < m_pixmap.height(); ++y) {
        quint32* scanLine = reinterpret_cast_ptr<quint32*>(bits + y * bytesPerLine);
        for (int x = 0; x < m_pixmap.width(); ++x) {
            QRgb& pixel = scanLine[x];
            pixel = qRgba(lookUpTable[qRed(pixel)],
                          lookUpTable[qGreen(pixel)],
                          lookUpTable[qBlue(pixel)],
                          qAlpha(pixel));
        }
    }

    m_pixmap = QPixmap::fromImage(image);

    if (isPainting)
        painter->begin(&m_pixmap);
}
开发者ID:Metrological,项目名称:qtwebkit,代码行数:30,代码来源:ImageBufferQt.cpp

示例3: paintEvent

void Canvas::paintEvent(QPaintEvent *e)
{
    QPainter *p = new QPainter(this);
    QPen pen(QColor(0,0,0,255));

    if(p->isActive()){
        p->setRenderHint(QPainter::Antialiasing);
        pen.setWidth(1);
        p->setPen(pen);

        p->save();
        pen.setColor(QColor(255,0,0,255));
        p->setPen(pen);

        foreach(QPainterPath t, _ticks)
            p->drawPath(t);

        p->restore();

        p->drawEllipse(PADDING,PADDING,_radiusX*2,_radiusY*2);
        p->end();
    }

    QFrame::paintEvent(e);
}
开发者ID:ghetzel,项目名称:zee,代码行数:25,代码来源:dial.cpp

示例4: paintEvent

void Canvas::paintEvent(QPaintEvent *e)
{
    QPainter *p = new QPainter(this);
    QPen pen(QColor(0,0,0,255));
    qreal curangle = 0.0;

    if(p->isActive()){
        p->setRenderHint(QPainter::Antialiasing);
        pen.setWidth(1);
        p->setPen(pen);

        p->save();
        pen.setColor(QColor(255,0,0,255));
        p->setPen(pen);

        foreach(qreal v, _values){
		qreal span = (5760.0 / _valueSum) * v;

		cout << "Value: " << v << " (sum="<<_valueSum<<") , span = " << span << "/5760, curangle = " << curangle;

		p->drawPie(rect(), curangle, span);
		curangle += span;

		cout << ", newangle = " << curangle << endl;
	}
开发者ID:ghetzel,项目名称:zee,代码行数:25,代码来源:canvas.cpp

示例5: setPainter

void FLPicturePrivate::setPainter( QPainter * pt ) {
  if ( pic && pt ) {
    if ( pte ) {
      end();
      if ( ownerPte )
        delete pte;
    }
    pte = pt;
    ownerPte = false;
    endPte = !pte->isActive();
  }
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:12,代码来源:FLPicture.cpp

示例6: resizeEvent

void SVGFrame::resizeEvent ( QResizeEvent* event )
{
	QFrame::resizeEvent ( event );
	emit resized ( event->size() );
	if ( drawImg && event->size().width() >0 && event->size().height() >0 &&!empty )
	{
		QPalette pal=palette();
		QImage img ( event->size(),QImage::Format_ARGB32_Premultiplied );
		QPainter p ( &img );
		if ( p.isActive() )
			renderer->render ( &p );
		pal.setBrush ( QPalette::Window,QBrush ( QPixmap::fromImage ( img ) ) );
		setPalette ( pal );
	}
}
开发者ID:obalci,项目名称:x2goclient,代码行数:15,代码来源:SVGFrame.cpp

示例7: qp

// Note : should be called with lock held
static inline bool maskPainter(int qtGraphDesc, QPainter &p)
{
	bool r = false;

	QColor c;
	
	switch (QtGraphDescPool[qtGraphDesc].blendmode) {
    case java_awt_AlphaComposite_SRC_OVER:
        if((QtGraphDescPool[qtGraphDesc].currentalpha & 0x80) != 0) {
            c = Qt::color1;
            r = true;
        }
        break;
			
    case java_awt_AlphaComposite_SRC:
        c = (QtGraphDescPool[qtGraphDesc].currentalpha & 0x80) ? 
            Qt::color1 : Qt::color0;
        r = true;
        break;
			
    case java_awt_AlphaComposite_CLEAR:
        c = Qt::color0;
        r = true;
        break;
			
    default:
        r = false;
	}
	
	if(r)
	{
		QPen qp(p.pen());
		QBrush qb(p.brush());
		qp.setColor(c);
		qb.setColor(c);
		
		if(p.isActive()) p.end();
		p.begin((QPaintDevice *)(QtImageDescPool[QtGraphDescPool[qtGraphDesc].qid].mask));			
		
		p.setPen(qp);
		p.setBrush(qb);
		
        setPainterClip(&p, qtGraphDesc) ;
	}
	
	return r;
}
开发者ID:AllBinary,项目名称:phoneme-components-cdc,代码行数:48,代码来源:QtGraphics.cpp

示例8: paintEvent

void NLabel::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);

    QPainter painter;
    QRect rect = contentsRect();

    if (painter.isActive())
        painter.setFont(font());

    if (m_enabled && m_shadowOffset != QPoint(0, 0)) {
        painter.begin(this);
        painter.setPen(QPen(m_shadowColor));
        painter.drawText(rect.translated(m_shadowOffset), alignment(), m_elidedText);
        painter.end();
    }

    painter.begin(this);
    painter.drawText(rect, alignment(), m_elidedText);
    painter.end();
}
开发者ID:nulloy,项目名称:nulloy,代码行数:21,代码来源:label.cpp

示例9: paintEvent

void OscilloscopeView::paintEvent( QPaintEvent *e)
{
	QRect r = e->rect();
	
	if(b_needRedraw)
	{
		updateOutputHeight();
		const double pixelsPerSecond = Oscilloscope::self()->pixelsPerSecond();
		
        if (!m_pixmap) {
            qWarning() << Q_FUNC_INFO << " unexpected null m_pixmap in " << this;
            return;
        }

		QPainter p;
		//m_pixmap->fill( paletteBackgroundColor());
        m_pixmap->fill( palette().color( backgroundRole() ));
		const bool startSuccess = p.begin(m_pixmap);
        if ((!startSuccess) || (!p.isActive())) {
            qWarning() << Q_FUNC_INFO << " painter is not active";
        }

		p.setClipRegion(e->region());
		
		//BEGIN Draw vertical marker lines
		const double divisions = 5.0;
		const double min_sep = 10.0;
		
		double spacing = pixelsPerSecond/(std::pow( divisions, std::floor(std::log(pixelsPerSecond/min_sep)/std::log(divisions))));
		
		// Pixels offset is the number of pixels that the view is scrolled along
		const int64_t pixelsOffset = int64_t(Oscilloscope::self()->scrollTime()*pixelsPerSecond/LOGIC_UPDATE_RATE);
		double linesOffset = - lld_modulus( pixelsOffset, spacing);
		
		int blackness = 256 - int(184.0 * spacing / (min_sep*divisions*divisions));
		p.setPen( QColor( blackness, blackness, blackness));
		
		for( double i = linesOffset; i <= frameRect().width(); i += spacing)
			p.drawLine( int(i), 1, int(i), frameRect().height()-2);
		
		
		
		spacing *= divisions;
		linesOffset = - lld_modulus( pixelsOffset, spacing);
		
		blackness = 256 - int(184.0 * spacing / (min_sep*divisions*divisions));
		p.setPen( QColor( blackness, blackness, blackness));
		
		for( double i = linesOffset; i <= frameRect().width(); i += spacing)
			p.drawLine( int(i), 1, int(i), frameRect().height()-2);
		
		
		
		spacing *= divisions;
		linesOffset = - lld_modulus( pixelsOffset, spacing);
		
		blackness = 256 - int(184.0);
		p.setPen( QColor( blackness, blackness, blackness));
		
		for( double i = linesOffset; i <= frameRect().width(); i += spacing)
			p.drawLine( int(i), 1, int(i), frameRect().height()-2);
		//END Draw vertical marker lines
		
		drawLogicData(p);
		drawFloatingData(p);
		
		p.setPen(Qt::black);
		p.drawRect( frameRect());
		
		b_needRedraw = false;
	}
	
	//bitBlt( this, r.x(), r.y(), m_pixmap, r.x(), r.y(), r.width(), r.height()); // 2018.12.07
	QPainter p;
    const bool paintStarted = p.begin(this);
    if (!paintStarted) {
        qWarning() << Q_FUNC_INFO << " failed to start painting ";
    }
    p.drawImage(r, m_pixmap->toImage(), r);

}
开发者ID:ktechlab,项目名称:ktechlab,代码行数:81,代码来源:oscilloscopeview.cpp

示例10: begin

bool FLPicturePrivate::begin() {
  if ( !pte->isActive() )
    return pte->begin( pic );
  return false;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:5,代码来源:FLPicture.cpp

示例11: GetThumbnail

STDMETHODIMP CThumbnailProvider::GetThumbnail(UINT cx, 
                                              HBITMAP *phbmp, 
                                              WTS_ALPHATYPE *pdwAlpha)
{
	*phbmp = NULL; 
    *pdwAlpha = WTSAT_ARGB;

    int width, height;
    QSize size = renderer.defaultSize();

    if(size.width() == size.height()){
        width = cx;
        height = cx;
    } else if (size.width() > size.height()){
        width = cx;
        height = size.height() * ((double)cx / (double)size.width());
    } else {
        width = size.width() * ((double)cx / (double)size.height());
        height = cx;
    }

    QFile * f = new QFile("C:\\dev\\svg.log");
    f->open(QFile::Append);
    f->write(QString("Size: %1 \n.").arg(cx).toAscii());
    f->flush();
    f->close();

    QImage * device = new QImage(width, height, QImage::Format_ARGB32);
    device->fill(Qt::transparent);
    QPainter * painter = new QPainter();
    QFont font;
    QColor color_font = QColor(255, 0, 0);

    painter->begin(device);
    painter->setRenderHints(QPainter::Antialiasing |
                            QPainter::SmoothPixmapTransform |
                            QPainter::TextAntialiasing);
    assert(device->paintingActive() && painter->isActive());
    if(loaded){
        renderer.render(painter);
    } else {
        int font_size = cx / 10;

        font.setStyleHint(QFont::Monospace);
        font.setPixelSize(font_size);

        painter->setPen(color_font);
        painter->setFont(font);
        painter->drawText(font_size, (cx - font_size) / 2, "Invalid SVG file.");
    }
    painter->end();

    assert(!device->isNull());
#ifndef NDEBUG
    device->save(QString("C:\\dev\\%1.png").arg(QDateTime::currentMSecsSinceEpoch()), "PNG");
#endif
    *phbmp = QPixmap::fromImage(*device).toWinHBITMAP(QPixmap::Alpha);
    assert(*phbmp != NULL);

    delete painter;
    delete device;

	if( *phbmp != NULL )
		return NOERROR;
	return E_NOTIMPL;

}
开发者ID:dewingkids,项目名称:svg-explorer-extension,代码行数:67,代码来源:ThumbnailProvider.cpp


注:本文中的QPainter::isActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。