1 #ifndef __DALI_TOOLKIT_INTERNAL_ImageView_H__
2 #define __DALI_TOOLKIT_INTERNAL_ImageView_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
22 #include <dali-toolkit/public-api/controls/control-impl.h>
23 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
36 typedef IntrusivePtr<ImageView> ImageViewPtr;
39 * @copydoc Toolkit::ImageView
41 class ImageView : public Control
45 typedef Toolkit::ImageView::ImageType ImageType;
48 * ImageRequest element
49 * represents an image to be loaded and displayed
50 * with given attributes.
62 * @param[in] filename to load
63 * @param[in] width Width of image.
64 * @param[in] height Height of image.
66 ImageRequest( const std::string& filename, unsigned int width, unsigned int height )
67 : mFilename( filename )
69 mAttributes.SetSize( width, height );
72 std::string mFilename; ///< filename of image
73 ImageAttributes mAttributes; ///< attributes of image
79 * Create a new ImageView.
80 * @return A public handle to the newly allocated ImageView.
82 static Dali::Toolkit::ImageView New();
87 * @copydoc Toolkit::ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
89 void SetImage(const std::string& filename, ImageType type, float min, float max);
92 * @copydoc Toolkit::ImageView::SetImage(Image& image);
94 void SetImage(Image image);
97 * Adds an image to displayed at a detail range.
99 * @note If two or more images are specified to be displayed at
100 * the same overlapping range. Then the last image that was added
103 * @param[in] req The image to load and display
104 * @param[in] condition The detail condition to be satisified for the image to display
106 void AddImage(ImageRequest& req, PropertyCondition condition);
109 * @copydoc Toolkit::ImageView::SetCameraActor
111 void SetCameraActor(CameraActor camera, float detailFactor);
114 * @copydoc Toolkit::ImageView::SetDetail
116 void SetDetail(float detail);
121 * Construct a new ImageView.
126 * 2nd-phase initialization.
131 * A reference counted object may only be deleted by calling Unreference()
133 virtual ~ImageView();
138 * Sets a Bitmap Image as the image to display for this ImageView
139 * min and max represent the minimum and maximum sizes to load.
140 * sizes will be created at 2^n scale factor. where n goes from
141 * ceil(log2(min)) to ceil(log2(max))
143 * @param[in] filename the image path to load
144 * @param[in] min the minimum size to load
145 * @param[in] max the maximum size to load
147 void SetImageBitmap(const std::string& filename, float min, float max);
150 * Sets a Distance Field Image as the image to display for this ImageView
152 * @param[in] filename the image path to load
154 void SetImageDistanceField(const std::string& filename);
157 * Invoked whenever the detail property passes a notification point.
158 * @param[in] notification The notification instance.
160 virtual void OnDetailChange(PropertyNotification& notification );
165 ImageView(const ImageView&);
168 ImageView& operator=(const ImageView& rhs);
172 Property::Index mPropertyDetail; ///< Detail property, changing this affects the level of detail of the content.
173 ImageActor mImageActor; ///< Holding image actor for the various images at differing levels of detail.
174 std::map<PropertyNotification, ImageRequest> mNotifications; ///< Property Notification -> Image map table.
176 PropertyNotification mPropertyNotification; ///< Property notification
179 } // namespace Internal
181 // Helpers for public-api forwarding methods
183 inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& pub)
185 DALI_ASSERT_ALWAYS(pub);
187 Dali::RefObject& handle = pub.GetImplementation();
189 return static_cast<Toolkit::Internal::ImageView&>(handle);
192 inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& pub)
194 DALI_ASSERT_ALWAYS(pub);
196 const Dali::RefObject& handle = pub.GetImplementation();
198 return static_cast<const Toolkit::Internal::ImageView&>(handle);
201 } // namespace Toolkit
205 #endif // __DALI_TOOLKIT_INTERNAL_ImageView_H__