Exemplo n.º 1
0
void KinectUser::setBounds( const Rectf &rect )
{
	mOutputRect = rect;

	Rectf kRect( 0, 0, 640, 480 ); // kinect image rect
	Rectf dRect = kRect.getCenteredFit( mOutputRect, true );
	if ( mOutputRect.getAspectRatio() > dRect.getAspectRatio() )
		dRect.scaleCentered( mOutputRect.getWidth() / dRect.getWidth() );
	else
		dRect.scaleCentered( mOutputRect.getHeight() / dRect.getHeight() );

	mOutputMapping = RectMapping( kRect, dRect, true );
}
Exemplo n.º 2
0
// Calculates the possible QSlideSwitch knob in the widget.
QRectF QSlideSwitch::knobRect() const
{
	qreal knobWidth = m_rect.height();

	QRectF kRect(0, 0, knobWidth, knobWidth);

	// move the rect to the current position
	qreal pos = (m_rect.width() - knobWidth - 1) * static_cast<qreal>(m_position) / 100.0;
	pos = qMax(0.0, qMin(pos, m_rect.right() - knobWidth));
	kRect.moveLeft(pos);

	return kRect;
}
Exemplo n.º 3
0
void CZoomCtrl::PrepDC(CDC* pDC)
{
	// maps virtual into client
	//m_rVirt = rVirt;
	//m_rScreen = rScreen;
	CRect kRect(m_rScreen.TopLeft(), m_rScreen.BottomRight() - CPoint(10, 10));
	pDC->IntersectClipRect(&m_rScreen);
	//m_rScreen = kRect;

	//pDC->SetMapMode(MM_ANISOTROPIC);
	pDC->SetMapMode(MM_TEXT);
	pDC->SetWindowExt(m_rVirt.Width(), m_rVirt.Height());

	LONG wid = (LONG)(m_zoomFactor * (double)m_rScreen.Width());
	LONG hgt = (LONG)(m_zoomFactor * (double)m_rScreen.Height());
	pDC->SetViewportExt(wid, hgt);

	CSize scrollPos = m_scrollHelper.GetScrollPos();
	pDC->SetViewportOrg(-scrollPos.cx, -scrollPos.cy);
}