);
}
+BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new BorderVisual( factoryCache );
+}
+
BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mBorderColor( Color::TRANSPARENT ),
// EXTERNAL INCLUDES
#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Internal
{
+class BorderVisual;
+typedef IntrusivePtr< BorderVisual > BorderVisualPtr;
+
/**
* The visual which renders a solid color to the control's quad border fixed to a specified size.
*
* | borderSize | FLOAT |
* | antiAliasing | BOOLEAN |
*/
-
class BorderVisual : public Visual::Base
{
public:
/**
+ * @brief Create a new border visual.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static BorderVisualPtr New( VisualFactoryCache& factoryCache );
+
+protected:
+
+ /**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
virtual ~BorderVisual();
-protected:
-
/**
* @copydoc Visual::Base::DoInitialize
*/
);
}
+ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new ColorVisual( factoryCache );
+}
+
ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mMixColorIndex( Property::INVALID_INDEX )
#define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Internal
{
+class ColorVisual;
+typedef IntrusivePtr< ColorVisual > ColorVisualPtr;
+
/**
* The visual which renders a solid color to the control's quad
*
public:
/**
- * @brief Constructor.
+ * @brief Create a new color visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- ColorVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- virtual ~ColorVisual();
+ static ColorVisualPtr New( VisualFactoryCache& factoryCache );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ ColorVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~ColorVisual();
+
+ /**
* @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
} // unnamed namespace
+GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new GradientVisual( factoryCache );
+}
GradientVisual::GradientVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
#define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/gradient/gradient.h>
{
class Gradient;
+class GradientVisual;
+typedef IntrusivePtr< GradientVisual > GradientVisualPtr;
/**
* The visual which renders smooth transition of colors to the control's quad.
};
/**
- * @brief Constructor.
+ * @brief Create a new gradient visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- GradientVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~GradientVisual();
+ static GradientVisualPtr New( VisualFactoryCache& factoryCache );
public: // from Visual
virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
protected:
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ GradientVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~GradientVisual();
+
/**
* @copydoc Visual::Base::DoInitialize
*/
}\n
);
-} //unnamed namespace
+} // unnamed namespace
+
+BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new BatchImageVisual( factoryCache );
+}
BatchImageVisual::BatchImageVisual( VisualFactoryCache& factoryCache )
- : Visual::Base( factoryCache ),
- mDesiredSize()
+: Visual::Base( factoryCache ),
+ mDesiredSize()
{
}
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
// INTERNAL HEADER
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
-// EXTERNAL INCLUDES
-#include <dali/public-api/images/resource-image.h>
-
namespace Dali
{
namespace Toolkit
namespace Internal
{
+class BatchImageVisual;
+typedef IntrusivePtr< BatchImageVisual > BatchImageVisualPtr;
+
class BatchImageVisual: public Visual::Base, public ConnectionTracker
{
public:
/**
- * @brief Constructor.
+ * @brief Create a new batch-image visual.
*
- * @param[in] factoryCache The VisualFactoryCache object
- */
- BatchImageVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- ~BatchImageVisual();
+ static BatchImageVisualPtr New( VisualFactoryCache& factoryCache );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache The VisualFactoryCache object
+ */
+ BatchImageVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ ~BatchImageVisual();
+
+ /**
* @copydoc Visua::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
*/
// CLASS HEADER
-#include "image-visual.h"
+#include <dali-toolkit/internal/visuals/image/image-visual.h>
// EXTERNAL HEADER
#include <cstring> // for strncasecmp
return geometry;
}
-} //unnamed namespace
+} // unnamed namespace
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new ImageVisual( factoryCache );
+}
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode )
+{
+ return new ImageVisual( factoryCache, imageUrl, size, fittingMode, samplingMode );
+}
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, const Image& image )
+{
+ return new ImageVisual( factoryCache, image );
+}
ImageVisual::ImageVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mImage(),
mPixels(),
+ mTextureSet(),
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl(),
+ mNativeFragmentShaderCode(),
mDesiredSize(),
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
mWrapModeU( WrapMode::DEFAULT ),
mWrapModeV( WrapMode::DEFAULT ),
- mNativeFragmentShaderCode(),
mNativeImageFlag( false )
{
}
: Visual::Base( factoryCache ),
mImage(),
mPixels(),
+ mTextureSet(),
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl( imageUrl ),
+ mNativeFragmentShaderCode(),
mDesiredSize( size ),
mFittingMode( fittingMode ),
mSamplingMode( samplingMode ),
mWrapModeU( WrapMode::DEFAULT ),
mWrapModeV( WrapMode::DEFAULT ),
- mNativeFragmentShaderCode(),
mNativeImageFlag( false )
{
}
mPixelArea( FULL_TEXTURE_RECT ),
mPlacementActor(),
mImageUrl(),
+ mNativeFragmentShaderCode(),
mDesiredSize(),
mFittingMode( FittingMode::DEFAULT ),
mSamplingMode( SamplingMode::DEFAULT ),
mWrapModeU( WrapMode::DEFAULT ),
mWrapModeV( WrapMode::DEFAULT ),
- mNativeFragmentShaderCode(),
mNativeImageFlag( false )
{
NativeImage newNativeImage = NativeImage::DownCast( image );
Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE );
if( fittingValue )
{
- Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, mFittingMode );
+ int value;
+ Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value );
+ mFittingMode = Dali::FittingMode::Type( value );
}
Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE );
if( samplingValue )
{
- Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, mSamplingMode );
+ int value;
+ Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value );
+ mSamplingMode = Dali::SamplingMode::Type( value );
}
int desiredWidth = 0;
Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U );
if( wrapModeValueU )
{
- Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, mWrapModeU );
+ int value;
+ Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
+ mWrapModeU = Dali::WrapMode::Type( value );
}
Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V );
if( wrapModeValueV )
{
- Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, mWrapModeV );
+ int value;
+ Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value );
+ mWrapModeV = Dali::WrapMode::Type( value );
}
mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
naturalSize = Vector2::ZERO;
}
-Renderer ImageVisual::CreateRenderer() const
+void ImageVisual::CreateRenderer()
{
Geometry geometry;
Shader shader;
// Renderer can't be shared between NativeImage and other image types.
if( !mNativeFragmentShaderCode.empty() )
{
- return CreateNativeImageRenderer();
+ CreateNativeImageRenderer();
+ return;
}
if( !mImpl->mCustomShader )
}
}
- Renderer renderer = Renderer::New( geometry, shader );
-
- return renderer;
+ mImpl->mRenderer = Renderer::New( geometry, shader );
+ // apply the texture set as well so it's only done in one place
+ DALI_ASSERT_DEBUG( mTextureSet );
+ mImpl->mRenderer.SetTextures( mTextureSet );
}
-Renderer ImageVisual::CreateNativeImageRenderer() const
+void ImageVisual::CreateNativeImageRenderer()
{
Geometry geometry;
Shader shader;
}
}
- TextureSet textureSet = TextureSet::New();
- Renderer renderer = Renderer::New( geometry, shader );
- renderer.SetTextures( textureSet );
- return renderer;
+ mImpl->mRenderer = Renderer::New( geometry, shader );
+ // apply the texture set as well so it's only done in one place
+ DALI_ASSERT_DEBUG( mTextureSet );
+ mImpl->mRenderer.SetTextures( mTextureSet );
}
}
}
-Image ImageVisual::LoadImage( const std::string& url, bool synchronousLoading )
-{
- if( synchronousLoading )
- {
- if( !mPixels )
- {
- // use broken image
- return VisualFactoryCache::GetBrokenVisualImage();
- }
- Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
- image.Upload( mPixels, 0, 0 );
- return image;
- }
- else
- {
- ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
- resourceImage.LoadingFinishedSignal().Connect( this, &ImageVisual::OnImageLoaded );
- return resourceImage;
- }
-}
-
-TextureSet ImageVisual::CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading )
+void ImageVisual::CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing )
{
- TextureSet textureSet;
textureRect = FULL_TEXTURE_RECT;
if( synchronousLoading )
{
if( !mPixels )
{
// use broken image
- textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, VisualFactoryCache::GetBrokenVisualImage() );
+ mTextureSet = TextureSet::New();
+ TextureSetImage( mTextureSet, 0u, VisualFactoryCache::GetBrokenVisualImage() );
}
else
{
- textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, mPixels );
- mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
- if( !textureSet ) // big image, no atlasing
+ if( attemptAtlasing )
+ {
+ mTextureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, mPixels );
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
+ }
+ if( !mTextureSet ) // big image, no atlasing or atlasing failed
{
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
- Atlas image = Atlas::New( mPixels.GetWidth(), mPixels.GetHeight(), mPixels.GetPixelFormat() );
- image.Upload( mPixels, 0, 0 );
- textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, image );
+ Texture texture = Texture::New( Dali::TextureType::TEXTURE_2D, mPixels.GetPixelFormat(),
+ mPixels.GetWidth(), mPixels.GetHeight() );
+ texture.Upload( mPixels );
+ mTextureSet = TextureSet::New();
+ mTextureSet.SetTexture( 0u, texture );
}
}
}
else
{
- textureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, url, mDesiredSize, mFittingMode, true, this );
- mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
- if( !textureSet ) // big image, no atlasing
+ if( attemptAtlasing )
+ {
+ mTextureSet = mFactoryCache.GetAtlasManager()->Add(textureRect, url, mDesiredSize, mFittingMode, true, this );
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
+ }
+ if( !mTextureSet ) // big image, no atlasing or atlasing failed
{
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
ResourceImage resourceImage = Dali::ResourceImage::New( url, mDesiredSize, mFittingMode, mSamplingMode );
resourceImage.LoadingFinishedSignal().Connect( this, &ImageVisual::OnImageLoaded );
- textureSet = TextureSet::New();
- TextureSetImage( textureSet, 0u, resourceImage );
+ mTextureSet = TextureSet::New();
+ TextureSetImage( mTextureSet, 0u, resourceImage );
}
}
{
Sampler sampler = Sampler::New();
sampler.SetWrapMode( mWrapModeU, mWrapModeV );
- textureSet.SetSampler( 0u, sampler );
+ mTextureSet.SetSampler( 0u, sampler );
}
-
- return textureSet;
}
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
if( !mImpl->mRenderer ) // new renderer is needed
{
Vector4 atlasRect;
- TextureSet textureSet = CreateTextureSet(atlasRect, imageUrl, IsSynchronousResourceLoading() );
- Geometry geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
- Shader shader( GetImageShader(mFactoryCache, mImpl->mFlags & Impl::IS_ATLASING_APPLIED, defaultWrapMode) );
- mImpl->mRenderer = Renderer::New( geometry, shader );
- mImpl->mRenderer.SetTextures( textureSet );
+ // texture set has to be created first as we need to know if atlasing succeeded or not
+ // when selecting the shader
+ CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), true );
+ CreateRenderer();
if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED ) // the texture is packed inside atlas
{
{
// for custom shader or remote image, renderer is not cached and atlas is not applied
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
- mImpl->mRenderer = CreateRenderer();
- Image image = LoadImage( imageUrl, IsSynchronousResourceLoading() );
- ApplyImageToSampler( image );
+ Vector4 atlasRect; // ignored in this case
+ CreateTextureSet( atlasRect, imageUrl, IsSynchronousResourceLoading(), false );
+ CreateRenderer();
}
}
{
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
- mImpl->mRenderer = CreateRenderer();
+ // don't reuse CreateTextureSet
+ mTextureSet = TextureSet::New();
+ CreateRenderer();
if( image )
{
mImpl->mRenderer.Reset();
}
mPlacementActor.Reset();
+ mTextureSet.Reset(); // release texture when going offstage
}
void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
if( image )
{
- TextureSet textureSet = mImpl->mRenderer.GetTextures();
- if( !textureSet )
- {
- textureSet = TextureSet::New();
- mImpl->mRenderer.SetTextures( textureSet );
- }
- TextureSetImage( textureSet, 0u, image );
+ DALI_ASSERT_DEBUG( mTextureSet ); // texture set should always exist by this time
+
+ TextureSetImage( mTextureSet, 0u, image );
Sampler sampler = Sampler::New();
sampler.SetWrapMode( mWrapModeU, mWrapModeV );
- textureSet.SetSampler( 0u, sampler );
+ mTextureSet.SetSampler( 0u, sampler );
}
}
{
if( IsFromCache() )
{
- TextureSet textureSet = mImpl->mRenderer.GetTextures();
-
Vector4 atlasRect( 0.f, 0.f, 1.f, 1.f );
Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
if( index != Property::INVALID_INDEX )
mImpl->mRenderer.Reset();
if( mFactoryCache.CleanRendererCache( url ) && index != Property::INVALID_INDEX )
{
- mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
+ mFactoryCache.GetAtlasManager()->Remove( mTextureSet, atlasRect );
}
}
}
*
*/
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/devel-api/image-loader/atlas-upload-observer.h>
-
// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/object/weak-handle.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+#include <dali-toolkit/devel-api/image-loader/atlas-upload-observer.h>
+
namespace Dali
{
public:
/**
- * @brief Constructor.
+ * @brief Create a new image visual.
*
- * @param[in] factoryCache The VisualFactoryCache object
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- ImageVisual( VisualFactoryCache& factoryCache );
+ static ImageVisualPtr New( VisualFactoryCache& factoryCache );
/**
- * @brief Constructor with a URL.
+ * @brief Create a new image visual with a URL.
*
* The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
*
* @param[in] fittingMode The FittingMode of the resource to load
* @param[in] samplingMode The SamplingMode of the resource to load
*/
- ImageVisual( VisualFactoryCache& factoryCache,
- const std::string& imageUrl,
- ImageDimensions size=ImageDimensions(),
- FittingMode::Type fittingMode = FittingMode::DEFAULT,
- Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
+ static ImageVisualPtr New( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
+ ImageDimensions size = ImageDimensions(),
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
/**
- * @brief Constructor with an Image type.
+ * @brief Create a new image visual with an Image type.
*
* @param[in] factoryCache The VisualFactoryCache object
* @param[in] image The image to use
*/
- ImageVisual( VisualFactoryCache& factoryCache, const Image& image );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~ImageVisual();
+ static ImageVisualPtr New( VisualFactoryCache& factoryCache, const Image& image );
public: // from Visual
virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
protected:
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache The VisualFactoryCache object
+ */
+ ImageVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief Constructor with a URL.
+ *
+ * The visual will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage
+ *
+ * @param[in] factoryCache The VisualFactoryCache object
+ * @param[in] imageUrl The URL of the image resource to use
+ * @param[in] size The width and height to fit the loaded image to.
+ * @param[in] fittingMode The FittingMode of the resource to load
+ * @param[in] samplingMode The SamplingMode of the resource to load
+ */
+ ImageVisual( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode );
+
+ /**
+ * @brief Constructor with an Image type.
+ *
+ * @param[in] factoryCache The VisualFactoryCache object
+ * @param[in] image The image to use
+ */
+ ImageVisual( VisualFactoryCache& factoryCache, const Image& image );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~ImageVisual();
+
/**
* @copydoc Visual::Base::DoInitialize
*/
/**
* @brief Creates the Dali::Renderer (potentially from the renderer cache), initializing it
- *
- * @return Returns the created Dali::Renderer
*/
- Renderer CreateRenderer() const;
+ void CreateRenderer();
/**
* @brief Creates the Dali::Renderer for NativeImage with custom sampler type and prefix, initializing it
- *
- * @return Returns the created Dali::Renderer
*/
- Renderer CreateNativeImageRenderer() const;
+ void CreateNativeImageRenderer();
/**
* @brief Query whether resources requires to be loaded synchronously.
void LoadResourceSynchronously();
/**
- * Load the image.
+ * Creates the texture set and adds the texture to it
+ * @param[out] textureRect The texture area of the texture in the atlas.
* @param[in] url The URL of the image resource to use.
* @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously.
+ * @param[in] attemptAtlasing If true will attempt atlasing, otherwise create unique texture
*/
- Image LoadImage( const std::string& url, bool synchronousLoading );
-
- /**
- * Load the image and create a texture set to hold the texture, with automatic atlasing applied.
- * @param [out] textureRect The texture area of the resource image in the atlas.
- * @param[in] url The URL of the image resource to use.
- * @param[in] synchronousLoading If true, the resource is loaded synchronously, otherwise asynchronously.
- */
- TextureSet CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading );
+ void CreateTextureSet( Vector4& textureRect, const std::string& url, bool synchronousLoading, bool attemptAtlasing );
/**
* Callback function of image resource loading succeed
void SetNativeFragmentShaderCode( Dali::NativeImage& nativeImage );
private:
+
Image mImage;
PixelData mPixels;
+ TextureSet mTextureSet;
Vector4 mPixelArea;
WeakHandle<Actor> mPlacementActor;
-
std::string mImageUrl;
- Dali::ImageDimensions mDesiredSize;
- Dali::FittingMode::Type mFittingMode;
- Dali::SamplingMode::Type mSamplingMode;
- Dali::WrapMode::Type mWrapModeU;
- Dali::WrapMode::Type mWrapModeV;
-
std::string mNativeFragmentShaderCode;
- bool mNativeImageFlag;
+
+ Dali::ImageDimensions mDesiredSize;
+ Dali::FittingMode::Type mFittingMode:3;
+ Dali::SamplingMode::Type mSamplingMode:4;
+ Dali::WrapMode::Type mWrapModeU:3;
+ Dali::WrapMode::Type mWrapModeV:3;
+ bool mNativeImageFlag:1;
};
} // namespace Internal
}\n
);
-} // namespace
+} // unnamed namespace
+
+MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new MeshVisual( factoryCache );
+}
MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
// EXTERNAL INCLUDES
#include <fstream>
#include <string.h>
+#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
namespace Internal
{
+class MeshVisual;
+typedef IntrusivePtr< MeshVisual > MeshVisualPtr;
+
/**
* The visual which renders a 3D object to the control's quad
*
public:
/**
- * @brief Constructor.
+ * @brief Create a new mesh visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- MeshVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- virtual ~MeshVisual();
+ static MeshVisualPtr New( VisualFactoryCache& factoryCache );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ MeshVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~MeshVisual();
+
+ /**
* @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
/////////////////NPatchVisual////////////////
-NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mImage(),
- mCroppedImage(),
- mImageUrl(),
- mStretchPixelsX(),
- mStretchPixelsY(),
- mImageSize(),
- mBorderOnly( false )
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache )
{
+ return new NPatchVisual( factoryCache );
}
-NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly )
-: Visual::Base( factoryCache ),
- mImage(),
- mCroppedImage(),
- mImageUrl( imageUrl ),
- mStretchPixelsX(),
- mStretchPixelsY(),
- mImageSize(),
- mBorderOnly( borderOnly )
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly )
{
- NinePatchImage nPatch = NinePatchImage::New( mImageUrl );
- InitializeFromImage( nPatch );
+ NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache, borderOnly );
+ nPatchVisual->mImageUrl = imageUrl;
+
+ NinePatchImage image = NinePatchImage::New( imageUrl );
+ nPatchVisual->InitializeFromImage( image );
+
+ return nPatchVisual;
}
-NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly )
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly )
+{
+ NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache, borderOnly );
+ nPatchVisual->mImage = image;
+
+ nPatchVisual->InitializeFromImage( image );
+
+ return nPatchVisual;
+}
+
+NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache, bool borderOnly )
: Visual::Base( factoryCache ),
- mImage( image ),
+ mImage(),
mCroppedImage(),
mImageUrl(),
mStretchPixelsX(),
mImageSize(),
mBorderOnly( borderOnly )
{
- InitializeFromImage( image );
}
NPatchVisual::~NPatchVisual()
*
*/
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-
// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/devel-api/images/nine-patch-image.h>
#include <dali/public-api/rendering/sampler.h>
#include <dali/public-api/rendering/shader.h>
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
+
namespace Dali
{
namespace Internal
{
+class NPatchVisual;
+typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr;
+
/**
* The visual which renders an 9 patch image to the control's quad
*
public:
/**
- * @brief Constructor.
+ * @brief Create a new n-patch visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- NPatchVisual( VisualFactoryCache& factoryCache );
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache );
/**
- * @brief Constructor which creates an N-patch visual using an image URL.
+ * @brief Create an N-patch visual using an image URL.
*
* The visual will load the image synchronously when the associated actor is put on stage, and destroy the image when it is off stage
*
* @param[in] imageUrl The URL to 9 patch image resource to use
* @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
*/
- NPatchVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly = false );
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, bool borderOnly = false );
/**
- * @brief Constructor which creates an N-patch viusal with a NinePatchImage resource.
+ * @brief Create an N-patch visual with a NinePatchImage resource.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] image The NinePatchImage to use
* @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
*/
- NPatchVisual( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly = false );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~NPatchVisual();
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, NinePatchImage image, bool borderOnly = false );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] borderOnly A Flag to indicate if the image should omit the centre of the n-patch and only render the border
+ */
+ NPatchVisual( VisualFactoryCache& factoryCache, bool borderOnly = false );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~NPatchVisual();
+
+ /**
* @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
}\n
);
-} // namespace
+} // unnamed namespace
+
+PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new PrimitiveVisual( factoryCache );
+}
PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
namespace Internal
{
+class PrimitiveVisual;
+typedef IntrusivePtr< PrimitiveVisual > PrimitiveVisualPtr;
+
/**
* The visual which renders a simple 3D shape to the control's quad
*
public:
/**
- * @brief Constructor.
+ * @brief Create a new primitive visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- PrimitiveVisual( VisualFactoryCache& factoryCache );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- virtual ~PrimitiveVisual();
+ static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ PrimitiveVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~PrimitiveVisual();
+
+ /**
* @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
namespace Internal
{
-SvgVisual::SvgVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mAtlasRect( FULL_TEXTURE_RECT ),
- mImageUrl(),
- mParsedImage( NULL ),
- mPlacementActor()
+SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache )
{
- // the rasterized image is with pre-multiplied alpha format
- mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
+ return new SvgVisual( factoryCache );
+}
+
+SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size )
+{
+ SvgVisual* svgVisual = new SvgVisual( factoryCache );
+ svgVisual->ParseFromUrl( imageUrl, size );
+ return svgVisual;
}
-SvgVisual::SvgVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size )
+SvgVisual::SvgVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mAtlasRect( FULL_TEXTURE_RECT ),
mImageUrl(),
{
// the rasterized image is with pre-multiplied alpha format
mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
-
- ParseFromUrl( imageUrl, size );
}
SvgVisual::~SvgVisual()
*
*/
-//EXTERNAL INCLUDES
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/devel-api/object/weak-handle.h>
// INTERNAL INCLUDES
namespace Internal
{
+class SvgVisual;
+typedef IntrusivePtr< SvgVisual > SvgVisualPtr;
+
/**
* The visual which renders a svg image
*
public:
/**
- * @brief Constructor.
+ * @brief Create a new SVG visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- SvgVisual( VisualFactoryCache& factoryCache );
+ static SvgVisualPtr New( VisualFactoryCache& factoryCache );
/**
- * @brief Constructor which creates the SVG Visual using the image URL.
+ * @brief Create the SVG Visual using the image URL.
*
* The visual will parse the SVG image once it is set.
* And rasterize it into BufferImage synchronously when the associated actor is put on stage, and destroy the BufferImage when it is off stage
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] imageUrl The URL to svg resource to use
+ * @param[in] size The required size for the SVG
*/
- SvgVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size = ImageDimensions() );
-
- /**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~SvgVisual();
+ static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size = ImageDimensions() );
public: // from Visual
protected:
/**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ */
+ SvgVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~SvgVisual();
+
+ /**
* @copydoc Visual::Base::DoInitialize
*/
virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
return geometry;
}
-} // namespace
+} // unnamed namespace
-TextVisual::TextVisual( VisualFactoryCache& factoryCache )
-: Visual::Base( factoryCache ),
- mController( Text::Controller::New() ),
- mRenderingBackend( Toolkit::Text::DEFAULT_RENDERING_BACKEND ),
- mHasBeenStaged( false )
-{
-}
-
-TextVisual::~TextVisual()
+TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache )
{
+ return new TextVisual( factoryCache );
}
void TextVisual::SetTextControlInterface( Text::ControlInterface* controlInterface )
map.Insert( Toolkit::TextVisual::Property::BATCHING_ENABLED, false ); // TODO
}
+TextVisual::TextVisual( VisualFactoryCache& factoryCache )
+: Visual::Base( factoryCache ),
+ mController( Text::Controller::New() ),
+ mRenderingBackend( Toolkit::Text::DEFAULT_RENDERING_BACKEND ),
+ mHasBeenStaged( false )
+{
+}
+
+TextVisual::~TextVisual()
+{
+}
+
void TextVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
mSelf = actor;
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
public:
/**
- * @brief Constructor.
+ * @brief Create a new text visual.
*
- * @param[in] factoryCache The VisualFactoryCache object
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
*/
- TextVisual( VisualFactoryCache& factoryCache );
+ static TextVisualPtr New( VisualFactoryCache& factoryCache );
/**
- * @brief A reference counted object may only be deleted by calling Unreference().
- */
- ~TextVisual();
-
- /**
- *
+ * @brief Sets the text control interface which is needed to communicate with a control.
+ * @param[in] controlInterface Pointer to the control-interface.
*/
void SetTextControlInterface( Text::ControlInterface* controlInterface );
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
-protected: // from Visual::Base
+protected:
+
+ /**
+ * @brief Constructor.
+ *
+ * @param[in] factoryCache The VisualFactoryCache object
+ */
+ TextVisual( VisualFactoryCache& factoryCache );
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~TextVisual();
+
+ // from Visual::Base
+
/**
* @copydoc Visual::Base::DoInitialize()
*/
*/
// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
#include <dali/public-api/images/image-operations.h>
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/rendering/shader.h>
VisualFactoryCache& mFactoryCache;
};
+typedef IntrusivePtr<Base> BasePtr;
+
} // namspace Visual
} // namespace Internal
// Return a new WireframeVisual if we have debug enabled
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() );
}
- Visual::Base* visualPtr = NULL;
+ Visual::BasePtr visualPtr;
Property::Value* typeValue = propertyMap.Find( Toolkit::Visual::Property::TYPE, VISUAL_TYPE );
Toolkit::Visual::Type visualType = Toolkit::Visual::IMAGE; // Default to IMAGE type.
{
case Toolkit::Visual::BORDER:
{
- visualPtr = new BorderVisual( *( mFactoryCache.Get() ) );
+ visualPtr = BorderVisual::New( *( mFactoryCache.Get() ) );
break;
}
case Toolkit::Visual::COLOR:
{
- visualPtr = new ColorVisual( *( mFactoryCache.Get() ) );
+ visualPtr = ColorVisual::New( *( mFactoryCache.Get() ) );
break;
}
case Toolkit::Visual::GRADIENT:
{
- visualPtr = new GradientVisual( *( mFactoryCache.Get() ) );
+ visualPtr = GradientVisual::New( *( mFactoryCache.Get() ) );
break;
}
UrlType::Type type = ResolveUrlType( imageUrl );
if( UrlType::N_PATCH == type )
{
- visualPtr = new NPatchVisual( *( mFactoryCache.Get() ) );
+ visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ) );
}
else if( UrlType::SVG == type )
{
- visualPtr = new SvgVisual( *( mFactoryCache.Get() ) );
+ visualPtr = SvgVisual::New( *( mFactoryCache.Get() ) );
}
else // Regular image
{
if( batchingEnabled )
{
- visualPtr = new BatchImageVisual( *( mFactoryCache.Get() ) );
+ visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ) );
break;
}
else
{
- visualPtr = new ImageVisual( *( mFactoryCache.Get() ) );
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ) );
}
}
}
case Toolkit::Visual::MESH:
{
- visualPtr = new MeshVisual( *( mFactoryCache.Get() ) );
+ visualPtr = MeshVisual::New( *( mFactoryCache.Get() ) );
break;
}
case Toolkit::Visual::PRIMITIVE:
{
- visualPtr = new PrimitiveVisual( *( mFactoryCache.Get() ) );
+ visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ) );
break;
}
case Toolkit::Visual::WIREFRAME:
{
- visualPtr = new WireframeVisual( *( mFactoryCache.Get() ) );
+ visualPtr = WireframeVisual::New( *( mFactoryCache.Get() ) );
break;
}
case Toolkit::Visual::TEXT:
{
- visualPtr = new TextVisual( *( mFactoryCache.Get() ) );
+ visualPtr = TextVisual::New( *( mFactoryCache.Get() ) );
break;
}
-
}
if( visualPtr )
DALI_LOG_ERROR( "Renderer type unknown\n" );
}
- return Toolkit::Visual::Base( visualPtr );
+ return Toolkit::Visual::Base( visualPtr.Get() );
}
Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image )
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() );
}
+ Visual::BasePtr visualPtr;
+
NinePatchImage npatchImage = NinePatchImage::DownCast( image );
if( npatchImage )
{
- NPatchVisual* visualPtr = new NPatchVisual( *( mFactoryCache.Get() ), npatchImage );
- return Toolkit::Visual::Base( visualPtr );
+ visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), npatchImage );
}
else
{
- ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), image );
- return Toolkit::Visual::Base( visualPtr );
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), image );
}
+
+ return Toolkit::Visual::Base( visualPtr.Get() );
}
Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, ImageDimensions size )
if( mDebugEnabled )
{
- return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) );
+ return Toolkit::Visual::Base( WireframeVisual::New( *( mFactoryCache.Get() ) ).Get() );
}
+ Visual::BasePtr visualPtr;
+
// first resolve url type to know which visual to create
UrlType::Type type = ResolveUrlType( url );
if( UrlType::N_PATCH == type )
{
- NPatchVisual* visualPtr = new NPatchVisual( *( mFactoryCache.Get() ), url );
- return Toolkit::Visual::Base( visualPtr );
+ visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), url );
}
else if( UrlType::SVG == type )
{
- SvgVisual* visualPtr = new SvgVisual( *( mFactoryCache.Get() ), url, size );
- return Toolkit::Visual::Base( visualPtr );
+ visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), url, size );
}
else // Regular image
{
- ImageVisual* visualPtr = new ImageVisual( *( mFactoryCache.Get() ), url, size );
- return Toolkit::Visual::Base( visualPtr );
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), url, size );
}
+
+ return Toolkit::Visual::Base( visualPtr.Get() );
}
} // namespace Internal
}
+WireframeVisualPtr WireframeVisual::New( VisualFactoryCache& factoryCache )
+{
+ return new WireframeVisual( factoryCache );
+}
WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache )
}
WireframeVisual::~WireframeVisual()
-{}
+{
+}
void WireframeVisual::DoSetOnStage( Actor& actor )
{
*
*/
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/intrusive-ptr.h>
+
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
namespace Internal
{
+class WireframeVisual;
+typedef IntrusivePtr< WireframeVisual > WireframeVisualPtr;
+
/**
- * The visual which renders a wireframe outline to the control's quad.
- *
+ * @brief Renders a wireframe outline to the control's quad.
*/
class WireframeVisual: public Visual::Base
{
public:
/**
+ * @brief Create a new wireframe visual.
+ *
+ * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static WireframeVisualPtr New( VisualFactoryCache& factoryCache );
+
+protected:
+
+ /**
* @brief Constructor.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
*/
virtual ~WireframeVisual();
-protected:
-
/**
* @copydoc Visual::Base::DoSetOnStage
*/