);
}
-BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache )
+BorderVisualPtr BorderVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new BorderVisual( factoryCache );
+ BorderVisualPtr borderVisualPtr( new BorderVisual( factoryCache ) );
+ borderVisualPtr->SetProperties( properties );
+ return borderVisualPtr;
}
BorderVisual::BorderVisual( VisualFactoryCache& factoryCache )
* @brief Create a new border visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static BorderVisualPtr New( VisualFactoryCache& factoryCache );
+ static BorderVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
protected:
);
}
-ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache )
+ColorVisualPtr ColorVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new ColorVisual( factoryCache );
+ ColorVisualPtr colorVisualPtr( new ColorVisual( factoryCache ) );
+ colorVisualPtr->SetProperties( properties );
+ return colorVisualPtr;
}
ColorVisual::ColorVisual( VisualFactoryCache& factoryCache )
* @brief Create a new color visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static ColorVisualPtr New( VisualFactoryCache& factoryCache );
+ static ColorVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
public: // from Visual
} // unnamed namespace
-GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache )
+GradientVisualPtr GradientVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new GradientVisual( factoryCache );
+ GradientVisualPtr gradientVisualPtr( new GradientVisual( factoryCache ) );
+ gradientVisualPtr->SetProperties( properties );
+ return gradientVisualPtr;
}
GradientVisual::GradientVisual( VisualFactoryCache& factoryCache )
* @brief Create a new gradient visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static GradientVisualPtr New( VisualFactoryCache& factoryCache );
+ static GradientVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
public: // from Visual
} // unnamed namespace
-BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url )
+BatchImageVisualPtr BatchImageVisual::New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties )
{
BatchImageVisualPtr visual = new BatchImageVisual( factoryCache );
visual->mImageUrl = url;
+ visual->SetProperties( properties );
+
return visual;
}
* @brief Create a new batch-image visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] url The URL of the image to use
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url );
+ static BatchImageVisualPtr New( VisualFactoryCache& factoryCache, const std::string& url, const Property::Map& properties = Property::Map() );
public: // from Visual
ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
const std::string& imageUrl,
+ const Property::Map& properties,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode )
+{
+ ImageVisualPtr imageVisualPtr( new ImageVisual( factoryCache, imageUrl, size, fittingMode, samplingMode ) );
+ imageVisualPtr->SetProperties( properties );
+ return imageVisualPtr;
+}
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
ImageDimensions size,
FittingMode::Type fittingMode,
Dali::SamplingMode::Type samplingMode )
mSamplingMode = Dali::SamplingMode::Type( value );
}
+ // Use a variable to detect if the width or height have been modified by the property map.
+ bool desiredSizeSpecified = false;
int desiredWidth = 0;
Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
if( desiredWidthValue )
{
desiredWidthValue->Get( desiredWidth );
+ desiredSizeSpecified = true;
}
int desiredHeight = 0;
if( desiredHeightValue )
{
desiredHeightValue->Get( desiredHeight );
+ desiredSizeSpecified = true;
}
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ // Only update the desired size if specified in the property map.
+ if( desiredSizeSpecified )
+ {
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ }
Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
if( pixelAreaValue )
*
* @param[in] factoryCache The VisualFactoryCache object
* @param[in] imageUrl The URL of the image resource to use
+ * @param[in] properties A Property::Map containing settings for this visual
* @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
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static ImageVisualPtr New( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
+ const Property::Map& properties,
+ ImageDimensions size = ImageDimensions(),
+ FittingMode::Type fittingMode = FittingMode::DEFAULT,
+ Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR );
+
+ /**
+ * @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] 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
+ * @return A smart-pointer to the newly allocated visual.
*/
static ImageVisualPtr New( VisualFactoryCache& factoryCache,
const std::string& imageUrl,
} // unnamed namespace
-MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache )
+MeshVisualPtr MeshVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new MeshVisual( factoryCache );
+ MeshVisualPtr meshVisualPtr( new MeshVisual( factoryCache ) );
+ meshVisualPtr->SetProperties( properties );
+ return meshVisualPtr;
}
MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
* @brief Create a new mesh visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static MeshVisualPtr New( VisualFactoryCache& factoryCache );
+ static MeshVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
public: // from Visual
/////////////////NPatchVisual////////////////
+NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
+ nPatchVisual->mImageUrl = imageUrl;
+ nPatchVisual->SetProperties( properties );
+
+ return nPatchVisual;
+}
+
NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
nPatchVisual->mImageUrl = imageUrl;
return nPatchVisual;
NPatchVisualPtr NPatchVisual::New( VisualFactoryCache& factoryCache, NinePatchImage image )
{
- NPatchVisual* nPatchVisual = new NPatchVisual( factoryCache );
+ NPatchVisualPtr nPatchVisual( new NPatchVisual( factoryCache ) );
nPatchVisual->mImageUrl = image.GetUrl();
return nPatchVisual;
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] imageUrl The URL to 9 patch image resource to use
+ * @param[in] properties A Property::Map containing settings for this visual
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties );
+
+ /**
+ * @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] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] imageUrl The URL to 9 patch image resource to use
+ * @return A smart-pointer to the newly allocated visual.
*/
static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
} // unnamed namespace
-PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache )
+PrimitiveVisualPtr PrimitiveVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new PrimitiveVisual( factoryCache );
+ PrimitiveVisualPtr primitiveVisualPtr( new PrimitiveVisual( factoryCache ) );
+ primitiveVisualPtr->SetProperties( properties );
+ return primitiveVisualPtr;
}
PrimitiveVisual::PrimitiveVisual( VisualFactoryCache& factoryCache )
* @brief Create a new primitive visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache );
+ static PrimitiveVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
public: // from Visual
namespace Internal
{
+SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties )
+{
+ SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) );
+ svgVisual->ParseFromUrl( imageUrl );
+ svgVisual->SetProperties( properties );
+
+ return svgVisual;
+}
+
SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl )
{
- SvgVisual* svgVisual = new SvgVisual( factoryCache );
+ SvgVisualPtr svgVisual( new SvgVisual( factoryCache ) );
svgVisual->ParseFromUrl( imageUrl );
+
return svgVisual;
}
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
* @param[in] imageUrl The URL to svg resource to use
+ * @param[in] properties A Property::Map containing settings for this visual
+ * @return A smart-pointer to the newly allocated visual.
+ */
+ static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl, const Property::Map& properties );
+
+ /**
+ * @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
+ * @return A smart-pointer to the newly allocated visual.
*/
static SvgVisualPtr New( VisualFactoryCache& factoryCache, const std::string& imageUrl );
} // unnamed namespace
-TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache )
+TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache, const Property::Map& properties )
{
- return new TextVisual( factoryCache );
+ TextVisualPtr TextVisualPtr( new TextVisual( factoryCache ) );
+ TextVisualPtr->SetProperties( properties );
+ return TextVisualPtr;
}
float TextVisual::GetHeightForWidth( float width )
* @brief Create a new text visual.
*
* @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
+ * @param[in] properties A Property::Map containing settings for this visual
* @return A smart-pointer to the newly allocated visual.
*/
- static TextVisualPtr New( VisualFactoryCache& factoryCache );
+ static TextVisualPtr New( VisualFactoryCache& factoryCache, const Property::Map& properties );
public: // from Visual::Base
{
case Toolkit::Visual::BORDER:
{
- visualPtr = BorderVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = BorderVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
case Toolkit::Visual::COLOR:
{
- visualPtr = ColorVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = ColorVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
case Toolkit::Visual::GRADIENT:
{
- visualPtr = GradientVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = GradientVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
UrlType::Type type = ResolveUrlType( imageUrl );
if( UrlType::N_PATCH == type )
{
- visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl );
+ visualPtr = NPatchVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
else if( UrlType::SVG == type )
{
- visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl );
+ visualPtr = SvgVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
else // Regular image
{
if( batchingEnabled )
{
- visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
- break;
+ visualPtr = BatchImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
else
{
- visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl );
+ visualPtr = ImageVisual::New( *( mFactoryCache.Get() ), imageUrl, propertyMap );
}
}
}
case Toolkit::Visual::MESH:
{
- visualPtr = MeshVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = MeshVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
case Toolkit::Visual::PRIMITIVE:
{
- visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = PrimitiveVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
case Toolkit::DevelVisual::TEXT:
{
- visualPtr = TextVisual::New( *( mFactoryCache.Get() ) );
+ visualPtr = TextVisual::New( *( mFactoryCache.Get() ), propertyMap );
break;
}
}
}
- if( visualPtr )
- {
- visualPtr->SetProperties( propertyMap );
- }
- else
+ if( !visualPtr )
{
DALI_LOG_ERROR( "Renderer type unknown\n" );
}