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 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 <boost/bind.hpp>
25 #include <dali/dali.h>
26 #include <dali-toolkit/public-api/controls/control-impl.h>
27 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
40 typedef IntrusivePtr<ImageView> ImageViewPtr;
43 * @copydoc Toolkit::ImageView
45 class ImageView : public ControlImpl
49 typedef Toolkit::ImageView::ImageType ImageType;
52 * ImageRequest element
53 * represents an image to be loaded and displayed
54 * with given attributes.
66 * @param[in] filename to load
67 * @param[in] width Width of image.
68 * @param[in] height Height of image.
70 ImageRequest( const std::string& filename, unsigned int width, unsigned int height )
71 : mFilename( filename )
73 mAttributes.SetSize( width, height );
76 std::string mFilename; ///< filename of image
77 ImageAttributes mAttributes; ///< attributes of image
83 * Create a new ImageView.
84 * @return A public handle to the newly allocated ImageView.
86 static Dali::Toolkit::ImageView New();
91 * @copydoc Toolkit::ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
93 void SetImage(const std::string& filename, ImageType type, float min, float max);
96 * @copydoc Toolkit::ImageView::SetImage(Image& image);
98 void SetImage(Image image);
101 * Adds an image to displayed at a detail range.
103 * @note If two or more images are specified to be displayed at
104 * the same overlapping range. Then the last image that was added
107 * @param[in] req The image to load and display
108 * @param[in] condition The detail condition to be satisified for the image to display
110 void AddImage(ImageRequest& req, PropertyCondition condition);
113 * @copydoc Toolkit::ImageView::SetCameraActor
115 void SetCameraActor(CameraActor camera, float detailFactor);
118 * @copydoc Toolkit::ImageView::SetDetail
120 void SetDetail(float detail);
125 * Construct a new ImageView.
130 * 2nd-phase initialization.
135 * A reference counted object may only be deleted by calling Unreference()
137 virtual ~ImageView();
142 * Sets a Bitmap Image as the image to display for this ImageView
143 * min and max represent the minimum and maximum sizes to load.
144 * sizes will be created at 2^n scale factor. where n goes from
145 * ceil(log2(min)) to ceil(log2(max))
147 * @param[in] filename the image path to load
148 * @param[in] min the minimum size to load
149 * @param[in] max the maximum size to load
151 void SetImageBitmap(const std::string& filename, float min, float max);
154 * Sets a Distance Field Image as the image to display for this ImageView
156 * @param[in] filename the image path to load
158 void SetImageDistanceField(const std::string& filename);
161 * Invoked whenever the detail property passes a notification point.
162 * @param[in] notification The notification instance.
164 virtual void OnDetailChange(PropertyNotification& notification );
169 ImageView(const ImageView&);
172 ImageView& operator=(const ImageView& rhs);
176 Property::Index mPropertyDetail; ///< Detail property, changing this affects the level of detail of the content.
177 ImageActor mImageActor; ///< Holding image actor for the various images at differing levels of detail.
178 std::map<PropertyNotification, ImageRequest> mNotifications; ///< Property Notification -> Image map table.
180 PropertyNotification mPropertyNotification; ///< Property notification
183 } // namespace Internal
185 // Helpers for public-api forwarding methods
187 inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& pub)
189 DALI_ASSERT_ALWAYS(pub);
191 Dali::RefObject& handle = pub.GetImplementation();
193 return static_cast<Toolkit::Internal::ImageView&>(handle);
196 inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& pub)
198 DALI_ASSERT_ALWAYS(pub);
200 const Dali::RefObject& handle = pub.GetImplementation();
202 return static_cast<const Toolkit::Internal::ImageView&>(handle);
205 } // namespace Toolkit
209 #endif // __DALI_TOOLKIT_INTERNAL_ImageView_H__