예제 #1
0
//*****************************************************************************
//
// Function Name:  CHeadlineSheet::OnPaint
//
// Description:    WM_PAINT handler
//
// Returns:        VOID
//
// Exceptions:	   None
//
//*****************************************************************************
//
void CHeadlineSheet::OnPaint( )
	{
	PAINTSTRUCT ps;
	HDC hdc = ::BeginPaint( GetSafeHwnd( ), &ps );

	// Put it in a DcDrawingSurface
	RDcDrawingSurface drawingSurface;
	drawingSurface.Initialize( hdc );

	// Create a transform
	R2dTransform transform;

	// Scale to the device DPI
	RRealSize deviceDPI = drawingSurface.GetDPI( );
	transform.PreScale( (YFloatType)deviceDPI.m_dx / kSystemDPI, (YFloatType)deviceDPI.m_dy / kSystemDPI );

	// Get the preview rectangle
	RRealRect previewRect;
	GetPreviewRect( &previewRect );

	// Offset the transform by the top left corner of the preview rect
	transform.PreTranslate( previewRect.m_Left, previewRect.m_Top );

	// Render the preview headline
	m_pPreviewHeadline->Render( drawingSurface, transform, RRealRect( previewRect.WidthHeight( ) ), previewRect.WidthHeight( ) );

	drawingSurface.DetachDCs( );

	::EndPaint( GetSafeHwnd( ), &ps );
	}
예제 #2
0
// ****************************************************************************
//
//  Function Name:	RGraphicInterfaceImp::Render( )
//
//  Description:		Render the data in the view.
//
//  Returns:			Nothing
//
//  Exceptions:		kMemory
//
// ****************************************************************************
//
void RGraphicInterfaceImp::Render( RDrawingSurface& drawingSurface, const R2dTransform& transform,
										  const RIntRect& rcRender, const RIntRect& rcLocation )
{
	R2dTransform	graphicTransform	= transform;
	graphicTransform.PreTranslate( rcLocation.m_Left, rcLocation.m_Top );
	TpsAssert( m_pGraphic != NULL, "Render called with NULL graphic" );
	m_pGraphic->Render( drawingSurface, rcLocation.WidthHeight(), graphicTransform, rcRender, m_pGraphic->GetMonochromeColor(), FALSE );
}
예제 #3
0
// ****************************************************************************
//
// Function Name:			RPsd3RuledLineGraphic::RenderRightCap()
//
// Description:			Draws the right cap of the Ruled Line
//
// Returns:					Nothing
//
// Exceptions:				None
//
// ****************************************************************************
void RPsd3RuledLineGraphic::RenderRightCap(RDrawingSurface* pDS, RPath* pPath, const RRealSize& rLineSize, const R2dTransform& rTransform, const RIntRect& rRender, const RColor& rMonoColor) const
{
	if (m_pRightCap)	
	{
		// The right cap exists, so render it
		RRealSize rRightCapSize;
		rRightCapSize.m_dy = rLineSize.m_dy;
		rRightCapSize.m_dx = rLineSize.m_dy * m_pRightCap->GetAspectRatio();

		//	If the line is real small AND the line is not that large, make sure we don't overwrite ourselves
		if ( rRightCapSize.m_dx > (rLineSize.m_dx / 2.0))
			rRightCapSize.m_dx	= rLineSize.m_dx / 2.0;

		R2dTransform rRightCapTransform = rTransform;
		rRightCapTransform.PreTranslate((YRealDimension)(rLineSize.m_dx - rRightCapSize.m_dx), 0.0);
		
		if (pDS) m_pRightCap->Render(*pDS, rRightCapSize, rRightCapTransform, rRender, rMonoColor);
		if (pPath) m_pRightCap->GetOutlinePath(*pPath, rRightCapSize, rRightCapTransform);
	}
	else if (m_fMirrorCaps)
	{
		// The right cap does not exist, so render a mirror image of m_pLeftCap
		RRealSize rLeftCapSize;
		rLeftCapSize.m_dy = rLineSize.m_dy;
		rLeftCapSize.m_dx = rLineSize.m_dy * m_pLeftCap->GetAspectRatio();

		//	If the line is real small AND the line is not that large, make sure we don't overwrite ourselves
		if ( rLeftCapSize.m_dx > (rLineSize.m_dx / 2.0))
			rLeftCapSize.m_dx	= rLineSize.m_dx / 2.0;

		R2dTransform rLeftCapTransform = rTransform;
		rLeftCapTransform.PreTranslate((YRealDimension)rLineSize.m_dx, 0.0);
		rLeftCapTransform.PreScale(-1.0, 1.0);
		
		if (pDS) m_pLeftCap->Render(*pDS, rLeftCapSize, rLeftCapTransform, rRender, rMonoColor);
		if (pPath) m_pLeftCap->GetOutlinePath(*pPath, rLeftCapSize, rLeftCapTransform);
	}
	else
	{
		// Do not render either the right cap or a mirror image of m_pLeftCap
		return;
	}
}
예제 #4
0
// ****************************************************************************
//
// Function Name:			RPsd3RuledLineGraphic::Render()
//
// Description:			Draws the RuledLine
//
// Returns:					Nothing
//
// Exceptions:				None
//
// ****************************************************************************
void RPsd3RuledLineGraphic::Render(RDrawingSurface& rDrawingSurface, const RRealSize& rSize, const R2dTransform& rTransform, const RIntRect& rRender, const RColor& rMonoColor, BOOLEAN)
{
	R2dTransform rLineTransform = rTransform;
	RRealSize rLineSize = rSize;
	if (!m_fHorizontal)
	{
		rLineSize.m_dx = rSize.m_dy;
		rLineSize.m_dy = rSize.m_dx;
		rLineTransform.PreRotateAboutOrigin(::DegreesToRadians(-90.0));
		rLineTransform.PreTranslate(0.0, -rLineSize.m_dy);		
	}

	Render(&rDrawingSurface, NULL, rLineSize, rLineTransform, rRender, rMonoColor);
}
예제 #5
0
// ****************************************************************************
//
//  Function Name:	RComponentView::ApplyTransform( )
//
//  Description:		Adds this views transform operations to the given
//							transform.
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RWindowView::ApplyTransform( R2dTransform& transform, BOOLEAN, BOOLEAN fIsPrinting ) const
	{
	// If we are not printing, apply a translation to account for scrolling
	if( !fIsPrinting && m_pHorizontalScrollBar )
		{
		// Get the amount we are scrolled in device units
		RRealSize scrollAmount( -m_pHorizontalScrollBar->GetPosition( ), -m_pVerticalScrollBar->GetPosition( ) );

		// Convert it to logical units
		::DeviceUnitsToLogicalUnits( scrollAmount, *this );

		// Apply the translate
		transform.PreTranslate( scrollAmount.m_dx, scrollAmount.m_dy );
		}
	}
예제 #6
0
// ****************************************************************************
//
// Function Name:		RPsd3RuledLineGraphic::GetOutlinePath( )
//
// Description:		Compute and return the path the encompases the path of this graphic
//
// Returns:				nothing
//
// Exceptions:			None
//
// ****************************************************************************
//
BOOLEAN RPsd3RuledLineGraphic::GetOutlinePath( RPath& path, const RRealSize& size, const R2dTransform& transform )
{	
	R2dTransform rLineTransform = transform;
	RRealSize rLineSize = size;
	if (!m_fHorizontal)
	{
		rLineSize.m_dx = size.m_dy;
		rLineSize.m_dy = size.m_dx;
		rLineTransform.PreRotateAboutOrigin(::DegreesToRadians(-90.0));
		rLineTransform.PreTranslate(0.0, -rLineSize.m_dy);		
	}

	Render( NULL, &path, rLineSize, rLineTransform, RIntRect(0,0,0,0), RColor(kBlack) );
	return TRUE;
}
예제 #7
0
// ****************************************************************************
//
// Function Name:			RPsd3VerticalBannerGraphic::Render()
//
// Description:			Draws the Backdrop
//
// Returns:					Nothing
//
// Exceptions:				None
//
// ****************************************************************************
void RPsd3VerticalBannerGraphic::Render(RDrawingSurface& rDrawingSurface, const RRealSize& rSize, const R2dTransform& rTransform, const RIntRect& rRender, const RColor& rMonoColor, BOOLEAN)
{
	// Compute the sizes of the elements
	RRealSize rTopCapSize = ::GetYSize(m_pTopCap, rSize.m_dx);
	RRealSize rBottomCapSize = (m_fMirrorCaps) ? ::GetYSize(m_pTopCap, rSize.m_dx) : ::GetXSize(m_pBottomCap, rSize.m_dx);
	RRealSize rLeftRailSize = ::GetYSize(m_pLeftRail, rSize.m_dx / 2.0);
	RRealSize rRightRailSize = ::GetYSize(m_pRightRail, rSize.m_dx / 2.0);

	R2dTransform rGraphicTransform;	
	
	// Left cap
	rGraphicTransform = rTransform;
	if (m_pTopCap) m_pTopCap->Render(rDrawingSurface, rTopCapSize, rGraphicTransform, rRender, rMonoColor);

	
	// Right cap
	rGraphicTransform = rTransform;
	::FlipY(rSize, rGraphicTransform);
	if (m_fMirrorCaps)
	{
		// Render the mirrored left cap as the right cap
		if (m_pTopCap) m_pTopCap->Render(rDrawingSurface, rTopCapSize, rGraphicTransform, rRender, rMonoColor);
	}
	else
	{
		// Render the right cap
		::FlipY(rBottomCapSize, rGraphicTransform);
		if (m_pBottomCap) m_pBottomCap->Render(rDrawingSurface, rBottomCapSize, rGraphicTransform, rRender, rMonoColor);
	}

	
	// Rails
	YRealDimension yVariableLength = rSize.m_dy - rTopCapSize.m_dy - rBottomCapSize.m_dy;
	uLONG uRailCount = 0;
	uLONG uRail = 0;

	// Top rails
	uRailCount = ::GetRailCount(yVariableLength, rLeftRailSize.m_dy);
	if (uRailCount > 0)
	{
		// Adjust the top rail size
		rLeftRailSize.m_dy = yVariableLength / (YFloatType)uRailCount;
		
		rGraphicTransform = rTransform;
		rGraphicTransform.PreTranslate(0.0, rTopCapSize.m_dy);
		for (uRail = 0; uRail < uRailCount; uRail++)
		{
			if (m_pLeftRail) m_pLeftRail->Render(rDrawingSurface, rLeftRailSize, rGraphicTransform, rRender, rMonoColor);
			rGraphicTransform.PreTranslate(0.0, rLeftRailSize.m_dy);
		}
	}

	// Bottom rails	
	uRailCount = ::GetRailCount(yVariableLength, rRightRailSize.m_dy);
	if (uRailCount > 0)
	{
		// Adjust the bottom rail size
		rRightRailSize.m_dy = yVariableLength / (YFloatType)uRailCount;

		rGraphicTransform = rTransform;
		rGraphicTransform.PreTranslate(rSize.m_dx / 2.0, rTopCapSize.m_dy);
		for (uRail = 0; uRail < uRailCount; uRail++)
		{
			if (m_pRightRail) m_pRightRail->Render(rDrawingSurface, rRightRailSize, rGraphicTransform, rRender, rMonoColor);
			rGraphicTransform.PreTranslate(0.0, rRightRailSize.m_dy);
		}
	}
}