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


C++ QWMatrix::scale方法代码示例

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


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

示例1: loadTiles

bool Board::loadTiles(float scale) {
  int i, j, x, y;

  // delete old tiles
  for(i = 0; i < 45; i++)
    if(pm_tile[i] != 0) {
      delete pm_tile[i];
      pm_tile[i] = 0;
    }

  QPixmap pm((PICDIR + "/kshisen.xpm").data());
  if(pm.width() == 0 || pm.height() == 0) {
    KMsgBox::message(0, klocale->translate("Shisen-Sho"), 
		     klocale->translate("Cannot load pixmaps!"));
    exit(1);
  }
  
  if(pm.width() == 0 || pm.height() == 0)
    return FALSE;

  x = pm.width() / 9;
  y = pm.height() / 5;
  for(i = 0; i < 9; i++)
    for(j = 0; j < 5; j++) {
	pm_tile[i + j*9] = new QPixmap(x,y);
	bitBlt(pm_tile[i + j*9], 0, 0, &pm, x * i, y * j, x, y, CopyROP);
	if(scale != 1.0) {
	  QWMatrix wm;
	  wm.scale(scale, scale);
	  *pm_tile[i + j*9] = pm_tile[i + j*9]->xForm(wm);
	}
    }
  
  return TRUE;
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:35,代码来源:board.cpp

示例2: addFile

void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
    MimeType type( info->absFilePath() );
    if (!compliesMime( type.id() ) )
        return;

    QPixmap pix = type.pixmap();
    QString dir, name;
    bool locked;
    if ( pix.isNull() ) {
        QWMatrix matrix;
        QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
        matrix.scale( .4, .4 );
        pix = pixer.xForm( matrix );
    }
    dir = info->dirPath( true );
    locked = false;
    if ( symlink )
        name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
    else {
        name = info->fileName();
        if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
                ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
            locked = true;
            pix = Resource::loadPixmap("locked");
        }
    }
    (void)new OFileSelectorItem( m_view, pix, name,
                                 info->lastModified().toString(), QString::number( info->size() ),
                                 dir, locked );
}
开发者ID:opieproject,项目名称:opie,代码行数:30,代码来源:ofileselector.cpp

示例3: applyTransformations

void ImageLabel::applyTransformations(bool useSmoothScale)
{
    pixmap = realpixmap;
    if (doRotate)
    {
        // KDE and QT seem to miss a high quality image rotation
        QWMatrix rotMat;
        rotMat.rotate(rot_angle);
        pixmap = pixmap.xForm(rotMat);
    }
    if (doScale)
    {
        if (m_karamba -> useSmoothTransforms() || useSmoothScale)
        {
            pixmap.convertFromImage(
              pixmap.convertToImage().smoothScale(scale_w, scale_h));
        }
        else
        {
            double widthFactor = ((double)scale_w) / ((double)pixmap.width());
            double heightFactor = ((double)scale_h) / ((double)pixmap.height());
            QWMatrix scaleMat;
            scaleMat.scale(widthFactor, heightFactor);
            pixmap = pixmap.xForm(scaleMat);
        }
    }
    if (imageEffect != 0)
    {
        pixmap = imageEffect -> apply(pixmap);
    }
    setWidth(pixmap.width());
    setHeight(pixmap.height());
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:33,代码来源:imagelabel.cpp

示例4: 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

示例5:

void k9MenuEditor::resizeEvent ( QResizeEvent * e ) {
    QWMatrix m;
    double scalex=(e->size().width()-4.0)/720.0;
    double scaley=(e->size().height()-4.0)/576.0;
    m.scale(QMIN(scalex,scaley),QMIN(scalex,scaley));
    this->setWorldMatrix(m);

}
开发者ID:mitch000001,项目名称:k9copy,代码行数:8,代码来源:k9menueditor.cpp

示例6: setKind

void SymbolItem::setKind( int kind_ )
{
    kind = kind_;

    QWMatrix m;
    if ( kind == FOLDER )
    {
        m.scale( 0.6, 0.6 );
        QPixmap small = i_folder.xForm( m );
        setPixmap( 0, small );
    }
    else if ( kind == GRAPHIC )
    {
        m.scale( 0.55, 0.55 );
        QPixmap small = i_graphic.xForm( m );
        setPixmap( 0, small );
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:18,代码来源:symbolitem.cpp

示例7: updateWorldMatrix

void CVBEditor::updateWorldMatrix() {
	double z = p_itemView->zoomLevel();
	QRect r = m_pCanvas->rect();
// 	QWMatrix m( z, 0.0, 0.0, z, -r.left(), -r.top() );
// 	QWMatrix m( z, 0.0, 0.0, z, 0.0, 0.0 );
	QWMatrix m;
	m.scale(z, z);
	m.translate(-r.left(), -r.top());
	setWorldMatrix(m);
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:10,代码来源:itemview.cpp

示例8: zoomOut

void ClsQDiagramView::zoomOut() {
#ifdef DEBUG_CLSQDIAGRAMVIEW
    cout << "ClsQDiagramView::zoomOut()" << endl;
#endif
    QWMatrix m = clsQDiagramCanvasView->worldMatrix();
    m.scale( 0.9, 0.9 );
    clsQDiagramCanvasView->setWorldMatrix( m );
#ifdef USEPANNER
    clsqcanvaspanner->canvasResized();
#endif
};
开发者ID:jeez,项目名称:iqr,代码行数:11,代码来源:ClsQDiagramView.cpp

示例9: draw

/**
 * Draws the graph on the canvas using the graphviz engine.
 * A new canvas is created, so all items need to be regenerated.
 * TODO: Can we use the same canvas and only reposition existing items?
 */
void GraphWidget::draw()
{
	QWMatrix mtx;
	char szTempFile[TMP_TMPL_SIZE];
	int nFd;
	FILE* pFile;
	
	// Do nothing if drawing process has already started
	if (m_dot.isRunning())
		return;
	
	// Apply the zoom factor
	mtx.scale(m_dZoom, m_dZoom);
	setWorldMatrix(mtx);

	// Do not draw until the Dot process finishes
	setUpdatesEnabled(false);

	// Open a temporary file
	strcpy(szTempFile, TMP_TMPL);
	nFd = mkstemp(szTempFile);
	if ((pFile = fdopen(nFd, "w")) == NULL)
		return;
	
	// Remember the file name (so it can be deleted later)
	m_sDrawFilePath = szTempFile;
	
	// Write the graph contents to the temporary file
	{
		QTextStream str(pFile, IO_WriteOnly);
		write(str, "graph", "--", false);
	}
	
	// Close the file
	fclose(pFile);
	
	// Draw the graph
	if (m_dot.run(szTempFile)) {
		// Create the progress dialogue
		m_pProgressDlg = new ProgressDlg(i18n("KScope"), 
			i18n("Generating graph, please wait"), this);
		m_pProgressDlg->setMinimumDuration(1000);
		m_pProgressDlg->setValue(0);
		
		// TODO:
		// Implement cancel (what do we do when the drawing process is 
		// terminated, even though the nodes and edges were already added by
		// Cscope?)
		// m_pProgressDlg->setAllowCancel(true);
	}
}
开发者ID:fredollinger,项目名称:kscope-kde4,代码行数:56,代码来源:graphwidget4.cpp

示例10: 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

示例11: zoom

/**
 * Changes the zoom factor.
 * @param	bIn	true to zoom in, false to zoom out
 */
void GraphWidget::zoom(bool bIn)
{
	QWMatrix mtx;
	
	// Set the new zoom factor
	if (bIn)
		m_dZoom *= 2.0;
	else
		m_dZoom /= 2.0;
		
	// Apply the transformation matrix
	mtx.scale(m_dZoom, m_dZoom);
	setWorldMatrix(mtx);
}
开发者ID:fredollinger,项目名称:kscope-kde4,代码行数:18,代码来源:graphwidget4.cpp

示例12: mousePressEvent

void Pen::mousePressEvent(QMouseEvent *e)
{
  int x,y;
  QPainter painter1;
  QPainter painter2;
  QWMatrix m;

  KDEBUG(KDEBUG_INFO, 3000, "Pen::mousePressEvent() handler called\n");
  
  if (isActive()) {
    if (drawing) {
      KDEBUG(KDEBUG_INFO, 3000, "Pen: Warning button press received while drawing\n");
    }
    x= (e->pos()).x();
    y= (e->pos()).y();
    activeButton= e->button();

    m.scale((float) 100/(canvas->zoom()), (float) 100/(canvas->zoom()));

    painter1.begin(canvas->pixmap());

    if (activeButton == LeftButton)
      painter1.setPen(leftpen);
    else
      painter1.setPen(rightpen);
    painter1.setWorldMatrix(m);

    painter2.begin(canvas->zoomedPixmap());

    if (activeButton == LeftButton)
      painter2.setPen(leftpen);
    else
      painter2.setPen(rightpen);

    painter1.drawPoint(x, y);
    painter2.drawPoint(x, y);

    painter1.end();
    painter2.end();

    canvas->repaint(0);
    lastx= x;
    lasty= y;
    drawing= TRUE;
  } 
  if (!isActive()) {
    KDEBUG(KDEBUG_WARN, 3000, "Warning event received when inactive (ignoring)\n");
  }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:49,代码来源:pen.cpp

示例13: 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

示例14: mouseMoveEvent

void Pen::mouseMoveEvent(QMouseEvent *e)
{
  int x,y;
  QPainter painter1;
  QPainter painter2;
  QWMatrix m;

  if (isActive()) {
    x= (e->pos()).x();
    y= (e->pos()).y();

    if (drawing) {
      if ((x != lastx) || (y != lasty)) {
	emit modified();
	m.scale((float) 100/(canvas->zoom()), (float) 100/(canvas->zoom()));

	painter1.begin(canvas->pixmap());

	if (activeButton == LeftButton)
	  painter1.setPen(leftpen);
	else
	  painter1.setPen(rightpen);

	painter1.setWorldMatrix(m);

	painter2.begin(canvas->zoomedPixmap());

	if (activeButton == LeftButton)
	  painter2.setPen(leftpen);
	else
	  painter2.setPen(rightpen);

	painter1.drawLine(lastx, lasty, x, y);
	painter2.drawLine(lastx, lasty, x, y);

	lastx= x;
	lasty= y;

	painter1.end();
	painter2.end();
	canvas->repaint(0);
      }
    }
  }
  else {
    KDEBUG(KDEBUG_WARN, 3000, "Warning event received when inactive (ignoring)\n");
  }
}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:48,代码来源:pen.cpp

示例15: main

int main( int argc, char **argv )
{
    QApplication a(argc,argv);			
    
    QTable v( numRows, numCols );
    QWMatrix wm;
    wm.scale( 0.5, 0.5 );
    QPixmap pix( qtlogo_xpm );
    pix = pix.xForm( wm );
    v.setPixmap( 3, 3, pix );
    v.setText( 3, 3, "A Pixmap" );
    
    a.setMainWidget( &v );
    v.show();
    return a.exec();
}
开发者ID:kthxbyte,项目名称:QT2-Linaro,代码行数:16,代码来源:main.cpp


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