"testVisual":
{
"visualType":"IMAGE",
- "url":"0001.png"
+ "url":"0001.png",
+ "atlasing":true
},
"testVisual2":
{
"foregroundVisual":
{
"visualType":"IMAGE",
- "url":"theSameImage.png"
+ "url":"theSameImage.png",
+ "atlasing":true
},
"labelVisual":
{
"testVisual":
{
"visualType":"IMAGE",
- "url":"0002.png"
+ "url":"0002.png",
+ "atlasing":true
},
"testVisual2":
{
"foregroundVisual":
{
"visualType":"IMAGE",
- "url":"theSameImage.png"
+ "url":"theSameImage.png",
+ "atlasing":true
},
"labelVisual":
{
"testVisual":
{
"visualType":"IMAGE",
- "url":"0001.png"
+ "url":"0001.png",
+ "atlasing":true
},
"testVisual2":
{
"focusVisual":
{
"visualType":"IMAGE",
- "url": "focus.png"
+ "url": "focus.png",
+ "atlasing":true
}
},
"entryTransition":
#include <dali-toolkit-test-suite-utils.h>
#include <toolkit-event-thread-callback.h>
#include <dali-toolkit/devel-api/image-loader/image-atlas.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
+
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
+#include <dali-toolkit/dali-toolkit.h>
using namespace Dali;
using namespace Dali::Toolkit;
callStack.Reset();
callStack.Enable(true);
- ImageView imageView1 = ImageView::New( gImage_34_RGBA, ImageDimensions(34, 34) );
- ImageView imageView2 = ImageView::New( gImage_50_RGBA, ImageDimensions(50, 50) );
+ Property::Map imageMap1;
+
+ imageMap1[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+ imageMap1[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+ imageMap1[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
+ imageMap1[ DevelImageVisual::Property::ATLASING] = true;
+
+ Property::Map imageMap2;
+
+ imageMap2[ ImageVisual::Property::URL ] = gImage_50_RGBA;
+ imageMap2[ ImageVisual::Property::DESIRED_HEIGHT ] = 50;
+ imageMap2[ ImageVisual::Property::DESIRED_WIDTH ] = 50;
+ imageMap2[ DevelImageVisual::Property::ATLASING ] = true;
+
+ ImageView imageView1 = ImageView::New();
+ imageView1.SetProperty( ImageView::Property::IMAGE, imageMap1 );
+
+ ImageView imageView2 = ImageView::New();
+ imageView2.SetProperty( ImageView::Property::IMAGE, imageMap2 );
// ImageView doesn't do size negotiation properly: it only listens to OnSizeSet:
imageView1.SetSize( 100, 100 );
Stage::GetCurrent().Remove( imageView2 );
application.SendNotification();
application.Render(RENDER_FRAME_INTERVAL);
- ImageView imageView3 = ImageView::New( gImage_128_RGB, ImageDimensions(100, 100) );
+
+ Property::Map imageMap3;
+ imageMap3[ ImageVisual::Property::URL ] = gImage_128_RGB;
+ imageMap3[ ImageVisual::Property::DESIRED_HEIGHT ] = 100;
+ imageMap3[ ImageVisual::Property::DESIRED_WIDTH ] = 100;
+ imageMap3[ DevelImageVisual::Property::ATLASING ] = true;
+
+ ImageView imageView3 = ImageView::New();
+ imageView3.SetProperty( ImageView::Property::IMAGE, imageMap3 );
+
application.GetPlatform().SetClosestImageSize( Vector2(100, 100) );
Stage::GetCurrent().Add( imageView3 );
#include <dali-toolkit/dali-toolkit.h>
#include <dali/devel-api/scripting/scripting.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali/public-api/rendering/renderer.h>
#include <test-native-image.h>
callStack.Reset();
callStack.Enable(true);
- ImageView imageView = ImageView::New( gImage_34_RGBA, ImageDimensions( 34, 34 ) );
+ Property::Map imageMap;
+
+ imageMap[ ImageVisual::Property::URL ] = gImage_34_RGBA;
+ imageMap[ ImageVisual::Property::DESIRED_HEIGHT ] = 34;
+ imageMap[ ImageVisual::Property::DESIRED_WIDTH ] = 34;
+ imageMap[ DevelImageVisual::Property::ATLASING] = true;
+
+ ImageView imageView = ImageView::New();
+ imageView.SetProperty( ImageView::Property::IMAGE, imageMap );
// By default, Aysnc loading is used
// loading is not started if the actor is offStage
asyncLoadingMap[ "desiredHeight" ] = 34;
asyncLoadingMap[ "desiredWidth" ] = 34;
asyncLoadingMap[ "synchronousLoading" ] = false;
+ asyncLoadingMap[ "atlasing" ] = true;
ImageView imageView = ImageView::New();
imageView.SetProperty( ImageView::Property::IMAGE, asyncLoadingMap );
Property::Map syncLoadingMap;
syncLoadingMap[ ImageVisual::Property::SYNCHRONOUS_LOADING ] = true;
+ syncLoadingMap[ DevelImageVisual::Property::ATLASING ] = true;
// Sync loading, no atlasing for big size image
{
syncLoadingMap[ ImageVisual::Property::URL ] = gImage_600_RGB;
imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
+
// BitmapLoader is used, and the loading is started immediately even the actor is not on stage.
BitmapLoader loader = BitmapLoader::GetLatestCreated();
DALI_TEST_CHECK( loader );
syncLoadingMap[ "desiredHeight" ] = 34;
syncLoadingMap[ "desiredWidth" ] = 34;
syncLoadingMap[ "synchronousLoading" ] = true;
+ syncLoadingMap[ "atlasing" ] = true;
imageView.SetProperty( ImageView::Property::IMAGE, syncLoadingMap );
// loading is started even if the actor is offStage
propertyMap.Insert( ImageVisual::Property::PIXEL_AREA, pixelArea );
propertyMap.Insert( ImageVisual::Property::WRAP_MODE_U, WrapMode::MIRRORED_REPEAT );
propertyMap.Insert( ImageVisual::Property::WRAP_MODE_V, WrapMode::REPEAT );
+ propertyMap.Insert( DevelImageVisual::Property::ATLASING, true );
Visual::Base visual = factory.CreateVisual( propertyMap );
DALI_TEST_CHECK( visual );
* @note For N-Patch images only.
*/
BORDER = WRAP_MODE_V + 1,
+
+ /**
+ * @brief Whether to use the texture atlas
+ * @details Name "atlasing", type Property::BOOLEAN, true to enable texture atlas
+ *
+ * @note Optional. By default atlasing is off.
+ */
+
+ ATLASING = WRAP_MODE_V + 2,
};
} //namespace Property
// INTERNAL HEADERS
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/image-visual-properties-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
const char * const IMAGE_DESIRED_WIDTH( "desiredWidth" );
const char * const IMAGE_DESIRED_HEIGHT( "desiredHeight" );
const char * const SYNCHRONOUS_LOADING( "synchronousLoading" );
+const char * const IMAGE_ATLASING("atlasing");
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN( FITTING_MODE )
mFittingMode( fittingMode ),
mSamplingMode( samplingMode ),
mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT )
+ mWrapModeV( WrapMode::DEFAULT ),
+ mAttemptAtlasing( false )
{
}
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
mWrapModeU( WrapMode::DEFAULT ),
- mWrapModeV( WrapMode::DEFAULT )
+ mWrapModeV( WrapMode::DEFAULT ),
+ mAttemptAtlasing( false )
{
}
{
DoSetProperty( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, keyValue.second );
}
+ else if ( keyValue.first == IMAGE_ATLASING )
+ {
+ DoSetProperty( Toolkit::DevelImageVisual::Property::ATLASING, keyValue.second );
+ }
}
}
- if( mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING && mImageUrl.IsValid() )
+ if( ( mImpl->mFlags & Impl::IS_SYNCHRONOUS_RESOURCE_LOADING ) && mImageUrl.IsValid() )
{
// if sync loading is required, the loading should start
// immediately when new image url is set or the actor is off stage
mWrapModeV = Dali::WrapMode::Type( wrapMode );
break;
}
+
+ case Toolkit::DevelImageVisual::Property::ATLASING:
+ {
+ bool atlasing = false;
+ mAttemptAtlasing = value.Get( atlasing );
+ }
}
}
Vector4 atlasRect;
// texture set has to be created first as we need to know if atlasing succeeded or not
// when selecting the shader
- TextureSet textures = CreateTextureSet( atlasRect, IsSynchronousResourceLoading(), true );
+ TextureSet textures = CreateTextureSet( atlasRect, IsSynchronousResourceLoading(), mAttemptAtlasing );
CreateRenderer( textures );
if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) // the texture is packed inside atlas
map.Insert( Toolkit::ImageVisual::Property::PIXEL_AREA, mPixelArea );
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_U, mWrapModeU );
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
+
+ map.Insert( Toolkit::DevelImageVisual::Property::ATLASING, mAttemptAtlasing );
}
void ImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
Dali::WrapMode::Type mWrapModeU:3;
Dali::WrapMode::Type mWrapModeV:3;
+ bool mAttemptAtlasing:1; // If true will attempt atlasing, otherwise create unique texture
+
};
} // namespace Internal