1 #ifndef DALI_TOOLKIT_IMAGE_URL_H
2 #define DALI_TOOLKIT_IMAGE_URL_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/rendering/texture.h>
23 #include <dali/public-api/adaptor-framework/encoded-image-buffer.h>
26 #include <dali-toolkit/public-api/dali-toolkit-common.h>
32 namespace Internal DALI_INTERNAL
37 * @brief ImageUrl can be used to wrap an external buffer.
39 * An instance of ImageUrl can be created from Image::GenerateUrl().
40 * Application can get url from ImageUrl.
41 * When application does not use this anymore, the destructor of the ImageUrl is called.
42 * At this time, the buffer is deleted from the texture manager.
43 * @note Visual also have reference of the buffer. In this case, buffer will be deleted after visual is deleted.
45 class DALI_TOOLKIT_API ImageUrl : public BaseHandle
49 * Default Constructor.
50 * Resulting URL is not valid
60 * @brief Create an initialized ImageUrl.
62 * @param[in] texture The texture url is got from external buffer.
63 * @return A handle to a newly allocated Dali resource.
65 static ImageUrl New(Texture& texture);
68 * @brief Create an initialized ImageUrl.
70 * @param[in] encodedImageBuffer The encoded image buffer url is got from external buffer.
71 * @return A handle to a newly allocated Dali resource.
73 static ImageUrl New(const EncodedImageBuffer& encodedImageBuffer);
76 * @brief Downcast an Object handle to ImageUrl handle.
78 * If handle points to a ImageUrl object the downcast produces valid
79 * handle. If not the returned handle is left uninitialized.
81 * @param[in] handle to An object.
82 * @return handle to a ImageUrl object or an uninitialized handle.
84 static ImageUrl DownCast(BaseHandle handle);
88 * @param[in] url The url to copy
90 ImageUrl(const ImageUrl& url);
94 * @param[in] url The url to copy
96 ImageUrl& operator=(const ImageUrl& url);
99 * @brief Move constructor.
100 * @param[in] rhs A reference to the moved handle
102 ImageUrl(ImageUrl&& rhs);
105 * @brief Move assignment operator.
106 * @param[in] rhs A reference to the moved handle
107 * @return A reference to this handle
109 ImageUrl& operator=(ImageUrl&& rhs);
113 * @return Returns url's string
115 const std::string& GetUrl() const;
117 public: // Not intended for application developers
120 * @brief This constructor is used by New() methods.
122 * @param[in] internal A pointer to a newly allocated Dali resource.
124 explicit DALI_INTERNAL ImageUrl(Toolkit::Internal::ImageUrl* internal);
128 } // namespace Toolkit
132 #endif /* DALI_TOOLKIT_IMAGE_URL_H */