• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ scaleRect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中scaleRect函数的典型用法代码示例。如果您正苦于以下问题:C++ scaleRect函数的具体用法?C++ scaleRect怎么用?C++ scaleRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: paintStuff

static void paintStuff(QPainter *p)
{
    QPaintDevice *screenDevice = QApplication::desktop();
    p->drawRect(scaleRect(QRectF(100, 100, 100, 100), screenDevice, p->device()));
    p->save();
    p->translate(scalePoint(QPointF(10, 10), screenDevice, p->device()));
    p->restore();
    p->drawRect(scaleRect(QRectF(100, 100, 100, 100), screenDevice, p->device()));
}
开发者ID:mpvader,项目名称:qt,代码行数:9,代码来源:tst_qpicture.cpp


示例2: mouseDblClicked

void ScalePicker::mouseDblClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
	if (scaleRect(scale).contains(pos) ) 
		emit axisDblClicked(scale->alignment());
	else
	{// Click on the title
		switch(scale->alignment())   
		{
			case QwtScaleDraw::LeftScale:
				{
					emit yAxisTitleDblClicked();
					break;
				}
			case QwtScaleDraw::RightScale:
				{
					emit rightAxisTitleDblClicked();
					break;
				}
			case QwtScaleDraw::BottomScale:
				{
					emit xAxisTitleDblClicked();
					break;
				}
			case QwtScaleDraw::TopScale:
				{
					emit topAxisTitleDblClicked();
					break;
				}
		}
	}
}
开发者ID:narunlifescience,项目名称:scidavis,代码行数:31,代码来源:ScalePicker.cpp


示例3: axisTitleDblClicked

void ScalePicker::mouseDblClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
	if (titleRect(scale).contains(pos))
		emit axisTitleDblClicked();
	else if (scaleRect(scale).contains(pos))
        emit axisDblClicked(scale->alignment());
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:7,代码来源:ScalePicker.cpp


示例4: plot

void QwtPlotZoomer::rescale()
{
    QwtPlot *plt = plot();
    if ( !plt )
        return;

    const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
    if ( rect != scaleRect() )
    {
        const bool doReplot = plt->autoReplot();
        plt->setAutoReplot( false );

        double x1 = rect.left();
        double x2 = rect.right();
        if ( !plt->axisScaleDiv( xAxis() ).isIncreasing() )
            qSwap( x1, x2 );

        plt->setAxisScale( xAxis(), x1, x2 );

        double y1 = rect.top();
        double y2 = rect.bottom();
        if ( !plt->axisScaleDiv( yAxis() ).isIncreasing() )
            qSwap( y1, y2 );

        plt->setAxisScale( yAxis(), y1, y2 );

        plt->setAutoReplot( doReplot );

        plt->replot();
    }
}
开发者ID:facontidavide,项目名称:PlotJuggler,代码行数:31,代码来源:qwt_plot_zoomer.cpp


示例5: scaleRect

void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint8 color, const bool doScaling) {
	Common::Rect targetRect = doScaling ? scaleRect(rect) : rect;

	SciBitmap &bitmap = *_segMan->lookupBitmap(_bitmap);
	byte *pixels = bitmap.getPixels() + rect.top * _width + rect.left;

	// NOTE: Not fully disassembled, but this should be right
	int16 rectWidth = targetRect.width();
	int16 heightRemaining = targetRect.height();
	int16 sidesHeight = heightRemaining - size * 2;
	int16 centerWidth = rectWidth - size * 2;
	int16 stride = _width - rectWidth;

	for (int16 y = 0; y < size && y < heightRemaining; ++y) {
		memset(pixels, color, rectWidth);
		pixels += _width;
		--heightRemaining;
	}
	for (int16 y = 0; y < sidesHeight; ++y) {
		for (int16 x = 0; x < size; ++x) {
			*pixels++ = color;
		}
		pixels += centerWidth;
		for (int16 x = 0; x < size; ++x) {
			*pixels++ = color;
		}
		pixels += stride;
	}
	for (int16 y = 0; y < size && y < heightRemaining; ++y) {
		memset(pixels, color, rectWidth);
		pixels += _width;
		--heightRemaining;
	}
}
开发者ID:86400,项目名称:scummvm,代码行数:34,代码来源:text32.cpp


示例6: zoomRectIndex

void PlotZoomer::zoom(int up)
{
  // FIXME: Save the current zoom window in case it's been panned.
  int zoomIndex = zoomRectIndex();
  if (zoomIndex > 0)
  {
    QStack<QRectF> stack = zoomStack();
    if (zoomIndex < stack.size())
    {
      QRectF r = scaleRect();
      stack[zoomIndex] = r;
      setZoomStack(stack, zoomIndex);
    }
  }

  Super::zoom(up);
  if (zoomRectIndex() == 0)
  {
    if (QwtPlot *plotter = plot())
    {
      plotter->setAxisAutoScale(AxisX);
      plotter->setAxisAutoScale(AxisY);
      plotter->updateAxes();
    }
  }
}
开发者ID:KazNX,项目名称:ocurves,代码行数:26,代码来源:plotzoomer.cpp


示例7: urnFromUrl

void LookAlikeMainPrivate::confirmFace(QUrl picture, QString& contact)
{
    //Confirm in Face Recognizer database
    QString urnImage = urnFromUrl(picture);
    XQFaceRegion region = findRegion(contact, urnImage);
    region.setFaceId(contact);

    //Update XMP metadata image
    QString fileName = picture.toLocalFile();
    QImage image(fileName);
    //Scale face to image dimensions
    QSize originalSize = image.size();
    QSize thumbnailSize = region.sourceImageSize();
    QRect rect = region.faceRect();
    QRect scaledRect = scaleRect(rect, thumbnailSize, originalSize);
    QuillMetadataRegion metadataRegion;
    metadataRegion.setArea(scaledRect);
    metadataRegion.setType(QuillMetadataRegion::RegionType_Face);
    QString contactName = m_faceDatabaseProvider->getContactName(contact);
    metadataRegion.setName(contactName);
    metadataRegion.setExtension("nco:PersonContact", contact);
    QuillMetadataRegionList regionList;
    regionList.append(metadataRegion);
    saveMetadataRegionList(fileName, regionList);
}
开发者ID:Igalia,项目名称:lookalike,代码行数:25,代码来源:lookalikemain_p.cpp


示例8: scaleRect

void ScalePicker::mouseRightClicked(const QwtScale *scale, const QPoint &pos) 
{
QRect rect = scaleRect(scale);

int margin = 2; // pixels tolerance
rect.setRect(rect.x() - margin, rect.y() - margin, rect.width() + 2 * margin, rect.height() +  2 * margin);

if (rect.contains(pos)) 
	{
	if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
			emit axisRightClicked(scale->position());
	else if (scale->position() == QwtScale::Top)
		emit axisRightClicked(QwtScale::Bottom);
	else if (scale->position() == QwtScale::Bottom)
		emit axisRightClicked(QwtScale::Top);
	}
else
	{
	if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
		emit axisTitleRightClicked(scale->position());
	else if (scale->position() == QwtScale::Top)
		emit axisTitleRightClicked(QwtScale::Bottom);
	else if (scale->position() == QwtScale::Bottom)
		emit axisTitleRightClicked(QwtScale::Top);
	}
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:26,代码来源:scalePicker.cpp


示例9: setZoomBase

void QwtPlotZoomer::setAxis( int xAxis, int yAxis )
{
    if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() )
    {
        QwtPlotPicker::setAxis( xAxis, yAxis );
        setZoomBase( scaleRect() );
    }
}
开发者ID:facontidavide,项目名称:PlotJuggler,代码行数:8,代码来源:qwt_plot_zoomer.cpp


示例10: plot

void ScalePicker::mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos)
{
	plot()->activateGraph();
	
	if (scaleRect(scale).contains(pos))
		emit axisRightClicked(scale->alignment());
	else
		emit axisTitleRightClicked();
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:9,代码来源:ScalePicker.cpp


示例11: setSelectionFlags

//! Init the zoomer, used by the constructors
void QwtPlotZoomer::init(int selectionFlags, DisplayMode trackerMode)
{
    d_data = new PrivateData;

    d_data->maxStackDepth = -1;

    setSelectionFlags(selectionFlags);
    setTrackerMode(trackerMode);
    setRubberBand(RectRubberBand);

    setZoomBase(scaleRect());
}
开发者ID:chongle,项目名称:prorata,代码行数:13,代码来源:qwt_plot_zoomer.cpp


示例12: scaleRect

void GfxText32::erase(const Common::Rect &rect, const bool doScaling) {
	Common::Rect targetRect = doScaling ? rect : scaleRect(rect);

	byte *bitmap = _segMan->getHunkPointer(_bitmap);
	byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28);

	// NOTE: There is an extra optimisation within the SCI code to
	// do a single memset if the scaledRect is the same size as
	// the bitmap, not implemented here.
	Buffer buffer(_width, _height, pixels);
	buffer.fillRect(targetRect, _backColor);
}
开发者ID:MisturDust319,项目名称:scummvm,代码行数:12,代码来源:text32.cpp


示例13: scaleRect

/*!
  Reinitialized the zoom stack with scaleRect() as base.

  \sa zoomBase(), scaleRect()

  \warning Calling QwtPlot::setAxisScale() while QwtPlot::autoReplot() is false
           leaves the axis in an 'intermediate' state.
           In this case, to prevent buggy behaviour, you must call
           QwtPlot::replot() before calling QwtPlotZoomer::setZoomBase().
           This quirk will be removed in a future release.

  \sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
void QwtPlotZoomer::setZoomBase()
{
    const QwtPlot *plt = plot();
    if ( !plt )
        return;

    d_data->zoomStack.clear();
    d_data->zoomStack.push(scaleRect());
    d_data->zoomRectIndex = 0;

    rescale();
}
开发者ID:DMachuca,项目名称:ar2tech-SGeMS-public,代码行数:25,代码来源:qwt_plot_zoomer.cpp


示例14: setTrackerMode

//! Init the zoomer, used by the constructors
void QwtPlotZoomer::init( bool doReplot )
{
    d_data = new PrivateData;

    d_data->maxStackDepth = -1;

    setTrackerMode( ActiveOnly );
    setRubberBand( RectRubberBand );
    setStateMachine( new QwtPickerDragRectMachine() );

    if ( doReplot && plot() )
        plot()->replot();

    setZoomBase( scaleRect() );
}
开发者ID:facontidavide,项目名称:PlotJuggler,代码行数:16,代码来源:qwt_plot_zoomer.cpp


示例15: scaleRect

/*!
  Reinitialized the zoom stack with scaleRect() as base.

  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                  the zoomer with its scales. This might be necessary,
                  when the plot is in a state with pending scale changes.

  \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
*/
void QwtPlotZoomer::setZoomBase( bool doReplot )
{
    QwtPlot *plt = plot();
    if ( plt == NULL )
        return;

    if ( doReplot )
        plt->replot();

    d_data->zoomStack.clear();
    d_data->zoomStack.push( scaleRect() );
    d_data->zoomRectIndex = 0;

    rescale();
}
开发者ID:facontidavide,项目名称:PlotJuggler,代码行数:24,代码来源:qwt_plot_zoomer.cpp


示例16: scaleRect

void Differ::addHighlighting(QRectF *bigRect,
        QPainterPath *highlighted, const QRectF wordOrCharRect,
        const int DPI)
{
    QRectF rect = wordOrCharRect;
    scaleRect(DPI, &rect);
    if (combineHighlightedWords &&
        rect.adjusted(-overlap, -overlap, overlap, overlap)
            .intersects(*bigRect))
    {
        *bigRect = bigRect->united(rect);
    }
    else {
        highlighted->addRect(*bigRect);
        *bigRect = rect;
    }
}
开发者ID:bhh1988,项目名称:diffpdf,代码行数:17,代码来源:mainwindow.cpp


示例17: r

void EditFrame::paintEvent(QPaintEvent* /*event*/)
{
	QRect r( rect() );
	r.adjust(0, 0, -1, -1);
	
	QPainter painter(this);
	
	QColor color(m_Selected ? QColor(0,200,60) : QColor(255,255,255));
	
	if( m_Selected )
	{
		QColor fillColor(color);
		fillColor.setAlpha(40);
		painter.fillRect(r, fillColor);
		
		QWidget *pParent = parentWidget();
		if( pParent )
		{
			QRect g( pParent->geometry() );
			QString label = QString("(%1,%2)\n%3x%4").arg(g.x()).arg(g.y()).arg(g.width()).arg(g.height());
			painter.setPen( QColor(0,0,0) );
			painter.drawText(r.adjusted(1,1,1,1), Qt::AlignCenter, label);
			painter.setPen( QColor(255,255,255) );
			painter.drawText(r, Qt::AlignCenter, label);
		}
	}
	
	r.adjust(HANDLE_MARGIN, HANDLE_MARGIN, -HANDLE_MARGIN-1, -HANDLE_MARGIN-1);
	
	for(int i=0; i<2; i++)
	{
		QColor handleColor((i==0) ? QColor(0,0,0) : color);
		
		painter.setBrush(Qt::NoBrush);
		if(i == 0)
			painter.setPen( QPen(handleColor,3) );
		else
			painter.setPen(handleColor);
		painter.drawRect(r);
	
		QRect scaleRect(width()-HANDLE_SIZE-1, height()-HANDLE_SIZE-1, HANDLE_SIZE, HANDLE_SIZE);
		if(i == 0)
			scaleRect.adjust(-1, -1, 1, 1);
		painter.fillRect(scaleRect, handleColor);
	}
}
开发者ID:zoombapup,项目名称:OSCWidgets,代码行数:46,代码来源:ToyWindow.cpp


示例18: scaleRect

void ScalePicker::mouseClicked( const QwtScaleWidget *scale, const QPoint &pos )
{
    QRect rect = scaleRect( scale );

    int margin = 20; // 20 pixels tolerance
    rect.setRect( rect.x() - margin, rect.y() - margin,
        rect.width() + 2 * margin, rect.height() +  2 * margin );

    if ( rect.contains( pos ) ) // No click on the title
    {
        // translate the position in a value on the scale

        double value = 0.0;
        int axis = -1;

        const QwtScaleDraw *sd = scale->scaleDraw();
        switch( scale->alignment() )
        {
            case QwtScaleDraw::LeftScale:
            {
                value = sd->scaleMap().invTransform( pos.y() );
                axis = QwtPlot::yLeft;
                break;
            }
            case QwtScaleDraw::RightScale:
            {
                value = sd->scaleMap().invTransform( pos.y() );
                axis = QwtPlot::yRight;
                break;
            }
            case QwtScaleDraw::BottomScale:
            {
                value = sd->scaleMap().invTransform( pos.x() );
                axis = QwtPlot::xBottom;
                break;
            }
            case QwtScaleDraw::TopScale:
            {
                value = sd->scaleMap().invTransform( pos.x() );
                axis = QwtPlot::xTop;
                break;
            }
        }
        Q_EMIT clicked( axis, value );
    }
}
开发者ID:svn2github,项目名称:Qwt_trunk,代码行数:46,代码来源:scalepicker.cpp


示例19: setSharedArea

void ServerVideoManager::setSharedArea(RECT r,bool sendAreaMsg,int client)
{
	first=true;	// Next set of rectangles detected from Analyzer threads will be ignored
	shared=r;

	r=scaleRect(r,scale_fact);

	if(sendAreaMsg)
	{
		// True when Server is sharing a window, the window has been moved
		// but its size has not been changed (no need for a message VIDEO_AREA)

		char *msg=new char[HEADER_VIDEO_AREA_DIM];

		// Write the control header
		int num;
		num = htons((u_short)HEADER_VIDEO_AREA);
		memcpy(msg,&num,2);	// message code

		num = htons((u_short)(r.right - r.left));
		memcpy(msg+2,&num,2);	// width

		num = htons((u_short)(r.bottom - r.top));
		memcpy(msg+4,&num,2);	// height

		send_wrapper(msg,HEADER_VIDEO_AREA_DIM,client);

		delete[] msg;
	}

	if(enabled)
	{
		int offset_x=r.left;
		int offset_y=r.top;

		r.bottom-=offset_y;
		r.top-=offset_y;
		r.left-=offset_x;
		r.right-=offset_x;

		sendRect(r,offset_x,offset_y,client);
		notifyFinishedRefresh();
	}
}
开发者ID:giovannipessiva,项目名称:shareemall,代码行数:44,代码来源:ServerVideoManager.cpp


示例20: CalcProxyScaleFactor

void CalcProxyScaleFactor (const VRect *filterRect, Rect *proxyRect, float *scaleFactor)
{

	short filterHeight;
	short filterWidth;
	short itemHeight;
	short itemWidth;
	Point fraction;

	shrinkRect (proxyRect, kGutter, kGutter); 		 // for the border

	filterHeight = (short)(filterRect->bottom - filterRect->top);
	filterWidth  = (short)(filterRect->right  - filterRect->left);
	
	itemHeight = proxyRect->bottom - proxyRect->top;
	itemWidth  = proxyRect->right  - proxyRect->left;
	
	if (itemHeight > filterHeight)
		itemHeight = filterHeight;
		
	if (itemWidth > filterWidth)
		itemWidth = filterWidth;
	
	fraction.h = (short)((filterWidth + itemWidth) / itemWidth);
	fraction.v = (short)((filterHeight + itemHeight) / itemHeight);

	// compute a scale factor now
	if (fraction.h > fraction.v) 
		*scaleFactor = ((float)filterWidth + (float)itemWidth) / (float)itemWidth;
	else
		*scaleFactor = ((float)filterHeight + (float)itemHeight) / (float)itemHeight;

	// resize the proxy rectangle
	copyRect (proxyRect, filterRect);	
	scaleRect (proxyRect, 1, (short)*scaleFactor);

	// now get a more precise scale factor from the resulting rectangle
	if (fraction.h > fraction.v) 
		*scaleFactor = (float)filterWidth / (float)(proxyRect->right  - proxyRect->left);
	else
		*scaleFactor = (float)filterHeight / (float)(proxyRect->bottom - proxyRect->top);

}
开发者ID:jxfengzi,项目名称:AirPhoto,代码行数:43,代码来源:PoorMansTypeTool.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scale_surface函数代码示例发布时间:2022-05-30
下一篇:
C++ scaleImage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap