本文整理汇总了C++中ImageAttributes::SetPixelFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageAttributes::SetPixelFormat方法的具体用法?C++ ImageAttributes::SetPixelFormat怎么用?C++ ImageAttributes::SetPixelFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageAttributes
的用法示例。
在下文中一共展示了ImageAttributes::SetPixelFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UtcDaliScriptingCreatePropertyMapImage
int UtcDaliScriptingCreatePropertyMapImage(void)
{
TestApplication application;
// Empty
{
Image image;
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( map.empty() );
}
// Default
{
Image image = Image::New( "MY_PATH" );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "filename" ) );
DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "load-policy") );
DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "IMMEDIATE", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "release-policy") );
DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "NEVER", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "pixel-format") );
DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "RGBA8888", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "SHRINK_TO_FIT", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "crop" ) );
DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.0f, 0.0f, 1.0f, 1.0f ), TEST_LOCATION );
DALI_TEST_CHECK( !value.HasKey( "width" ) );
DALI_TEST_CHECK( !value.HasKey( "height" ) );
}
// Change values
{
ImageAttributes attributes;
attributes.SetPixelFormat( Pixel::A8 );
attributes.SetScalingMode( ImageAttributes::FitWidth );
attributes.SetCrop( Rect< float >( 0.5f, 0.2f, 0.2f, 0.4f ) );
attributes.SetSize( 300, 400 );
Image image = Image::New( "MY_PATH", attributes, Image::OnDemand, Image::Unused );
Property::Map map;
CreatePropertyMap( image, map );
DALI_TEST_CHECK( !map.empty() );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "Image", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "filename" ) );
DALI_TEST_EQUALS( value.GetValue( "filename" ).Get< std::string >(), "MY_PATH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "load-policy") );
DALI_TEST_EQUALS( value.GetValue( "load-policy" ).Get< std::string >(), "ON_DEMAND", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "release-policy") );
DALI_TEST_EQUALS( value.GetValue( "release-policy" ).Get< std::string >(), "UNUSED", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "pixel-format") );
DALI_TEST_EQUALS( value.GetValue( "pixel-format" ).Get< std::string >(), "A8", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "scaling-mode") );
DALI_TEST_EQUALS( value.GetValue( "scaling-mode" ).Get< std::string >(), "FIT_WIDTH", TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "crop" ) );
DALI_TEST_EQUALS( value.GetValue( "crop" ).Get< Vector4 >(), Vector4( 0.5f, 0.2f, 0.2f, 0.4f ), TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "width" ) );
DALI_TEST_EQUALS( value.GetValue( "width" ).Get< int >(), 300, TEST_LOCATION );
DALI_TEST_CHECK( value.HasKey( "height" ) );
DALI_TEST_EQUALS( value.GetValue( "height" ).Get< int >(), 400, TEST_LOCATION );
}
// BitmapImage
{
Image image = BitmapImage::New( 200, 300, Pixel::RGBA8888 );
Property::Map map;
CreatePropertyMap( image, map );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "BitmapImage", TEST_LOCATION );
}
// FrameBufferImage
{
Image image = FrameBufferImage::New( 200, 300, Pixel::RGBA8888 );
Property::Map map;
CreatePropertyMap( image, map );
Property::Value value( map );
DALI_TEST_CHECK( value.HasKey( "type" ) );
DALI_TEST_EQUALS( value.GetValue( "type" ).Get< std::string >(), "FrameBufferImage", TEST_LOCATION );
}
END_TEST;
}