X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fnpatch%2Fnpatch-visual.h;h=a76162808e4b2885139895c682ee7e3b5a2fe992;hp=1059a7ebd88a7e112712c494e0f67144c9e91a65;hb=7c1ca2d9ab3bc63f3dc164c4f5d4ea0d8bf5ba3e;hpb=928f30d2caf2775c5bcbfd84ceb4bf37ca29f020 diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 1059a7e..a761628 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_N_PATCH_VISUAL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -29,6 +29,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -50,8 +51,10 @@ typedef IntrusivePtr< NPatchVisual > NPatchVisualPtr; * | %Property Name | Type | * |--------------------------|------------------| * | url | STRING | - * | borderOnly | BOOLEAN - * + * | borderOnly | BOOLEAN | + * | border | RECTANGLE | + * | auxiliaryImage | STRING | + * | auxiliaryImageAlpha | FLOAT | */ class NPatchVisual: public Visual::Base { @@ -64,8 +67,21 @@ public: * * @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 ); + static NPatchVisualPtr New( VisualFactoryCache& factoryCache, const VisualUrl& 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 VisualUrl& imageUrl ); /** * @brief Create an N-patch visual with a NinePatchImage resource. @@ -80,22 +96,17 @@ public: // from Visual /** * @copydoc Visual::Base::GetNaturalSize */ - virtual void GetNaturalSize( Vector2& naturalSize ); + void GetNaturalSize( Vector2& naturalSize ) override; /** * @copydoc Visual::Base::CreatePropertyMap */ - virtual void DoCreatePropertyMap( Property::Map& map ) const; - - /** - * @copydoc Visual::Base::DoSetProperty - */ - virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ); + void DoCreatePropertyMap( Property::Map& map ) const override; /** - * @copydoc Visual::Base::DoGetProperty + * @copydoc Visual::Base::CreateInstancePropertyMap */ - virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ); + void DoCreateInstancePropertyMap( Property::Map& map ) const override; protected: @@ -114,26 +125,31 @@ protected: /** * @copydoc Visual::Base::DoSetProperties */ - virtual void DoSetProperties( const Property::Map& propertyMap ); + void DoSetProperties( const Property::Map& propertyMap ) override; /** * @copydoc Visual::Base::DoSetOnStage */ - virtual void DoSetOnStage( Actor& actor ); + void DoSetOnStage( Actor& actor ) override; /** * @copydoc Visual::Base::DoSetOffStage */ - virtual void DoSetOffStage( Actor& actor ); + void DoSetOffStage( Actor& actor ) override; /** * @copydoc Visual::Base::OnSetTransform */ - virtual void OnSetTransform(); + void OnSetTransform() override; private: /** + * Loads the NPatch image and the Auxiliary image if needed + */ + void LoadImages(); + + /** * @brief Creates a geometry for this renderer's grid size * * @return Returns the created geometry for this renderer's grid size @@ -192,11 +208,14 @@ private: private: - NPatchLoader& mLoader; ///< reference to N patch loader for fast access - std::string mImageUrl; ///< The url to the N patch to load - std::size_t mId; ///< id of the N patch (from loader/cache) - bool mBorderOnly; ///< if only border is desired - + NPatchLoader& mLoader; ///< reference to N patch loader for fast access + VisualUrl mImageUrl; ///< The url to the N patch to load + VisualUrl mAuxiliaryUrl; ///< An auxiliary image that can be displayed on top of the N-Patch + std::size_t mId; ///< id of the N patch (from loader/cache) + Devel::PixelBuffer mAuxiliaryPixelBuffer; ///< pixel buffer of the auxiliary mask image + bool mBorderOnly; ///< if only border is desired + Rect mBorder; ///< The size of the border + float mAuxiliaryImageAlpha; ///< The alpha value for the auxiliary image only }; } // namespace Internal