X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Frenderers%2Fimage%2Fimage-renderer.h;h=c11c6b0d413fd5c962d29bb9e7deb8e6f096b312;hp=e01efd0141b5802b210103e92517809e960a5d7e;hb=4c6d34154c81cf86b4c3662b81e1223f3326ceb5;hpb=8991dd870badfb20693aa0eb1acf0aedbe88f99f diff --git a/dali-toolkit/internal/controls/renderers/image/image-renderer.h b/dali-toolkit/internal/controls/renderers/image/image-renderer.h index e01efd0..c11c6b0 100644 --- a/dali-toolkit/internal/controls/renderers/image/image-renderer.h +++ b/dali-toolkit/internal/controls/renderers/image/image-renderer.h @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include +#include // EXTERNAL INCLUDES #include @@ -43,29 +44,29 @@ typedef IntrusivePtr< ImageRenderer > ImageRendererPtr; * * The following properties are optional * - * | %Property Name | Type | - * |---------------------------|------------------| - * | image-url | STRING | - * | image-fitting-mode | STRING | - * | image-sampling-mode | STRING | - * | image-desired-width | INT | - * | image-desired-height | INT | + * | %Property Name | Type | + * |-------------------------|------------------| + * | imageUrl | STRING | + * | imageFittingMode | STRING | + * | imageSamplingMode | STRING | + * | imageDesiredWidth | INT | + * | imageDesiredHeight | INT | * - * where image-fitting-mode should be one of the following fitting modes: - * "shrink-to-fit" - * "scale-to-fill" - * "fit-width" - * "fit-height" + * where imageFittingMode should be one of the following fitting modes: + * "shrinkToFit" + * "scaleToFill" + * "fitWidth" + * "fitHeight" * "default" * - * where image-sampling-mode should be one of the following sampling modes: + * where imageSamplingMode should be one of the following sampling modes: * "box" * "nearest" * "linear" - * "box-then-nearest" - * "box-then-linear" - * "no-filter" - * "dont-care" + * "boxThenNearest" + * "boxThenLinear" + * "noFilter" + * "dontCare" * "default" * */ @@ -76,9 +77,10 @@ public: /** * @brief Constructor. * - * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object + * @param[in] factoryCache The RendererFactoryCache object + * @param[in] atlasManager The atlasManager object */ - ImageRenderer( RendererFactoryCache& factoryCache ); + ImageRenderer( RendererFactoryCache& factoryCache, ImageAtlasManager& atlasManager ); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -131,13 +133,10 @@ protected: public: /** - * @brief Sets the image of this renderer to the resource at imageUrl - * The renderer will load the Image asynchronously when the associated actor is put on stage, and destroy the image when it is off stage - * - * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor - * @param[in] imageUrl The URL to to image resource to use + * Get the standard image rendering shader. + * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object */ - void SetImage( Actor& actor, const std::string& imageUrl ); + static Shader GetImageShader( RendererFactoryCache& factoryCache ); /** * @brief Sets the image of this renderer to the resource at imageUrl @@ -145,12 +144,15 @@ public: * * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor * @param[in] imageUrl The URL to to image resource to use - * @param[in] desiredWidth The desired width of the resource to load - * @param[in] desiredHeight The desired height of the resource to load + * @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 */ - void SetImage( Actor& actor, const std::string& imageUrl, int desiredWidth, int desiredHeight, Dali::FittingMode::Type fittingMode, Dali::SamplingMode::Type samplingMode ); + void SetImage( Actor& actor, + const std::string& imageUrl, + ImageDimensions size=ImageDimensions(), + FittingMode::Type fittingMode = FittingMode::DEFAULT, + Dali::SamplingMode::Type samplingMode = SamplingMode::BOX_THEN_LINEAR ); /** * @brief Sets the image of this renderer to use @@ -196,8 +198,21 @@ private: */ void OnImageLoaded( ResourceImage image ); + /** + * Set the value to the uTextureRect uniform + * @param[in] textureRect The texture rectangular area. + */ + void SetTextureRectUniform( const Vector4& textureRect ); + + /** + * Clean the renderer from cache, and remove the image from atlas if it is not used anymore + */ + void CleanCache(const std::string& url); + private: Image mImage; + ImageAtlasManager& mAtlasManager; + Vector4 mTextureRect; std::string mImageUrl; Dali::ImageDimensions mDesiredSize;