当前位置: 首页>>代码示例>>C++>>正文


C++ BitmapPtr::Get方法代码示例

本文整理汇总了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;
}
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-adaptor,代码行数:53,代码来源:image-loader.cpp

示例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;
}
开发者ID:tizenorg,项目名称:platform.core.uifw.dali-adaptor,代码行数:17,代码来源:image-loader.cpp


注:本文中的BitmapPtr::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。