Exemple #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 );
		}
	}
Exemple #2
0
HRESULT RPathOutlineAttribImp::SetColor( const RColor& crColor )
{
	if (RColor::kSolid != crColor.GetFillMethod())
		return E_INVALIDARG;

	m_sOutlineFormat.m_yPenColor = crColor.GetSolidColor();
	m_pPathDocument->InvalidateAllViews();

	return S_OK;
}
//****************************************************************************
//
// Function Name: FillData
//
// Description:   Fills an HeadlineDataStruct with the Headline 
//						depth effect data
//
// Returns:       None
//
// Exceptions:	   None
//
//****************************************************************************
void RHeadlineDepthPage::FillData( RHeadlineInterface* pInterface, RComponentView* pComponentView )
{
	//
	// Set the depth effects
	//

	if (m_data.nDataType == kShadowType)
	{
		// Clear any depth effects
		pInterface->SetProjectionEffect( kNoProjection ) ;

		RSoftShadowSettings settings;

		settings.m_fShadowOn           = TRUE;
		settings.m_fShadowOpacity      = m_data.nOpacity / 100.0;
		settings.m_fShadowEdgeSoftness = m_data.nEdgeSoftness  / 100.0;
		settings.m_fShadowOffset       = m_data.nOffset / 65535.0;

		settings.m_fShadowAngle = -m_wndBlendAngle.GetAngle();
		settings.m_fShadowColor = m_btnColor.GetColor().GetSolidColor();
		pComponentView->SetShadowSettings( settings );
	}
	else
	{
		if (pComponentView->HasShadow())
		{
			// Clear any shadow settings
			RSoftShadowSettings settings;
			pComponentView->GetShadowSettings( settings );
			settings.m_fShadowOn = FALSE;

			pComponentView->SetShadowSettings( settings );
		}

		RIntPoint ptVanish(
			int(cos(m_angle) * m_data.nVanishPointX + 0.5),
			int(sin(m_angle) * m_data.nVanishPointY + 0.5) ) ;

		pInterface->SetNumStages( m_data.nNumStages ) ;
		pInterface->SetProjectionEffect( (EProjectionEffects) m_data.nSelProjection ) ;
		pInterface->SetProjectionDepth( m_data.flDepth ) ;
		pInterface->SetProjectionVanishPoint( ptVanish ) ;
		pInterface->SetProjectionFillColor( m_btnColor.GetColor() ) ;

		pInterface->SetShadowEffect( (EShadowEffects) m_data.nSelShadow ) ;
		pInterface->SetShadowDepth( m_data.flDepth ) ;
		pInterface->SetShadowVanishPoint( ptVanish ) ;
		pInterface->SetShadowFillColor( m_btnColor.GetColor() ) ;

		if (m_data.fBlend && m_data.nSelProjection > kNoProjection)
		{
	//		EFramedEffects eFrameEffect ;
	//		pInterface->GetBehindEffect( eFrameEffect ) ;

			RColor crBlendColor ;
			pInterface->GetBehindColor( crBlendColor ) ;

			if (RColor::kTransparent == crBlendColor.GetFillMethod())
			{
				crBlendColor = RSolidColor( kWhite ) ;
			}

			RSolidColor crBlendArray[] = 	{ 
				m_btnColor.GetColor().GetSolidColor(),
				crBlendColor.GetSolidColor() } ;

			crBlendColor = RColor( crBlendArray, 2, m_angle ) ;
			pInterface->SetProjectionFillColor( crBlendColor ) ;
		}
	}

	if (m_data.nSelProjection > kNoProjection || m_data.nDataType == kShadowType)
	{
		EOutlineEffects eOutlineEffect ;
		pInterface->GetOutlineEffect( eOutlineEffect ) ;

		//
		// The user selected a depth option which is mutually exclusive 
		// with the emboss and deboss outline options, so we need to clear 
		// the emboss/deboss option if it is set.
		//
		switch (eOutlineEffect)
		{
		case kEmbossedOutline: 
		case kDebossedOutline:
		case kBlurredOutline:
			{
//				RColor crBehindColor ;
//				pInterface->GetBehindColor( crBehindColor ) ;
//				EFramedEffects eFrameEffect = (RColor::kTransparent == 
//					crBehindColor.GetFillMethod() ? kFrameNoFrame : kSimpleFrame) ;

				// Clear the outline effect
				pInterface->SetOutlineEffect( kSimpleFill ) ;

				// Set the appropriate behind effect.
//				pInterface->SetBehindEffect( eFrameEffect ) ;
			}
		}
	}
}
//****************************************************************************
//
// Function Name: ApplyData
//
// Description:   Applies HeadlineDataStruct effect's data
//                to the Headline depth controls
//
// Returns:       None
//
// Exceptions:	   None
//
//****************************************************************************
void RHeadlineDepthPage::ApplyData( RHeadlineInterface* pInterface, RComponentView* pComponentView )
{
	// Set the effects data
	//////////////////////////

	EProjectionEffects eProjEffects ;
	EShadowEffects eShadowEffects ;
	RIntPoint ptVanish ;
	RColor crFillColor ;
	int nNumStages ;


	pInterface->GetNumStages( nNumStages ) ;
	pInterface->GetProjectionEffect( eProjEffects ) ;
	pInterface->GetProjectionDepth( m_data.flDepth ) ;
	pInterface->GetShadowEffect( eShadowEffects ) ;
	pInterface->GetProjectionFillColor( crFillColor ) ;
	pInterface->GetProjectionVanishPoint( ptVanish ) ;

	if (eShadowEffects > kNoShadow)
	{
		// Currently these options are shared, but in
		// pre-existing data they may not be.
		pInterface->GetShadowFillColor( crFillColor ) ;
		pInterface->GetShadowVanishPoint( ptVanish ) ;
	}

	if (pComponentView->HasShadow())
	{
		RSoftShadowSettings settings;
		pComponentView->GetShadowSettings( settings );

		m_data.nDataType      = kShadowType;
		m_data.nOpacity       = ::Round( settings.m_fShadowOpacity * 100 );
		m_data.nEdgeSoftness  = ::Round( settings.m_fShadowEdgeSoftness * 100 );
		m_data.nOffset        = ::Round( settings.m_fShadowOffset * 65535 );

		m_wndBlendAngle.SetAngle( -settings.m_fShadowAngle );
		m_angle = m_wndBlendAngle.GetAngle();

		m_btnColor.SetColor( RColor( settings.m_fShadowColor ) ) ;
	}
	else
	{
		m_data.nDataType      = kDepthType ;
		m_data.nNumStages     = nNumStages ;
		m_data.nSelProjection = eProjEffects ;
		m_data.nSelShadow     = eShadowEffects ;
		m_data.fBlend			 = sWORD( RColor::kGradient == crFillColor.GetFillMethod() ) ;

		m_wndBlendAngle.SetAngle( atan2( YRealDimension( ptVanish.m_y ), 
			YRealDimension( ptVanish.m_x ) ) ) ;

		m_btnColor.SetColor( RColor(crFillColor.GetSolidColor()) ) ;

		m_angle = m_wndBlendAngle.GetAngle()  ;

		YAngle angle = fmod((double)m_angle, (double)(2.0 * kPI));
		if (angle < 0.0) angle += 2.0 * kPI;
		const YRealDimension kAngleDelta = 0.00001;
		
		if (::AreFloatsEqual(angle, kPI / 2.0, kAngleDelta) || ::AreFloatsEqual(angle, 3.0 * kPI / 2.0, kAngleDelta))
			m_data.nVanishPointX = 0;
		else
			m_data.nVanishPointX = ptVanish.m_x / cos( m_angle ) ;
		
		if (::AreFloatsEqual(angle, 0.0, kAngleDelta) || ::AreFloatsEqual(angle, kPI, kAngleDelta))
			m_data.nVanishPointY = 0;
		else
			m_data.nVanishPointY = ptVanish.m_y / sin( m_angle ) ;

/*		if (m_data.nSelShadow > kNoShadow)
		{
			pInterface->GetShadowDepth( m_data.flDepth ) ;

			m_data.nDataType      = kShadowType;
			m_data.nOpacity       = 100;
			m_data.nEdgeSoftness  = 0;
			m_data.nOffset        = 10; // TODO: determine from vanishing point

			FillData( pInterface, pComponentView );
		}
*/	}


	if (GetSafeHwnd())
	{
		// Set the image selection
		EnumResourceNames( 
			AfxGetResourceHandle(),				// resource-module handling
			cResourceType,							// pointer to resource type 
			(ENUMRESNAMEPROC) SelectResItem,	// pointer to callback function 
			(LONG) this ) ; 						// application-defined parameter 

		m_btnColor.EnableWindow( m_gcImageList.GetCurSel() != 0 ) ;
	}
}