Example #1
0
// ****************************************************************************
//
//  Function Name:	RWindowView::RWindowView( )
//
//  Description:		Render this views background
//
//  Returns:			Nothing
//
//  Exceptions:		None
//
// ****************************************************************************
//
void RWindowView::RenderBackground( RDrawingSurface& drawingSurface, const R2dTransform&, const RIntRect& rcRender ) const
	{
	// Fill in the background
	if( !drawingSurface.IsPrinting( ) )
		{
		RColor	backgroundColor	= GetBackgroundColor( );
		if ( backgroundColor.GetFillMethod() == RColor::kSolid )
			{
			RSolidColor	solid	= backgroundColor.GetSolidColor( );
			//	Check for something close to TRUE GRAY and alter it slightly
#ifdef _WINDOWS
			const YColorComponent	kHitBits			= 0xC0;
			const YColorComponent	kNewColor		= 0x77;
			const YColorComponent	kGrayColor		= 0x80;
#elif	defined( MAC )
			const YColorComponent	kHitBits			= 0xF000;
			const YColorComponent	kNewColor		= 0x7777;
			const YColorComponent	kGrayColor		= 0x8000;
#endif	//	_WINDOWS or MAC
			YColorComponent	redColor		= (solid.GetRed( ) & kHitBits);
			YColorComponent	greenColor	= (solid.GetGreen( ) & kHitBits);
			YColorComponent	blueColor	= (solid.GetBlue( ) & kHitBits);
			if ( (kGrayColor == redColor) && (redColor == greenColor) && (greenColor == blueColor) )
				{
				backgroundColor = RSolidColor( kNewColor, kNewColor, kNewColor );
				}
			}
		drawingSurface.SetForegroundMode( kNormal );
		drawingSurface.SetFillColor( backgroundColor );
		drawingSurface.FillRectangle( rcRender );
		}
	}
Example #2
0
// ****************************************************************************
//
//  Function Name:	RCompositeSelection::Render( )
//
//  Description:		Draws the selection rect and handles
//
//  Returns:			Nothing
//
//  Exceptions:		Memory
//
// ****************************************************************************
//
void RCompositeSelection::Render( RDrawingSurface& drawingSurface, const R2dTransform& transform, const RIntRect& rcRender, BOOLEAN fRenderIfLocked ) const
{
    // Only do if the selection is visible or we have a deferred render pending
    if( !m_fSelectionHidden && m_fSelectionVisible )
    {
        // Dont bother rendering if there are no selected objects
        if( m_SelectionCollection.Count( ) != 0 )
        {
            drawingSurface.RestoreDefaults( );

            // Setup the drawing surface for rendering feedback
            RSolidColor color;
            YDrawMode drawMode;
            m_pView->GetFeedbackSettings( color, drawMode );
            drawingSurface.SetForegroundMode( drawMode );
            drawingSurface.SetPenColor( color );
            drawingSurface.SetFillColor( color );

            // Go through our selection collection and render each selection
            YSelectionCollectionIterator iterator = m_SelectionCollection.Start( );
            for( ; iterator != m_SelectionCollection.End( ); ++iterator )
                ( *iterator )->Render( drawingSurface, transform, rcRender, fRenderIfLocked );
        }
    }
}
Example #3
0
void	RRotateDialog::RotateDisplay( int iPos )
{
	if ( iPos == m_iPrevPos )
		return;

	// We need to use the RBitmap::Rotate() function, so to do that, convert to
	// Renaissance types.
	CClientDC			clientDC( &m_staticDisplay );
	HDC					hClientDC = clientDC.GetSafeHdc();

	RDcDrawingSurface	drawSurface;
	drawSurface.Initialize( hClientDC, hClientDC );

	R2dTransform transform;

	// Prepare the image on an offscreen DC
	RAutoDrawingSurface	drawSurfaceOffscreen;
	RRealRect				rRealStaticRect(m_rectStaticDisplay);
	BOOLEAN					fPrepared = drawSurfaceOffscreen.Prepare( &drawSurface, transform, rRealStaticRect );
	RDrawingSurface*		pSurface	= ( (fPrepared)? &drawSurfaceOffscreen : &drawSurface );

	// Paint the offscreen DC white
	RColor rColor = RSolidColor( kWhite );
	pSurface->SetFillColor( rColor );
	pSurface->SetPenColor( rColor );
	pSurface->FillRectangle( m_rectStaticDisplay );

	YAngle	flRadiansRotation = ::DegreesToRadians( YFloatType( iPos ) );

	// The rotation leaves a black background, so blit with a mask.  The mask
	// has to be created the same size as the original (not rotated) bitmap
	// size, so create it and then rotate it.
	RBitmapImage		bmpRotated;
	RBitmapImage		bmpMaskRotated;
	RImageLibrary rLibrary;
	rLibrary.Rotate( m_rBitmapImage, bmpRotated, bmpMaskRotated, flRadiansRotation );

	RIntSize				sizeBmpRotated;
	sizeBmpRotated.m_dx = bmpRotated.GetWidthInPixels();
	sizeBmpRotated.m_dy = bmpRotated.GetHeightInPixels();

	RIntRect				rectSource;
	RIntRect				rectDest;
	DeriveSourceAndDestinationRects( sizeBmpRotated, rectSource, rectDest );

	bmpRotated.RenderWithMask( *pSurface, bmpMaskRotated, rectSource, rectDest );

	if ( fPrepared )
		drawSurfaceOffscreen.Release();
	drawSurface.DetachDCs();

	m_iPrevPos = iPos;
}
Example #4
0
// ****************************************************************************
//
//  Function Name:	RCompositeSelection::SetupRender( )
//
//  Description:		Prepares the given drawing surface and transform for
//							rendering.
//
//  Returns:			Nothing
//
//  Exceptions:		Memory
//
// ****************************************************************************
//
void RCompositeSelection::SetupRender( RDrawingSurface& drawingSurface, R2dTransform& transform ) const
{
    drawingSurface.RestoreDefaults( );

    // Setup the drawing surface for rendering feedback
    RSolidColor color;
    YDrawMode drawMode;
    m_pView->GetFeedbackSettings( color, drawMode );
    drawingSurface.SetForegroundMode( drawMode );
    drawingSurface.SetPenColor( color );
    drawingSurface.SetFillColor( color );

    m_pView->GetViewTransform( transform, drawingSurface, TRUE );
    //
    //	We can't set the clipping here for the components could
    //	lie outside of the view bounds
    //m_pView->SetClipRegion( drawingSurface, transform );
}