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


C++ setTransform函数代码示例

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


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

示例1: setFlag

void CardItem::_initialize() {
    setFlag(QGraphicsItem::ItemIsMovable);
    m_opacityAtHome = 1.0;
    m_currentAnimation = NULL;
    _m_width = G_COMMON_LAYOUT.m_cardNormalWidth;
    _m_height = G_COMMON_LAYOUT.m_cardNormalHeight;
    _m_showFootnote = true;
    m_isSelected = false;
    _m_isUnknownGeneral = false;
    auto_back = true;
    frozen = false;
    resetTransform();
    setTransform(QTransform::fromTranslate(-_m_width / 2, -_m_height / 2), true);
    outerGlowEffectEnabled = false;
    outerGlowEffect = NULL;
    outerGlowColor = Qt::white;
    _transferButton = NULL;
    _transferable = false;
    _skinId = 0;
}
开发者ID:Holdlen2DH,项目名称:QSanguosha,代码行数:20,代码来源:carditem.cpp

示例2: setOccupied

void CoverPoint::unpackUpdate(NetConnection *conn, BitStream *stream)
{
   Parent::unpackUpdate(conn, stream);

   mSize = (Size)stream->readInt(4);

   setOccupied(stream->readFlag());

   mPeekLeft = stream->readFlag();
   mPeekRight = stream->readFlag();
   mPeekOver = stream->readFlag();

   if(stream->readFlag()) // TransformMask
   {
      mathRead(*stream, &mObjToWorld);
      mathRead(*stream, &mObjScale);

      setTransform(mObjToWorld);
   }
}
开发者ID:03050903,项目名称:Torque3D,代码行数:20,代码来源:coverPoint.cpp

示例3: tr

void DrawableImage::recalculateCoordinates (Expression::Scope* scope)
{
    if (image.isValid())
    {
        Point<float> resolved[3];
        bounds.resolveThreePoints (resolved, scope);

        const Point<float> tr (resolved[0] + (resolved[1] - resolved[0]) / (float) image.getWidth());
        const Point<float> bl (resolved[0] + (resolved[2] - resolved[0]) / (float) image.getHeight());

        AffineTransform t (AffineTransform::fromTargetPoints (resolved[0].x, resolved[0].y,
                                                              tr.x, tr.y,
                                                              bl.x, bl.y));

        if (t.isSingularity())
            t = AffineTransform();

        setTransform (t);
    }
}
开发者ID:COx2,项目名称:PizzaKnobFilter,代码行数:20,代码来源:juce_DrawableImage.cpp

示例4: ProxyComponent

        ProxyComponent (Component& c)
        {
            setWantsKeyboardFocus (false);
            setBounds (c.getBounds());
            setTransform (c.getTransform());
            setAlpha (c.getAlpha());
            setInterceptsMouseClicks (false, false);

            if (Component* const parent = c.getParentComponent())
                parent->addAndMakeVisible (this);
            else if (c.isOnDesktop() && c.getPeer() != nullptr)
                addToDesktop (c.getPeer()->getStyleFlags() | ComponentPeer::windowIgnoresKeyPresses);
            else
                jassertfalse; // seem to be trying to animate a component that's not visible..

            image = c.createComponentSnapshot (c.getLocalBounds(), false, getDesktopScaleFactor());

            setVisible (true);
            toBehind (&c);
        }
开发者ID:MartinHH,项目名称:JUCE,代码行数:20,代码来源:juce_ComponentAnimator.cpp

示例5: DiagramItem

//! [0]
DiagramDrawItem::DiagramDrawItem(const DiagramDrawItem& diagram)
	: DiagramItem(diagram.myContextMenu,diagram.parentItem(),0)
{

	myDiagramType=diagram.myDiagramType;
	// copy from general GraphcsItem
	setBrush(diagram.brush());
	setPen(diagram.pen());
	setTransform(diagram.transform());
	myPos2=diagram.myPos2;
	myPolygon=createPath();
	setPolygon(myPolygon);
	setFlag(QGraphicsItem::ItemIsMovable, true);
	setFlag(QGraphicsItem::ItemIsSelectable, true);
	setAcceptHoverEvents(true);
	myHoverPoint=-1;
	mySelPoint=-1;
	myHandlerWidth=2.0;

}
开发者ID:autoscatto,项目名称:retroshare,代码行数:21,代码来源:diagramdrawitem.cpp

示例6: QgsDebugMsg

void QgsGrassPlugin::mapsetChanged()
{
  QgsDebugMsg( "entered" );
  if ( !QgsGrass::activeMode() )
  {
    mRegionAction->setEnabled( false );
    mRegionBand->reset();
    mCloseMapsetAction->setEnabled( false );
  }
  else
  {
    mRegionAction->setEnabled( true );
    mCloseMapsetAction->setEnabled( true );

    QSettings settings;
    bool on = settings.value( "/GRASS/region/on", true ).toBool();
    mRegionAction->setChecked( on );
    switchRegion( on );

    QString gisdbase = QgsGrass::getDefaultGisdbase();
    QString location = QgsGrass::getDefaultLocation();
    try
    {
      mCrs = QgsGrass::crsDirect( gisdbase, location );
    }
    catch ( QgsGrass::Exception &e )
    {
      Q_UNUSED( e );
      QgsDebugMsg( "Cannot read GRASS CRS : " + QString( e.what() ) );
      mCrs = QgsCoordinateReferenceSystem();
    }
    QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
    setTransform();
    redrawRegion();
  }

  if ( mTools )
  {
    mTools->mapsetChanged();
  }
}
开发者ID:yellow-sky,项目名称:QGIS,代码行数:41,代码来源:qgsgrassplugin.cpp

示例7: mathRead

void RenderMeshExample::unpackUpdate(NetConnection *conn, BitStream *stream)
{
   // Let the Parent read any info it sent
   Parent::unpackUpdate(conn, stream);

   if ( stream->readFlag() )  // TransformMask
   {
      mathRead(*stream, &mObjToWorld);
      mathRead(*stream, &mObjScale);

      setTransform( mObjToWorld );
   }

   if ( stream->readFlag() )  // UpdateMask
   {
      stream->read( &mMaterialName );

      if ( isProperlyAdded() )
         updateMaterial();
   }
}
开发者ID:fr1tz,项目名称:alux3d,代码行数:21,代码来源:renderMeshExample.cpp

示例8: draw

	virtual void draw(const GLMatrix4 &parentTransform, const GLMatrix4 &parentNormalTransform) 
	{
		if(tornado)
		{
			for(int i = 0; i < 4; i++)
				vertices[i].color = 0xFF0033CC;
		}
		else
		{
			for(int i = 0; i < 4; i++)
				vertices[i].color = 0xFFCC3300;
		}
		const GLMatrix4 &t = parentTransform * transform,
		&nt = parentNormalTransform * normTransform;
		bindVertexArray(vertices);
		setTransform(t, nt);

		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
		
		drawChildren(t, nt);
	}
开发者ID:verngutz,项目名称:DNA,代码行数:21,代码来源:geometries.hpp

示例9: animateMove

void QQHuntPixmapItem::loadNextPixMap()
{
	if(! m_listPixmapProp.isEmpty())
	{
		m_animPixmapTimer.stop();
		QQPixmapProp pixmapProp = m_listPixmapProp.at(0);
		m_listPixmapProp.remove(0);
		m_currPixmapName = BASE_ANIM_PIX.append(pixmapProp.m_pixmapName);

		animateMove();
		QPixmap p = pixmap();

		int scaleX = pixmapProp.m_mirrorX ? -1 : 1;
		int scaleY = pixmapProp.m_mirrorY ? -1 : 1;
		setTransformOriginPoint(p.width() / 2, p.height() / 2);
		setTransform(QTransform().scale(scaleX, scaleY).rotateRadians(pixmapProp.m_rotationAngle, Qt::ZAxis));
		setPixmap(p);
		if(m_animPixmapTimerEnabled)
			m_animPixmapTimer.start();
	}
}
开发者ID:claudex,项目名称:quteqoin,代码行数:21,代码来源:qqhuntpixmapitem.cpp

示例10: rect

void ColorSchemeGraphicsItem::updateBrushes()
{
    const auto parent = dynamic_cast<QWidget*>(parentWidget());
    const auto penWidthF = 1.0 / DpiAware::devicePixelRatio(parent);

    for (uint i = 0; i < m_classes; ++i)
    {
        auto rect(m_rects[i]);

        auto color = m_scheme.colors(m_classes)[m_classes - i - 1];
        color = daltonize(color, m_deficiency);

        auto brush = RGBABrush(color);

        // this aligns the brush pattern with the rect (since there is no way to directly set the brush origin similar to a painter)
        brush.setTransform(QTransform::fromTranslate( // who cares ... :P
            m_margin + 1, (m_padding + penWidthF) * static_cast<qreal>(i) + m_margin + 1));

        rect->setBrush(brush);
    }
}
开发者ID:cginternals,项目名称:libzeug,代码行数:21,代码来源:ColorSchemeGraphicsItem.cpp

示例11: setCacheMode

void AbstractDesktopWidget::setRotation(float angle)
{
    d->mAngle = angle;
    setCacheMode(ItemCoordinateCache);
    QPointF center = boundingRect().center();
    QTransform mat = QTransform();
    mat.translate(center.x(), center.y());
    mat.rotate(d->mAngle, Qt::YAxis);
    mat.translate(-center.x(), -center.y());
    setTransform(mat);
    if (d->mAngle >= 180) {
        if (state() == ROTATED) {
            setState(VIEW);
        } else {
            setState(ROTATED);
        }
        resetMatrix();
        //setCacheMode(DeviceCoordinateCache);
        d->mAngle = 0;
    }
}
开发者ID:algometrix,项目名称:plexydesk,代码行数:21,代码来源:abstractdesktopwidget.cpp

示例12: basisForNormal

void TextureProjection::fitTexture (std::size_t width, std::size_t height, const Vector3& normal, const Winding& w,
		float s_repeat, float t_repeat)
{
	if (w.size() < 3) {
		return;
	}

	Matrix4 st2tex = m_texdef.getTransform((float) width, (float) height);

	// the current texture transform
	Matrix4 local2tex = st2tex;
	{
		Matrix4 xyz2st;
		basisForNormal(normal, xyz2st);
		matrix4_multiply_by_matrix4(local2tex, xyz2st);
	}

	// the bounds of the current texture transform
	AABB bounds;
	for (Winding::const_iterator i = w.begin(); i != w.end(); ++i) {
		Vector3 texcoord = matrix4_transformed_point(local2tex, (*i).vertex);
		aabb_extend_by_point_safe(bounds, texcoord);
	}
	bounds.origin.z() = 0;
	bounds.extents.z() = 1;

	// the bounds of a perfectly fitted texture transform
	AABB perfect(Vector3(s_repeat * 0.5, t_repeat * 0.5, 0), Vector3(s_repeat * 0.5, t_repeat * 0.5, 1));

	// the difference between the current texture transform and the perfectly fitted transform
	Matrix4 matrix(Matrix4::getTranslation(bounds.origin - perfect.origin));
	matrix4_pivoted_scale_by_vec3(matrix, bounds.extents / perfect.extents, perfect.origin);
	matrix4_affine_invert(matrix);

	// apply the difference to the current texture transform
	matrix4_premultiply_by_matrix4(st2tex, matrix);

	setTransform((float) width, (float) height, st2tex);
	m_texdef.normalise((float) width, (float) height);
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:40,代码来源:TextureProjection.cpp

示例13: doUpdateTexImage

bool DeferredLayerUpdater::apply() {
    bool success = true;
    // These properties are applied the same to both layer types
    mLayer->setColorFilter(mColorFilter);
    mLayer->setAlpha(mAlpha, mMode);

    if (mSurfaceTexture.get()) {
        if (mNeedsGLContextAttach) {
            mNeedsGLContextAttach = false;
            mSurfaceTexture->attachToContext(mLayer->getTexture());
        }
        if (mUpdateTexImage) {
            mUpdateTexImage = false;
            doUpdateTexImage();
        }
        if (mTransform) {
            mLayer->getTransform().load(*mTransform);
            setTransform(0);
        }
    }
    return success;
}
开发者ID:AdrianoMartins,项目名称:platform_frameworks_base,代码行数:22,代码来源:DeferredLayerUpdater.cpp

示例14: setCacheMode

void DesktopWidget::spin()
{
    d->angle += 18;
    setCacheMode(ItemCoordinateCache);
    QPointF center = boundingRect().center();
    QTransform mat = QTransform();
    mat.translate(center.x() ,  center.y());
    mat.rotate(d->angle, Qt::YAxis);
    mat.translate(- center.x() ,  - center.y());
    setTransform(mat);
    if (d->angle >= 180) {
        if (state() == BACKSIDE) {
            setState(NORMALSIDE);
        } else {
            setState(BACKSIDE);
        }
        d->spintimer->stop();
        resetMatrix();
        setCacheMode(DeviceCoordinateCache);
        d->angle = 0;
    }
}
开发者ID:chanux,项目名称:plexydesk,代码行数:22,代码来源:desktopwidget.cpp

示例15: resizeEvent

    virtual void resizeEvent(QResizeEvent *event) {
        QGraphicsView::resizeEvent(event);
        QGraphicsScene *scene = this->scene();
        if (scene) {
            QRectF newSceneRect(0, 0, event->size().width(), event->size().height());
            scene->setSceneRect(newSceneRect);
            if (scene->sceneRect().size() != event->size()) {
                QSizeF from(scene->sceneRect().size());
                QSizeF to(event->size());
                QTransform transform;
                transform.scale(to.width() / from.width(), to.height() / from.height());
                setTransform(transform);
            } else {
                resetTransform();
            }
            setSceneRect(scene->sceneRect());
        }

        MainWindow *main_window = qobject_cast<MainWindow *>(parentWidget());
        if (main_window)
            main_window->fitBackgroundBrush();
    }
开发者ID:kissthink,项目名称:QSanguosha-For-Hegemony,代码行数:22,代码来源:mainwindow.cpp


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