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 <boost/bind.hpp>
24 #include <dali/dali.h>
25 #include <dali-toolkit/public-api/controls/control-impl.h>
26 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
39 typedef IntrusivePtr<ImageView> ImageViewPtr;
42 * @copydoc Toolkit::ImageView
44 class ImageView : public Control
48 typedef Toolkit::ImageView::ImageType ImageType;
51 * ImageRequest element
52 * represents an image to be loaded and displayed
53 * with given attributes.
65 * @param[in] filename to load
66 * @param[in] width Width of image.
67 * @param[in] height Height of image.
69 ImageRequest( const std::string& filename, unsigned int width, unsigned int height )
70 : mFilename( filename )
72 mAttributes.SetSize( width, height );
75 std::string mFilename; ///< filename of image
76 ImageAttributes mAttributes; ///< attributes of image
82 * Create a new ImageView.
83 * @return A public handle to the newly allocated ImageView.
85 static Dali::Toolkit::ImageView New();
90 * @copydoc Toolkit::ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
92 void SetImage(const std::string& filename, ImageType type, float min, float max);
95 * @copydoc Toolkit::ImageView::SetImage(Image& image);
97 void SetImage(Image image);
100 * Adds an image to displayed at a detail range.
102 * @note If two or more images are specified to be displayed at
103 * the same overlapping range. Then the last image that was added
106 * @param[in] req The image to load and display
107 * @param[in] condition The detail condition to be satisified for the image to display
109 void AddImage(ImageRequest& req, PropertyCondition condition);
112 * @copydoc Toolkit::ImageView::SetCameraActor
114 void SetCameraActor(CameraActor camera, float detailFactor);
117 * @copydoc Toolkit::ImageView::SetDetail
119 void SetDetail(float detail);
124 * Construct a new ImageView.
129 * 2nd-phase initialization.
134 * A reference counted object may only be deleted by calling Unreference()
136 virtual ~ImageView();
141 * Sets a Bitmap Image as the image to display for this ImageView
142 * min and max represent the minimum and maximum sizes to load.
143 * sizes will be created at 2^n scale factor. where n goes from
144 * ceil(log2(min)) to ceil(log2(max))
146 * @param[in] filename the image path to load
147 * @param[in] min the minimum size to load
148 * @param[in] max the maximum size to load
150 void SetImageBitmap(const std::string& filename, float min, float max);
153 * Sets a Distance Field Image as the image to display for this ImageView
155 * @param[in] filename the image path to load
157 void SetImageDistanceField(const std::string& filename);
160 * Invoked whenever the detail property passes a notification point.
161 * @param[in] notification The notification instance.
163 virtual void OnDetailChange(PropertyNotification& notification );
168 ImageView(const ImageView&);
171 ImageView& operator=(const ImageView& rhs);
175 Property::Index mPropertyDetail; ///< Detail property, changing this affects the level of detail of the content.
176 ImageActor mImageActor; ///< Holding image actor for the various images at differing levels of detail.
177 std::map<PropertyNotification, ImageRequest> mNotifications; ///< Property Notification -> Image map table.
179 PropertyNotification mPropertyNotification; ///< Property notification
182 } // namespace Internal
184 // Helpers for public-api forwarding methods
186 inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& pub)
188 DALI_ASSERT_ALWAYS(pub);
190 Dali::RefObject& handle = pub.GetImplementation();
192 return static_cast<Toolkit::Internal::ImageView&>(handle);
195 inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& pub)
197 DALI_ASSERT_ALWAYS(pub);
199 const Dali::RefObject& handle = pub.GetImplementation();
201 return static_cast<const Toolkit::Internal::ImageView&>(handle);
204 } // namespace Toolkit
208 #endif // __DALI_TOOLKIT_INTERNAL_ImageView_H__