);
}
+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 );
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 ),
*
*/
-// 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
*/
}\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
*/