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 <dali/dali.h>
23 #include <dali-toolkit/public-api/controls/control-impl.h>
24 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
37 typedef IntrusivePtr<ImageView> ImageViewPtr;
40 * @copydoc Toolkit::ImageView
42 class ImageView : public Control
46 typedef Toolkit::ImageView::ImageType ImageType;
49 * ImageRequest element
50 * represents an image to be loaded and displayed
51 * with given attributes.
63 * @param[in] filename to load
64 * @param[in] width Width of image.
65 * @param[in] height Height of image.
67 ImageRequest( const std::string& filename, unsigned int width, unsigned int height )
68 : mFilename( filename )
70 mAttributes.SetSize( width, height );
73 std::string mFilename; ///< filename of image
74 ImageAttributes mAttributes; ///< attributes of image
80 * Create a new ImageView.
81 * @return A public handle to the newly allocated ImageView.
83 static Dali::Toolkit::ImageView New();
88 * @copydoc Toolkit::ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
90 void SetImage(const std::string& filename, ImageType type, float min, float max);
93 * @copydoc Toolkit::ImageView::SetImage(Image& image);
95 void SetImage(Image image);
98 * Adds an image to displayed at a detail range.
100 * @note If two or more images are specified to be displayed at
101 * the same overlapping range. Then the last image that was added
104 * @param[in] req The image to load and display
105 * @param[in] condition The detail condition to be satisified for the image to display
107 void AddImage(ImageRequest& req, PropertyCondition condition);
110 * @copydoc Toolkit::ImageView::SetCameraActor
112 void SetCameraActor(CameraActor camera, float detailFactor);
115 * @copydoc Toolkit::ImageView::SetDetail
117 void SetDetail(float detail);
122 * Construct a new ImageView.
127 * 2nd-phase initialization.
132 * A reference counted object may only be deleted by calling Unreference()
134 virtual ~ImageView();
139 * Sets a Bitmap Image as the image to display for this ImageView
140 * min and max represent the minimum and maximum sizes to load.
141 * sizes will be created at 2^n scale factor. where n goes from
142 * ceil(log2(min)) to ceil(log2(max))
144 * @param[in] filename the image path to load
145 * @param[in] min the minimum size to load
146 * @param[in] max the maximum size to load
148 void SetImageBitmap(const std::string& filename, float min, float max);
151 * Sets a Distance Field Image as the image to display for this ImageView
153 * @param[in] filename the image path to load
155 void SetImageDistanceField(const std::string& filename);
158 * Invoked whenever the detail property passes a notification point.
159 * @param[in] notification The notification instance.
161 virtual void OnDetailChange(PropertyNotification& notification );
166 ImageView(const ImageView&);
169 ImageView& operator=(const ImageView& rhs);
173 Property::Index mPropertyDetail; ///< Detail property, changing this affects the level of detail of the content.
174 ImageActor mImageActor; ///< Holding image actor for the various images at differing levels of detail.
175 std::map<PropertyNotification, ImageRequest> mNotifications; ///< Property Notification -> Image map table.
177 PropertyNotification mPropertyNotification; ///< Property notification
180 } // namespace Internal
182 // Helpers for public-api forwarding methods
184 inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& pub)
186 DALI_ASSERT_ALWAYS(pub);
188 Dali::RefObject& handle = pub.GetImplementation();
190 return static_cast<Toolkit::Internal::ImageView&>(handle);
193 inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& pub)
195 DALI_ASSERT_ALWAYS(pub);
197 const Dali::RefObject& handle = pub.GetImplementation();
199 return static_cast<const Toolkit::Internal::ImageView&>(handle);
202 } // namespace Toolkit
206 #endif // __DALI_TOOLKIT_INTERNAL_ImageView_H__