本文整理汇总了C++中BitmapPtr::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapPtr::Get方法的具体用法?C++ BitmapPtr::Get怎么用?C++ BitmapPtr::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapPtr
的用法示例。
在下文中一共展示了BitmapPtr::Get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertStreamToBitmap
bool ConvertStreamToBitmap( const ResourceType& resourceType, std::string path, FILE * const fp, const ResourceLoadingClient& client, BitmapPtr& ptr )
{
DALI_LOG_TRACE_METHOD( gLogFilter );
DALI_ASSERT_DEBUG( ResourceBitmap == resourceType.id );
bool result = false;
BitmapPtr bitmap = 0;
if (fp != NULL)
{
LoadBitmapFunction function;
LoadBitmapHeaderFunction header;
Bitmap::Profile profile;
if ( GetBitmapLoaderFunctions( fp,
GetFormatHint( path ),
function,
header,
profile ) )
{
bitmap = Bitmap::New( profile, ResourcePolicy::OWNED_DISCARD );
DALI_LOG_SET_OBJECT_STRING( bitmap, path );
const BitmapResourceType& resType = static_cast<const BitmapResourceType&>( resourceType );
const ScalingParameters scalingParameters( resType.size, resType.scalingMode, resType.samplingMode );
const ImageLoader::Input input( fp, scalingParameters, resType.orientationCorrection );
// Check for cancellation now we have hit the filesystem, done some allocation, and burned some cycles:
// This won't do anything from synchronous API, it's only useful when called from another thread.
client.InterruptionPoint(); // Note: By design, this can throw an exception
// Run the image type decoder:
result = function( client, input, *bitmap );
if (!result)
{
DALI_LOG_WARNING( "Unable to convert %s\n", path.c_str() );
bitmap = 0;
}
// Apply the requested image attributes if not interrupted:
client.InterruptionPoint(); // Note: By design, this can throw an exception
bitmap = Internal::Platform::ApplyAttributesToBitmap( bitmap, resType.size, resType.scalingMode, resType.samplingMode );
}
else
{
DALI_LOG_WARNING( "Image Decoder for %s unavailable\n", path.c_str() );
}
}
ptr.Reset( bitmap.Get() );
return result;
}
示例2: LoadResourceSynchronously
ResourcePointer LoadResourceSynchronously( const Integration::ResourceType& resourceType, const std::string& resourcePath )
{
ResourcePointer resource;
BitmapPtr bitmap = 0;
Internal::Platform::FileCloser fc( resourcePath.c_str(), "rb");
FILE * const fp = fc.GetFile();
if( fp != NULL )
{
bool result = ConvertStreamToBitmap( resourceType, resourcePath, fp, StubbedResourceLoadingClient(), bitmap );
if( result && bitmap )
{
resource.Reset(bitmap.Get());
}
}
return resource;
}