// **************************************************************************** // // 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(); }
std::string ResourcePath::GetResourceFullPath(std::string resourceRelativePath) { std::string fullpath; filesystem::path bp(resourcePath); filesystem::path rPath(resourceRelativePath); try { // If the path is relative and includes the resources folder, // remove the resources folder from the path. if (*rPath.begin() == resourceFolder) { filesystem::path temp; for (filesystem::path::iterator it = (++rPath.begin()); it != rPath.end(); it++) { temp /= *it; } rPath = temp; } // Check if the path is already absolute if (rPath.has_root_directory()) { // incase there is some relative wackiness going on. fullpath = filesystem::canonical(rPath).generic_string(); } else { // Check if the path is a sub path under the resource folder. filesystem::path rFolder = bp / (*rPath.begin()); filesystem::path fPath = filesystem::complete(bp / rPath); if (filesystem::exists(rFolder)) { // build the final path fullpath = filesystem::complete(bp / rPath).generic_string(); //Log("ResourceManager", "Resolved Resource Path: " + fullpath ); } // Check if it's a file in the root resources folder else if ( filesystem::exists(fPath) ) { fullpath = fPath.generic_string(); } else { rPath = filesystem::complete(bp / rPath); Log("ResourcePath", "Error Resolving Resource Path. Path doesn't exist: " + rPath.generic_string()); //throw ResourcePathException(resourceRelativePath); } } } catch (boost::filesystem::filesystem_error e) { Log("ResourcePath", "Error Resolving Resource Path. Path doesn't exist: " + rPath.generic_string()); throw ResourcePathException(resourceRelativePath); } return fullpath; }