Exemplo n.º 1
0
// ****************************************************************************
//
//  Function Name:	REditImageInterfaceImp::GetClippingPath( )
//
//  Description:		Returns the component image's clipping path
//                   (if any).
//
//  Returns:			
//
//  Exceptions:		
//
// ****************************************************************************
//
BOOLEAN REditImageInterfaceImp::GetClippingPath( RClippingPath& rPath )
{
	// Get a pointer to the image document's image.  Note,
	// normally we can assume that it is a RBitmapImage
	// as this interface is only provided by image components,
	// but if this is a placeholder from a layout there is no
	// RBitmapImage so just return FALSE in that case.
	RBitmapImage* pImage = dynamic_cast<RBitmapImage*>(
		m_pImageDocument->GetImage() );
	if (!pImage)
		return FALSE;

	rPath.Undefine();
	RClippingPath* pPath = pImage->GetClippingRPath();

	if (pPath)
	{
		const RImageEffects& rEffects = GetImageEffects();
		RRealSize rSize = RImageLibrary().GetImageDimensions(
			m_pImageDocument->m_rInternalDataBuffer );

		R2dTransform xform;
		xform.PostScale( rSize.m_dx, rSize.m_dy );
		RRealRect rRect( rEffects.m_rCropArea * xform );

		xform.MakeIdentity();
		xform.PostTranslate( rRect.m_Left, rSize.m_dy - rRect.m_Bottom - rRect.m_Top );
		rPath = RClippingPath( *pPath, xform );

		return TRUE;
	}

	return FALSE;
}
Exemplo n.º 2
0
RImage* QSLItemData::Load2(
	LPSTORAGE	pIStorage,			// @parm storage
	BOOL        fDescOnly )
{
	RImage* pImage = NULL;
	char	strDescription[kBufLength];

	TRY
	{
		COleStreamFile  str;

		if (!fDescOnly)
		{
			// open stream
			CString  szStream = "PREVIEW";

			if (str.OpenStream (pIStorage, szStream, CFile::modeRead | CFile::shareExclusive))
			{
				// Read in the image data
				RTempFileBuffer	buffer;
				buffer.Resize( str.GetLength() );
				str.Read( buffer.GetBuffer(), str.GetLength() );
				str.Close();

				// Create the image
				pImage = RImageLibrary().ImportImage( buffer );
			}
		}

		if (fDescOnly)
		{
			// open stream
			CString szStream = "DESCRIPTION";

			if (str.OpenStream (pIStorage, szStream, CFile::modeRead | CFile::shareExclusive))
			{
				str.Read (&strDescription, min( kBufLength, str.GetLength() ));
				str.Close();
			}

			// return bitmap handle and description string
			m_strDesc = strDescription;
		}

	} // End try

	CATCH(CArchiveException, archExcept)
	{
		//CBExceptionReporter::ArchiveException(archExcept);
	}
	END_CATCH


	return pImage;
}