Example #1
0
// ****************************************************************************
//
//  Function Name:	REditImageInterfaceImp::SetClippingPath( )
//
//  Description:		Sets the clipping path into the components
//                   image.
//
//  Returns:			
//
//  Exceptions:		
//
// ****************************************************************************
//
void REditImageInterfaceImp::SetClippingPath( const RClippingPath* path )
{
	// Get a pointer to the image document's image.  Note,
	// we should be able to assume that it is a RBitmapImage,
	// as this interface is only provided by image components
	// with RBitmapImages.
	RBitmapImage* pImage = dynamic_cast<RBitmapImage*>(
		m_pImageDocument->GetImage() );
	TpsAssert( pImage, "Invalid image component!" );

	if (path)
	{
		RClippingPath rPath( *path );
		m_pImageDocument->SetCropRectFromPath( &rPath, TRUE );
		pImage->SetRPath( &rPath );
	}
	else if (!pImage->PathFromImport())
	{
		m_pImageDocument->SetCropRectFromPath( NULL, FALSE );
		pImage->DeleteRPath();
	}

	else
		return;

	ApplyImageEffects();
}