X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fvisual-factory%2Fvisual-factory.h;h=cc62c2bb5986a01e076147d319ca701cc32651eb;hb=HEAD;hp=0a8675496c20aebf1f0df3cdf71274c2c0a5b071;hpb=7c1ca2d9ab3bc63f3dc164c4f5d4ea0d8bf5ba3e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/devel-api/visual-factory/visual-factory.h b/dali-toolkit/devel-api/visual-factory/visual-factory.h index 0a86754..13697d2 100644 --- a/dali-toolkit/devel-api/visual-factory/visual-factory.h +++ b/dali-toolkit/devel-api/visual-factory/visual-factory.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_VISUAL_FACTORY_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -19,8 +19,8 @@ */ // EXTERNAL INCLUDES -#include #include +#include #include // INTERNAL INCLUDES @@ -33,7 +33,6 @@ struct Vector4; namespace Toolkit { - namespace Internal DALI_INTERNAL { class VisualFactory; @@ -54,6 +53,12 @@ class VisualFactory; class DALI_TOOLKIT_API VisualFactory : public BaseHandle { public: + enum CreationOptions + { + NONE = 0, + + IMAGE_VISUAL_LOAD_STATIC_IMAGES_ONLY = 1 << 0, ///< Load static images only when we use the image visual. + }; /** * @brief Create or retrieve VisualFactory singleton. @@ -81,7 +86,7 @@ public: * * @param[in] handle A reference to the copied handle. */ - VisualFactory( const VisualFactory& handle ); + VisualFactory(const VisualFactory& handle); /** * @brief This assignment operator is required for (smart) pointer semantics. @@ -89,7 +94,7 @@ public: * @param [in] handle A reference to the copied handle. * @return A reference to this. */ - VisualFactory& operator=( const VisualFactory& handle ); + VisualFactory& operator=(const VisualFactory& handle); /** * @brief Request the visual @@ -98,15 +103,17 @@ public: * The content of the map determines the type of visual that will be returned. * @return The handle to the created visual */ - Visual::Base CreateVisual( const Property::Map& propertyMap ); + Visual::Base CreateVisual(const Property::Map& propertyMap); /** - * @brief Request the visual to render the image. + * @brief Request the visual with some options * - * @param[in] image The image to be rendered. - * @return The pointer pointing to the visual + * @param[in] propertyMap The map contains the properties required by the visual. + * The content of the map determines the type of visual that will be returned. + * @param[in] creationOptions The creation option. + * @return The handle to the created visual */ - Visual::Base CreateVisual( const Image& image ); + Visual::Base CreateVisual(const Property::Map& propertyMap, CreationOptions creationOptions); /** * @brief Request the visual to render the given resource at the url. @@ -115,7 +122,17 @@ public: * @param[in] size The width and height to fit the loaded image to. * @return The pointer pointing to the visual */ - Visual::Base CreateVisual( const std::string& url, ImageDimensions size ); + Visual::Base CreateVisual(const std::string& url, ImageDimensions size); + + /** + * @brief Request the visual to render the given resource at the url with some options. + * + * @param[in] url The URL to the resource to be rendered. + * @param[in] size The width and height to fit the loaded image to. + * @param[in] creationOptions The creation option. + * @return The pointer pointing to the visual + */ + Visual::Base CreateVisual(const std::string& url, ImageDimensions size, CreationOptions creationOptions); /** * @brief Enable or disable premultiplying alpha in images and image visuals. @@ -127,7 +144,7 @@ public: * @param[in] preMultiply True if loaded images for image visuals should have alpha multiplied into the color * channels. */ - void SetPreMultiplyOnLoad( bool preMultiply ); + void SetPreMultiplyOnLoad(bool preMultiply); /** * @brief Get the setting for automatically pre-multiplying image visual images on load. @@ -136,10 +153,40 @@ public: */ bool GetPreMultiplyOnLoad() const; -private: + /** + * @brief Set the default creation options when we skip the creation options parameter. + * + * @param[in] creationOptions The default creation options for the visual factory. + */ + void SetDefaultCreationOptions(CreationOptions creationOptions); - explicit DALI_INTERNAL VisualFactory(Internal::VisualFactory *impl); + /** + * @brief Set the default creation options when we skip the creation options parameter. + * + * @return The default creation options for the visual factory. + */ + CreationOptions GetDefaultCreationOptions() const; + /** + * @brief Discard visual base. It will keep reference of visual until idle callback called. + * + * @param[in] visual Discarded visual base. + */ + void DiscardVisual(Visual::Base visual); + + /** + * @brief Compile the visual shader in advance. Afterwards, + * when a visual using a new shader is requested, the pre-compiled shader is used. + * + * @note It is recommended that this method be called at the top of the application code. + * @note Using precompiled shaders is helpful when the application is complex and uses + * many different styles of visual options. On the other hand,if most visuals are the same + * and the application is simple, it may use memory unnecessarily or slow down the application launching speed. + */ + void UsePreCompiledShader(); + +private: + explicit DALI_INTERNAL VisualFactory(Internal::VisualFactory* impl); }; } // namespace Toolkit