X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali%2Fpublic-api%2Fscripting%2Fscripting.cpp;h=031076b63ca428bbd8476ddd312245d471abafe6;hb=253a9b304346ea662033604f9db1542dd6cdbc66;hp=6eddb5c6406e99341f7524832b3c0211cff54588;hpb=bb1ebe64287de082ff40f43a2639a8251176edc4;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/scripting/scripting.cpp b/dali/public-api/scripting/scripting.cpp index 6eddb5c..031076b 100644 --- a/dali/public-api/scripting/scripting.cpp +++ b/dali/public-api/scripting/scripting.cpp @@ -301,11 +301,12 @@ Image NewImage( const Property::Value& map ) } field = "pixel-format"; + Pixel::Format pixelFormat = Pixel::RGBA8888; if( map.HasKey(field) ) { DALI_ASSERT_ALWAYS(map.GetValue(field).GetType() == Property::STRING && "Image release-policy property is not a string" ); std::string s(map.GetValue(field).Get()); - attributes.SetPixelFormat( GetEnumeration< Pixel::Format >( s.c_str(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT )); + pixelFormat = GetEnumeration< Pixel::Format >( s.c_str(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT ); } field = "scaling-mode"; @@ -322,19 +323,19 @@ Image NewImage( const Property::Value& map ) std::string s(map.GetValue("type").Get()); if("FrameBufferImage" == s) { - ret = Image( new Internal::FrameBufferImage(attributes.GetWidth(), - attributes.GetHeight(), - attributes.GetPixelFormat(), - releasePolicy) ); + ret = FrameBufferImage::New(attributes.GetWidth(), + attributes.GetHeight(), + pixelFormat, + releasePolicy); } else if("BitmapImage" == s) { - ret = Image( new Internal::BitmapImage(attributes.GetWidth(), - attributes.GetHeight(), - attributes.GetPixelFormat(), - releasePolicy) ); + ret = BitmapImage::New(attributes.GetWidth(), + attributes.GetHeight(), + pixelFormat, + releasePolicy); } - else if("Image" == s) + else if("Image" == s || "ResourceImage" == s) { ret = ResourceImage::New(filename, attributes, loadPolicy, releasePolicy); } @@ -540,9 +541,11 @@ void CreatePropertyMap( Image image, Property::Map& map ) std::string imageType( "ResourceImage" ); // Get Type - cannot use TypeRegistry as Image is not an Object and thus, not registered - if ( BitmapImage::DownCast( image ) ) + BitmapImage bitmapImage = BitmapImage::DownCast( image ); + if ( bitmapImage ) { imageType = "BitmapImage"; + map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( bitmapImage.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT ); } else if ( FrameBufferImage::DownCast( image ) ) { @@ -559,7 +562,6 @@ void CreatePropertyMap( Image image, Property::Map& map ) map[ "load-policy" ] = GetEnumerationName< ResourceImage::LoadPolicy >( resourceImage.GetLoadPolicy(), IMAGE_LOAD_POLICY_TABLE, IMAGE_LOAD_POLICY_TABLE_COUNT ); ImageAttributes attributes( resourceImage.GetAttributes() ); - map[ "pixel-format" ] = GetEnumerationName< Pixel::Format >( attributes.GetPixelFormat(), PIXEL_FORMAT_TABLE, PIXEL_FORMAT_TABLE_COUNT ); map[ "scaling-mode" ] = GetEnumerationName< ImageAttributes::ScalingMode >( attributes.GetScalingMode(), IMAGE_SCALING_MODE_TABLE, IMAGE_SCALING_MODE_TABLE_COUNT ); }