コード例 #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();
}
コード例 #2
0
// ****************************************************************************
//
//  Function Name:	RImageInterfaceImp::GetImage( )
//
//  Description:		Gets the image of a component
//
//  Returns:			the components image
//
//  Exceptions:		None
//
// ****************************************************************************
//
RImage* RImageInterfaceImp::CopySourceImage()
{
	RImageLibrary rLibrary;
	RImage* pImage = rLibrary.ImportImage( m_pImageDocument->m_rInternalDataBuffer );

	RBitmapImage* pBitmap = dynamic_cast<RBitmapImage*>( pImage );

	if (pBitmap)
	{
		REditImageInterfaceImp rInterface( (RImageView *)
			m_pImageDocument->GetActiveView() );

		RClippingPath rPath;
		rInterface.GetClippingPath( rPath );
		pBitmap->SetRPath( &rPath );
	}

	return pImage;
}