コード例 #1
0
ファイル: transitions.cpp プロジェクト: AReim1982/scummvm
// Diagonally displays new screen starting from center - works on _picRect area
// only. Assumes that height of rect is larger than width.
void GfxTransitions::diagonalRollFromCenter(bool blackoutFlag) {
	int16 halfHeight = _picRect.height() / 2;
	Common::Rect upperRect(_picRect.left + halfHeight - 2, _picRect.top + halfHeight, _picRect.right - halfHeight + 1, _picRect.top + halfHeight + 1);
	Common::Rect lowerRect(upperRect.left, upperRect.top, upperRect.right, upperRect.bottom);
	Common::Rect leftRect(upperRect.left, upperRect.top, upperRect.left + 1, lowerRect.bottom);
	Common::Rect rightRect(upperRect.right, upperRect.top, upperRect.right + 1, lowerRect.bottom);
	uint32 msecCount = 0;

	while ((upperRect.top >= _picRect.top) || (lowerRect.bottom <= _picRect.bottom)) {
		if (upperRect.top < _picRect.top) {
			upperRect.translate(0, 1); leftRect.top++; rightRect.top++;
		}
		if (lowerRect.bottom > _picRect.bottom) {
			lowerRect.translate(0, -1); leftRect.bottom--; rightRect.bottom--;
		}
		if (leftRect.left < _picRect.left) {
			leftRect.translate(1, 0); upperRect.left++; lowerRect.left++;
		}
		if (rightRect.right > _picRect.right) {
			rightRect.translate(-1, 0); upperRect.right--; lowerRect.right--;
		}
		copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, -1); upperRect.left--; upperRect.right++;
		copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, 1); lowerRect.left--; lowerRect.right++;
		copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(-1, 0);	leftRect.top--; leftRect.bottom++;
		copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(1, 0); rightRect.top--; rightRect.bottom++;
		msecCount += 4;
		if (doCreateFrame(msecCount)) {
			updateScreenAndWait(msecCount);
		}
	}
}
コード例 #2
0
ファイル: transitions.cpp プロジェクト: CobaltBlues/scummvm
// Diagonally displays new screen starting from edges - works on _picRect area
// only. Assumes that height of rect is larger than width.
void GfxTransitions::diagonalRollToCenter(bool blackoutFlag) {
	Common::Rect upperRect(_picRect.left, _picRect.top, _picRect.right, _picRect.top + 1);
	Common::Rect lowerRect(_picRect.left, _picRect.bottom - 1, _picRect.right, _picRect.bottom);
	Common::Rect leftRect(_picRect.left, _picRect.top, _picRect.left + 1, _picRect.bottom);
	Common::Rect rightRect(_picRect.right - 1, _picRect.top, _picRect.right, _picRect.bottom);
	uint32 msecCount = 0;

	while (upperRect.top < lowerRect.bottom) {
		copyRectToScreen(upperRect, blackoutFlag); upperRect.translate(0, 1); upperRect.left++; upperRect.right--;
		copyRectToScreen(lowerRect, blackoutFlag); lowerRect.translate(0, -1); lowerRect.left++; lowerRect.right--;
		copyRectToScreen(leftRect, blackoutFlag); leftRect.translate(1, 0);
		copyRectToScreen(rightRect, blackoutFlag); rightRect.translate(-1, 0);
		msecCount += 4;
		updateScreenAndWait(msecCount);
	}
}
コード例 #3
0
ファイル: ViewTaskResult.cpp プロジェクト: sio2project/oipres
void ViewTaskResult::paintEvent(QPaintEvent *paintEvent)
{
	QStyleOption option;
	option.init(this);
	QPainter painter(this);
	this->style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);

	QRect upperRect(0, 0, this->rect().width(), this->rect().height() / 2);
	QRect lowerRect(0, this->rect().height() / 2, this->rect().width(), this->rect().height() / 2);

	this->style()->drawItemText(&painter, upperRect, Qt::AlignVCenter | Qt::AlignHCenter, QPalette(), true, this->task->getName());

	QString resultString = "??";
	if(this->result != nullptr)
		resultString = QString::number(this->result->getResult());

	int maxPoints = 0;
	const Tests *tests = this->task->getTests();
	if(tests != nullptr)
		maxPoints = tests->getMaxPoints();
	
	this->style()->drawItemText(&painter, lowerRect, Qt::AlignVCenter | Qt::AlignHCenter, QPalette(), true, resultString + "/" + QString::number(maxPoints));
}
コード例 #4
0
void CTTCheckBtnGroup::DrawGradient(CDC* pDC, CRect rect)
{
	Color gdipBaseColor, gdipLightColor;

	COLORREF baseColor = m_ColorMap.GetColor(Press, BackgroundTopGradientStart);
	HLSColor hlsBaseColor = RgbToHls(baseColor);
	if (hlsBaseColor.L > 0.8)
	{
	
		COLORREF darkColor = GetLumColor(baseColor, -0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(darkColor);
	}
	else
	{
		COLORREF lightColor = GetLumColor(baseColor, 0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(lightColor);
	}	

	Graphics graphics(pDC->GetSafeHdc());
	graphics.SetSmoothingMode(SmoothingModeAntiAlias);
	graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);

	// Draw frag rectangle
	Rect boundsRect(rect.left, rect.top, rect.Width(), rect.Height());

	GraphicsPath path;
	GetRoundRectPath(&path, boundsRect, 8);
	
	Rect upperRect(boundsRect);
	upperRect.Height = boundsRect.Height / 2;

	Rect lowerRect(boundsRect);
	lowerRect.Y = upperRect.GetBottom() - 1;
	lowerRect.Height = boundsRect.Height - upperRect.Height;

	
	Rect upGradRect(upperRect);
	upGradRect.Inflate(0, 1);

	Rect loGradRect(lowerRect);
	loGradRect.Inflate(0, 1);

	LinearGradientBrush brush1(upGradRect, gdipLightColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);
	LinearGradientBrush brush2(loGradRect, gdipBaseColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);

	//SolidBrush brush(baseColor);

	//graphics.FillRectangle(&brush, upperRect);
	//graphics.FillPath(&brush1, &path);

	Region wholeRgn(&path);

	Region upperRgn(upperRect);
	upperRgn.Intersect(&wholeRgn);

	Region lowerRgn(lowerRect);
	lowerRgn.Intersect(&wholeRgn);

	graphics.FillRegion(&brush1, &upperRgn);
	graphics.FillRegion(&brush2, &lowerRgn);

	//SolidBrush brush(gdipFragColor);
	//graphics.FillPath(&brush, &path);
}