X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-url.h;h=08a276a74ff81f6164ded4bbbf740caa6ffef913;hb=e3cb09bfd9a25de3fa35db1b2c3082bcb838d700;hp=d9ed48a8a2a10b833b139069d30a8afbaa92c994;hpb=ddef399f249128bef52cbb79eb321b0bfdaa0ced;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/visuals/visual-url.h b/dali-toolkit/internal/visuals/visual-url.h index d9ed48a..08a276a 100644 --- a/dali-toolkit/internal/visuals/visual-url.h +++ b/dali-toolkit/internal/visuals/visual-url.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_VISUAL_URL_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -21,17 +21,13 @@ namespace Dali { - namespace Toolkit { - namespace Internal { - class VisualUrl { public: - /** * The type of the URL based on the string contents */ @@ -40,13 +36,18 @@ public: REGULAR_IMAGE, N_PATCH, SVG, - GIF + GIF, + WEBP, + JSON, + TVG }; - enum Location + enum ProtocolType { - LOCAL, - REMOTE + LOCAL, ///< file in local file system + TEXTURE, ///< texture uploaded to texture manager + REMOTE, ///< remote image + BUFFER ///< encoded image buffer }; /** @@ -56,23 +57,31 @@ public: VisualUrl(); /** + * Default Destructor. + * Delete an external texture if if protocolType is TEXTURE. + */ + ~VisualUrl(); + + /** * Constructor. * Determines type of visual and whether the url is local or remote + * Notify that it is using an external texture if if protocolType is TEXTURE. + * * @param[in] url The URL to store and resolve */ - VisualUrl( const std::string& url ); + VisualUrl(const std::string& url); /** * Copy constructor * @param[in] url The VisualUrl to copy */ - VisualUrl( const VisualUrl& url ); + VisualUrl(const VisualUrl& url); /** * Assignment operator * @param[in] url The VisualUrl to copy */ - VisualUrl& operator=( const VisualUrl& url ); + VisualUrl& operator=(const VisualUrl& url); /** * Get the full URL @@ -90,7 +99,7 @@ public: * Is the URL is local to the device, or remote? * @return the location of the resource */ - Location GetLocation() const; + ProtocolType GetProtocolType() const; /** * Is the URL valid? @@ -99,17 +108,54 @@ public: bool IsValid() const; /** - * @return true if the location is LOCAL + * @return true if the location is LOCAL, i.e. is loadable from local file system + */ + bool IsLocalResource() const; + + /** + * @return true if the location is BUFFER, i.e. may contain EncodedImageBuffer + */ + bool IsBufferResource() const; + + /** + * @return the location part of the url */ - bool IsLocal() const; + std::string GetLocation() const; + + /** + * Helper to create a URL of type TEXTURE + * @param location the location of the texture + * @return the Url + */ + static std::string CreateTextureUrl(const std::string& location); + + /** + * Helper to create a URL of type BUFFER + * @param location the location of the texture + * @return the Url + */ + static std::string CreateBufferUrl(const std::string& location); + + /** + * Helper to get a ProtocolType from url + * @param url the url of the texture + * @return the protocol type + */ + static VisualUrl::ProtocolType GetProtocolType(const std::string& url); + + /** + * Helper to get a location from url + * @param url the location of the texture + * @return the location + */ + static std::string GetLocation(const std::string& url); private: - std::string mUrl; - Type mType; - Location mLocation; + std::string mUrl; + Type mType; + ProtocolType mLocation; }; - } // namespace Internal } // namespace Toolkit