1 #ifndef DALI_CANVAS_RENDERER_PICTURE_H
2 #define DALI_CANVAS_RENDERER_PICTURE_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/object/base-handle.h>
25 #include <dali/devel-api/adaptor-framework/canvas-renderer-drawable.h>
26 #include <dali/devel-api/adaptor-framework/canvas-renderer.h>
27 #include <dali/public-api/dali-adaptor-common.h>
32 * @addtogroup dali_adaptor_framework
36 namespace Internal DALI_INTERNAL
42 } // namespace Adaptor
43 } // namespace DALI_INTERNAL
46 * @brief A class representing an image read in one of the supported formats: raw, svg, png and etc.
47 * Besides the methods inherited from the Drawable, it provides methods to load & draw images on the canvas.
49 class DALI_ADAPTOR_API CanvasRenderer::Picture : public CanvasRenderer::Drawable
53 * @brief Creates an initialized handle to a new CanvasRenderer::Picture.
55 * @return A handle to a newly allocated Picture
61 * @brief Creates an empty handle.
62 * Use CanvasRenderer::Picture::New() to create an initialized object.
72 * @brief This copy constructor is required for (smart) pointer semantics.
74 * @param[in] handle A reference to the copied handle
76 Picture(const Picture& handle) = default;
80 * @brief Loads a picture data directly from a file.
81 * @param[in] url A path to the picture file.
82 * @return Returns True when it's successful. False otherwise.
84 bool Load(const std::string& url);
87 * @brief Resize the picture content with the given size.
89 * Resize the picture content while keeping the default size aspect ratio.
90 * The scaling factor is established for each of dimensions and the smaller value is applied to both of them.
91 * @param[in] size A new size of the image in pixels.
92 * @return Returns True when it's successful. False otherwise.
94 bool SetSize(Vector2 size);
97 * @brief Gets the size of the image.
98 * @return Returns The size of the image in pixels.
100 Vector2 GetSize() const;
102 public: // Not intended for application developers
105 * @brief The constructor.
106 * @note Not intended for application developers.
108 * @param[in] pointer A pointer to a newly allocated CanvasRenderer::Picture
110 explicit DALI_INTERNAL Picture(Internal::Adaptor::Picture* impl);
119 #endif // DALI_CANVAS_RENDERER_PICTURE_H