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


C++ View::GetScaledPixelWidth方法代码示例

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


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

示例1: Initialise

/********************************************************************************************
>	virtual BOOL ConcurrentRenderer::Initialise(
					GRenderRegion* pActiveRR,
					double ResFactor,
					DocRect AreaOfDocumentToRender,
					UINT32 bpp,
					BOOL NeedsTransp
			)
	Author:		Ilan_Copelyn (Xara Group Ltd) <[email protected]>
	Created:	5/06/2000
	Purpose:	
	SeeAlso:	
 ********************************************************************************************/
BOOL ConcurrentRenderer::Initialise(
					GRenderRegion* pActiveRR,
					double ResFactor,
					DocRect AreaOfDocumentToRender,
					UINT32 bpp,
					BOOL NeedsTransp
			)
{
	// if we have no source render-region, then we need to manufacture a rendering matrix
	// for ourself.
	// to generate our render-matrix, we use the current view and spread, together with
	// a user-specified dpi value.
	Matrix	SourceMat;
	if (pActiveRR == NULL)
	{
		View* pView = View::GetCurrent();
		if (pView == NULL)
			return FALSE;

		double PixelsPerInch = pView->GetConvertToEditableShapesDPI();

		Spread* pSpread = Document::GetSelectedSpread();
		if (pSpread == NULL)
			return FALSE;

		FIXED16			ViewPixelWidth	= pView->GetScaledPixelWidth();
		const double	AppPixelWidth	= MILLIPOINTS_PER_INCH / (double)PixelsPerInch;
		double ViewScaleFactor = ViewPixelWidth.MakeDouble() / AppPixelWidth;

		SourceMat = pView->ConstructScaledRenderingMatrix(pSpread, ViewScaleFactor);
	}

	// we have a source render-region, so get its matrix and scale up ResFactor
	// so that our offscreen RR would effectively have the same scaled pixel width
	// as its source render-region (not taking into account the original value of ResFactor).
	else
	{
		SourceMat = pActiveRR->GetMatrix();
		const double ActualPixelWidth = (double)pActiveRR->GetPixelWidth();
		const double DefPixelWidth = MILLIPOINTS_PER_INCH / (double)GRenderRegion::GetDefaultDPI();
		ResFactor *= DefPixelWidth / ActualPixelWidth;
	}

//	m_pView = pActiveRR->GetRenderView();
//	m_pView = View::GetCurrent();
//	if (m_pView)
//	{
//		TRACEUSER( "Gerry", _T("Forcing default context\n"));
//		m_bOldForce = m_pView->SetForceDefaultColourContexts();
//	}

	m_pNewGD = new GDrawAsm;
	if (m_pNewGD && m_pNewGD->Init())
	{
		// Save current device context
		m_pOldGD = GRenderRegion::SetTempDrawContext(m_pNewGD);
//		m_pOldGD = GRenderRegion::GetStaticDrawContext();
//		GRenderRegion::GD = pGDAsm;
	}

	// Setup a new GRenderDIB (NB also initialises memory).
	m_pNewRR = CreateGRenderDIB(ResFactor, AreaOfDocumentToRender, bpp, NeedsTransp, &SourceMat);
	if (m_pNewRR != NULL)
	{
		return TRUE;
	}

	// If we get here then we have failed so clean up and return false
	delete m_pNewGD;
	m_pNewGD = NULL;
	GRenderRegion::SetTempDrawContext(m_pOldGD);
	m_pOldGD = NULL;
	return FALSE;
}
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:87,代码来源:offscrn.cpp


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