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


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

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


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

示例2: CreateGRenderDIB

/********************************************************************************************
>	static GRenderDIB* QuickRenderer::CreateGRenderDIB(
					double ResFactor,
					DocRect AreaOfDocumentToRender,
					UINT32 bpp,
					BOOL NeedsTransp,
					Matrix* pSourceMat)
	Author:		Ilan_Copelyn (Xara Group Ltd) <[email protected]>
	Created:	5/06/2000
	Purpose:	Create and start a GRenderDIB ready for rendering
	SeeAlso:	
	Errors:		Returns NULL if unable to alloc mem for bitmaps in StartRender()
 ********************************************************************************************/
GRenderDIB* QuickRenderer::CreateGRenderDIB(
					double ResFactor,
					DocRect AreaOfDocumentToRender,
					UINT32 bpp,
					BOOL NeedsTransp,
					Matrix* pSourceMat)
{
	/////////////////////////////////////////////////////////////////////////////////////////////
	//								Setup a new GRenderDIB
	/////////////////////////////////////////////////////////////////////////////////////////////
	GRenderDIB* pNewGRR=NULL;
	BOOL DoWantBMPSmoothing = FALSE;
	BOOL ok;

	// Setup new GRenderDIB based on current Screen resolution and ResFactor multiplier
	View* pView = View::GetCurrent();

	// get the top spread
	Spread* pSpread = Document::GetSelectedSpread();

	// if we've been passed a source matrix, then we'll scale it up by ResFactor and use that.
// DEBUG:
	// Note that we currently check whether the view is for printing, solely so that this code
	// can live on the net without breaking printing of shadows more than it already is.
	Matrix Mat;
	if (pSourceMat != NULL)
	{
		FIXED16 Scale;
		DocCoord dcTrans;

		pSourceMat->Decompose(&Scale, NULL, NULL, NULL, &dcTrans);

		// Karim 04/09/2000
		// BODGE, to cope with printing reflected images.
		// If the given matrix contains a reflection, then its determinant < 0.
		// If this is so, then we'll scale the matrix by -1, which corrects the output.
		if (pSourceMat->Det() < 0.0)
			Scale *= FIXED16(-1);

		Mat = Matrix(Scale * FIXED16(ResFactor), Scale * FIXED16(ResFactor));
		Mat.SetTranslation(dcTrans);

//		Mat *= *pSourceMat;
	}

	// otherwise, we'll use the view's settings, scaled up by ResFactor.
	else
	{
		Mat = pView->ConstructScaledRenderingMatrix(pSpread, ResFactor);
	}

	// get the scale factor out of the matrix.
	FIXED16 Scale;
	Mat.Decompose(&Scale);

	//	double dpi = Scale.MakeDouble() * PIXELS_PER_INCH;
	double dpi = 0.0;	// use screen dpi (ie PIXELS_PER_INCH)

	// Create a new GRenderDIB region
	pNewGRR = new GRenderDIB(AreaOfDocumentToRender, Mat, Scale, bpp, dpi);
	ERROR2IF(pNewGRR == NULL,FALSE,"Failed to create a GRenderDIB!");

	// Ensure bmp mem is not allocated from limited memory
	NewWrappedRRCreated((GRenderRegion*) pNewGRR);

	// State flags + pixel width calculations
	if(!pNewGRR->AttachDevice(pView, NULL, pSpread))		// view and spread from previous RR rather than Current - nb in create bitmap copy case
	{
		ERROR3("Cannot attach devices");
		
		delete pNewGRR;
		pNewGRR = NULL;
		return NULL;
	}

	pNewGRR->m_DoCompression = NeedsTransp;
	
	ok = pNewGRR->InitDevice();
	if (!ok)
	{
		delete pNewGRR;
		pNewGRR = NULL;
		return NULL;
	}
	pNewGRR->InitAttributes();
	pNewGRR->RRQuality.SetQuality(QUALITY_MAX);
	pNewGRR->SetQualityLevel();
//.........这里部分代码省略.........
开发者ID:Amadiro,项目名称:xara-cairo,代码行数:101,代码来源:offscrn.cpp


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