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


C++ QPixmap::xForm方法代码示例

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


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

示例1: insertSA

void ClsQSAList::insertSA(QPixmap qpm, string, vector <vector<double> > v, bool bReplace) {
//    cout << "ClsQSAList::insertSA(QPixmap qpm, string, vector <vector<double> > v)" << endl;
    double fFactor = (double)iListViewVisibleWidth / (double) qpm.width();
    
    QWMatrix m;
    m.scale(fFactor, fFactor );
    QPixmap pmS = qpm.xForm( m ); 

    ClsListBoxSA* clsListBoxSA = new ClsListBoxSA(qlbox, pmS);
    clsListBoxSA->setMatrix(v);


    if(bReplace){
	int iCurrent = qlbox->currentItem();
	if(iCurrent>=0) {
	    qlbox->removeItem(iCurrent);
	}
	qlbox->insertItem(clsListBoxSA, iCurrent);
    } else {
	qlbox->insertItem(clsListBoxSA);
    }

    qlbox->setCurrentItem(clsListBoxSA);
    qlbox->clearSelection ();
    qlbox->setSelected(clsListBoxSA, true);
}
开发者ID:jeez,项目名称:iqr,代码行数:26,代码来源:ClsQSAList.cpp

示例2: fastScalePixmap

QPixmap fastScalePixmap(const QPixmap &pixmap, int width, int height)
{
  QWMatrix m;
  m.scale(width/(double)pixmap.width(),
      height/(double)pixmap.height());
  return pixmap.xForm(m);
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例3: rotate

void rotate()
{
    int i;
    const int w = 64;
    const int h = 64;
    QImage image( w, h, 8, 128 );		// create image
    for ( i=0; i<128; i++ )			// build color table
	image.setColor( i, qRgb(i,0,0) );
    for ( int y=0; y<h; y++ ) {			// set image pixels
	uchar *p = image.scanLine(y);
	for ( int x=0; x<w; x++ )
	    *p++ = (x+y)%128;
    }

    QPixmap pm;
    pm = image;					// convert image to pixmap
    pm.optimize( TRUE );		// rotation will be faster

    QWidget *d = QApplication::desktop();	// w = desktop widget

    for ( i=0; i<=360; i += 2 ) {
	QWMatrix m;
	m.rotate( i );				// rotate coordinate system
	QPixmap rpm = pm.xForm( m );		// rpm = rotated pixmap
	d->setBackgroundPixmap( rpm );		// set desktop pixmap
	d->update();				// repaint desktop
    }
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:28,代码来源:desktop.cpp

示例4: loadLevel

void StartRoom::loadLevel(int level)
{
	if(level < 1 || level > leV->max())
		return;

	QPixmap pixmap = leV->getPixmap(level);
	QWMatrix m;
	m.scale( (double)7, (double)7 );
	pixmap = pixmap.xForm( m );
	picture->setPixmap(pixmap);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例5: MyPaint

void MyPaint(NBioBSPRollDemo_Widget* pWidget)
{
   QPixmap Spm;
   Spm = pWidget->m_RollImage;
   Spm.setOptimization(QPixmap::BestOptim);
   
   QWMatrix Sm;
   Sm.scale((double)IMAGE_FRAME_WIDTH/(double)pWidget->m_DeviceInfo0.ImageWidth,
      (double)IMAGE_FRAME_HEIGHT/(double)pWidget->m_DeviceInfo0.ImageHeight);
   
   QPixmap Srpm = Spm.xForm(Sm);
        
   bitBlt(pWidget->m_frmRoll, 0, 0, &Srpm);
}
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:14,代码来源:NBioBSPRollDemo.cpp

示例6: displayAlbumArt

void AudioBrowserScreen::displayAlbumArt(const QString& key) {
    QPixmap image = dbHandler->loadAlbumArt(key);
    if (image.isNull()) {
        cover->hide();
    }
    else {
        double scalew = cover->width()/(double)image.width();
        double scaleh = cover->height()/(double)image.height();
        QWMatrix m;
        m.scale(scalew,scaleh);
        QPixmap scaled = image.xForm(m);
        cover->setPixmap(scaled);
        cover->show();
    }
}
开发者ID:vpulim,项目名称:headunit,代码行数:15,代码来源:AudioBrowserScreen.cpp

示例7: drawScreen

void QVFbView::drawScreen()
{
    QPainter p( viewport() );

    p.translate( -contentsX(), -contentsY() );

    lock();
    QRect r( hdr->update );
    hdr->dirty = FALSE;
    hdr->update = QRect();
    // qDebug( "update %d, %d, %dx%d", r.y(), r.x(), r.width(), r.height() );
    r = r.intersect( QRect(0, 0, hdr->width, hdr->height ) );
    if ( !r.isEmpty() )  {
	if ( int(zm) != zm ) {
	    r.rLeft() = int(int(r.left()*zm)/zm);
	    r.rTop() = int(int(r.top()*zm)/zm);
	    r.rRight() = int(int(r.right()*zm+zm+0.0000001)/zm+1.9999);
	    r.rBottom() = int(int(r.bottom()*zm+zm+0.0000001)/zm+1.9999);
	    r.rRight() = QMIN(r.right(),hdr->width-1);
	    r.rBottom() = QMIN(r.bottom(),hdr->height-1);
	}
	int leading;
	QImage img( getBuffer( r, leading ) );
	QPixmap pm;
	if ( zm == 1 ) {
	    pm.convertFromImage( img );
	} else if ( int(zm) == zm ) {
	    QWMatrix m;
	    m.scale(zm,zm);
	    pm.convertFromImage( img );
	    pm = pm.xForm(m);
	} else {
	    pm.convertFromImage( img.smoothScale(int(img.width()*zm),int(img.height()*zm)) );
	}
	unlock();
	p.setPen( black );
	p.setBrush( white );
	p.drawPixmap( int(r.x()*zm), int(r.y()*zm), pm,
			int(leading*zm), 0, pm.width(), pm.height() );
    } else {
	unlock();
    }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:43,代码来源:qvfbview.cpp

示例8: QVBoxLayout

LapsusPanelDefault::LapsusPanelDefault(Qt::Orientation orientation,
			QWidget *parent):
		LapsusPanelWidget(orientation, parent, 0), _label(0)
{
	if ( orientation == Qt::Horizontal )
		_layout = new QVBoxLayout( this );
	else
		_layout = new QHBoxLayout( this );

	_layout->addStretch();

	_label = new QLabel(this);
	_label->setBackgroundMode(X11ParentRelative);

	QPixmap pic = UserIcon("laptop");

	if (!pic.isNull() )
	{
		// scale icon
		QWMatrix t;
		t = t.scale( 20.0/pic.width(), 20.0/pic.height() );
		pic = pic.xForm( t );

		_label->setPixmap( pic );
		_label->resize( 20, 20 );
	}
	else
	{
		// Desperate fallback... ;)
		_label->setText("Lapsus\nApplet");
	}

	_layout->add(_label);
	_layout->addStretch();

	_label->show();

	QToolTip::add( _label, "Lapsus Panel Applet" );

	_label->show();
}
开发者ID:BackupTheBerlios,项目名称:lapsus-svn,代码行数:41,代码来源:panel_default.cpp

示例9: loadInternal

QPixmap KIconLoader::loadInternal ( const QString &name, int w,  int h ){

  QPixmap *pix;
  KPixmap new_xpm;

  int index;

  if ( (index = name_list.find(name)) < 0){
    
    pix = new QPixmap;
    new_xpm.load( getIconPath(name), 0L, KPixmap::LowColor );
    *pix = new_xpm;
    
    if( !(pix->isNull()) ){
      
      name_list.append(name);
      pixmap_list.append(pix);

    } 
    else {
      delete pix;
      return new_xpm;
    }
  }
  else{
    pix = pixmap_list.at(index);
  }
  

  if (pix && !pix->isNull() && w > 0 && h > 0 &&  
      (pix->width() > w || pix->height() > h)){

    QWMatrix m;
    m.scale(w/(float)pix->width(), h/(float)pix->height());

    return pix->xForm(m);

  }

  return *pix;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:41,代码来源:kiconloader.cpp

示例10: setData

/** No descriptions */
void PreviewUpdateWidget::setData(QByteArray & data)
{
  double f1,f2;
  int h,j,i;
  QPixmap pix;
  QBuffer b(&data);
  b.open( QIODevice::ReadOnly );
  QImageReader io( &b,0);
  QImage *image = qis_read_pbm_image(&io);
  if(!image)
  {
    b.close();
    return;
  }
  b.close();
  pix.convertFromImage(*image);
  delete image;
  h = pix.height();
  if(!mPixmap.isNull())
  {
    f1 = double(width())/double(mRealWidth);
    f2 = double(height())/double(mRealHeight);
    if(f1 < f2)
      f2 = f1;
    else if(f2 < f1)
      f1 = f2;
    if(f1 > 1.0) f1 = 1.0/f1;
    if(f2 > 1.0) f2 = 1.0/f2;
    QMatrix m;
    m.scale(f1,f2);
    pix = pix.xForm(m);
    m.map(i,h,&i,&j);
    bitBlt(&mPixmap,0,mBegin,&pix,0,0);
    QRect r(0,mBegin,mPixmap.width(),j);
    QPaintEvent e( r);
    QApplication::sendEvent( this, &e );
    m.map(h,0,&i,&j);
    mBegin += i;
  }
}
开发者ID:arunjalota,项目名称:paperman,代码行数:41,代码来源:previewupdatewidget.cpp

示例11: setIcon

void KMultiTabBarTab::setIcon(const QPixmap& icon)
{

	if ((m_position==KMultiTabBar::Left) || (m_position==KMultiTabBar::Right)) {
	        QWMatrix rotateMatrix;
		if (m_position==KMultiTabBar::Left)
	        	rotateMatrix.rotate(90);
		else
			rotateMatrix.rotate(-90);
		QPixmap pic=icon.xForm(rotateMatrix);
#if 0
        	if(m_position==KMultiTabBar::Left) {
			QWMatrix flipMatrix;
	                flipMatrix.setMatrix(1.0F, 0.0F, 0.0F, -1.0F, 0.0F, 0.0F);
			pic=pic.xForm(flipMatrix);
	        }
#endif
		d->pix=pic;
	        setIconSet(pic);
	} else setIconSet(icon);

}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:22,代码来源:kmultitabbar.cpp

示例12: doShape

void KWMThemeClient::doShape()
{

    QBitmap shapemask(width(), height());
    shapemask.fill(color0);
    QPainter p;
    p.begin(&shapemask);
    p.setBrush(color1);
    p.setPen(color1);
    int x,y;
    // first the corners
    int w1 = framePixmaps[FrameTopLeft]->width();
    int h1 = framePixmaps[FrameTopLeft]->height();
    if (w1 > width()/2) w1 = width()/2;
    if (h1 > height()/2) h1 = height()/2;
    if (framePixmaps[FrameTopLeft]->mask())
        p.drawPixmap(0,0,*framePixmaps[FrameTopLeft]->mask(),
		     0,0,w1, h1);
    else
        p.fillRect(0,0,w1,h1,color1);
    int w2 = framePixmaps[FrameTopRight]->width();
    int h2 = framePixmaps[FrameTopRight]->height();
    if (w2 > width()/2) w2 = width()/2;
    if (h2 > height()/2) h2 = height()/2;
    if (framePixmaps[FrameTopRight]->mask())
        p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight]->mask(),
		     framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);
    else
        p.fillRect(width()-w2,0,w2, h2,color1);

    int w3 = framePixmaps[FrameBottomLeft]->width();
    int h3 = framePixmaps[FrameBottomLeft]->height();
    if (w3 > width()/2) w3 = width()/2;
    if (h3 > height()/2) h3 = height()/2;
    if (framePixmaps[FrameBottomLeft]->mask())
        p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft]->mask(),
		     0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);
    else
        p.fillRect(0,height()-h3,w3,h3,color1);

    int w4 = framePixmaps[FrameBottomRight]->width();
    int h4 = framePixmaps[FrameBottomRight]->height();
    if (w4 > width()/2) w4 = width()/2;
    if (h4 > height()/2) h4 = height()/2;
    if (framePixmaps[FrameBottomRight]->mask())
        p.drawPixmap(width()-w4,height()-h4,*framePixmaps[FrameBottomRight]->mask(),
		     framePixmaps[FrameBottomRight]->width()-w4,
		     framePixmaps[FrameBottomRight]->height()-h4,
		     w4, h4);
    else
        p.fillRect(width()-w4,height()-h4,w4,h4,color1);

    QPixmap pm;
    QWMatrix m;
    int n,s,w;
    //top
    if (framePixmaps[FrameTop]->mask())
    {
        pm = *framePixmaps[FrameTop]->mask();

        s = width()-w2-w1;
        n = s/pm.width();
        w = n>0?s/n:s;
        m.reset();
        m.scale(w/(float)pm.width(), 1);
        pm = pm.xForm(m);

        x = w1;
        while (1){
            if (pm.width() < width()-w2-x){
                p.drawPixmap(x,maxExtent-pm.height()-1,
		             pm);
	        x += pm.width();
            }
            else {
	        p.drawPixmap(x,maxExtent-pm.height()-1,
		             pm,
		             0,0,width()-w2-x,pm.height());
	        break;
            }
        }
    }

    //bottom
    if (framePixmaps[FrameBottom]->mask())
    {
        pm = *framePixmaps[FrameBottom]->mask();

        s = width()-w4-w3;
        n = s/pm.width();
        w = n>0?s/n:s;
        m.reset();
        m.scale(w/(float)pm.width(), 1);
        pm = pm.xForm(m);

        x = w3;
        while (1){
          if (pm.width() < width()-w4-x){
	    p.drawPixmap(x,height()-maxExtent+1,pm);
	    x += pm.width();
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例13: paintEvent

void KWMThemeClient::paintEvent( QPaintEvent *)
{
    QPainter p;
    p.begin(widget());
    int x,y;
    // first the corners
    int w1 = framePixmaps[FrameTopLeft]->width();
    int h1 = framePixmaps[FrameTopLeft]->height();
    if (w1 > width()/2) w1 = width()/2;
    if (h1 > height()/2) h1 = height()/2;
    p.drawPixmap(0,0,*framePixmaps[FrameTopLeft],
		 0,0,w1, h1);
    int w2 = framePixmaps[FrameTopRight]->width();
    int h2 = framePixmaps[FrameTopRight]->height();
    if (w2 > width()/2) w2 = width()/2;
    if (h2 > height()/2) h2 = height()/2;
    p.drawPixmap(width()-w2,0,*framePixmaps[FrameTopRight],
		 framePixmaps[FrameTopRight]->width()-w2,0,w2, h2);

    int w3 = framePixmaps[FrameBottomLeft]->width();
    int h3 = framePixmaps[FrameBottomLeft]->height();
    if (w3 > width()/2) w3 = width()/2;
    if (h3 > height()/2) h3 = height()/2;
    p.drawPixmap(0,height()-h3,*framePixmaps[FrameBottomLeft],
		 0,framePixmaps[FrameBottomLeft]->height()-h3,w3, h3);

    int w4 = framePixmaps[FrameBottomRight]->width();
    int h4 = framePixmaps[FrameBottomRight]->height();
    if (w4 > width()/2) w4 = width()/2;
    if (h4 > height()/2) h4 = height()/2;
    p.drawPixmap(width()-w4,height()-h4,*(framePixmaps[FrameBottomRight]),
		 framePixmaps[FrameBottomRight]->width()-w4,
		 framePixmaps[FrameBottomRight]->height()-h4,
		 w4, h4);

    QPixmap pm;
    QWMatrix m;
    int n,s,w;
    //top
    pm = *framePixmaps[FrameTop];

    if (pm.width() > 0){
    s = width()-w2-w1;
    n = s/pm.width();
    w = n>0?s/n:s;
    m.reset();
    m.scale(w/(float)pm.width(), 1);
    pm = pm.xForm(m);

    x = w1;
    while (1){
      if (pm.width() < width()-w2-x){
	p.drawPixmap(x,maxExtent-pm.height()-1,
		     pm);
	x += pm.width();
      }
      else {
	p.drawPixmap(x,maxExtent-pm.height()-1,
		     pm,
		     0,0,width()-w2-x,pm.height());
	break;
      }
    }
    }

    //bottom
    pm = *framePixmaps[FrameBottom];

    if (pm.width() > 0){
    s = width()-w4-w3;
    n = s/pm.width();
    w = n>0?s/n:s;
    m.reset();
    m.scale(w/(float)pm.width(), 1);
    pm = pm.xForm(m);

    x = w3;
    while (1){
      if (pm.width() < width()-w4-x){
	p.drawPixmap(x,height()-maxExtent+1,pm);
	x += pm.width();
      }
      else {
	p.drawPixmap(x,height()-maxExtent+1,pm,
		     0,0,width()-w4-x,pm.height());
	break;
      }
    }
    }

    //left
    pm = *framePixmaps[FrameLeft];

    if (pm.height() > 0){
    s = height()-h3-h1;
    n = s/pm.height();
    w = n>0?s/n:s;
    m.reset();
    m.scale(1, w/(float)pm.height());
    pm = pm.xForm(m);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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