2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
18 #include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
19 #include <dali-toolkit/public-api/controls/buttons/button.h>
25 const float DEFAULT_MINIMUM_DETAIL = 0.125f; ///< Default Minimum Detail level 12.5% of original size.
26 const float DEFAULT_MAXIMUM_DETAIL = 1.0f; ///< Default Maximum Detail level 100% (original size)
27 const float CAMERA_100_PCT_DISTANCE(1695.0f); ///< Based on Camera/Viewport/Projection settings at this distance object is 100% size.
28 } // unnamed namespace
36 ///////////////////////////////////////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 const std::string ImageView::DETAIL_PROPERTY_NAME( "image-view-detail" );
42 ImageView::ImageView()
46 ImageView::ImageView( const ImageView& handle )
51 ImageView& ImageView::operator=( const ImageView& handle )
55 Control::operator=( handle );
60 ImageView::ImageView(Internal::ImageView& implementation)
61 : Control(implementation)
65 ImageView::ImageView( Dali::Internal::CustomActor* internal )
68 VerifyCustomActorPointer<Internal::ImageView>(internal);
71 ImageView ImageView::New()
73 return Internal::ImageView::New();
76 ImageView ImageView::DownCast( BaseHandle handle )
78 return Control::DownCast<ImageView, Internal::ImageView>( handle );
81 ImageView::~ImageView()
85 void ImageView::SetImage(const std::string& filename, ImageType type)
87 GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL );
90 void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
92 GetImpl(*this).SetImage( filename, type, min, max );
95 void ImageView::SetImage(Image image)
97 GetImpl(*this).SetImage( image );
100 void ImageView::SetCameraActor(CameraActor camera)
102 // TODO: Default detail factor should be calculated based on
103 // current Camera's field of view/viewport/projection.
104 // Ideal place would be inside the constraint, and have the Camera
105 // settings as properties.
106 GetImpl(*this).SetCameraActor( camera, CAMERA_100_PCT_DISTANCE );
109 void ImageView::SetCameraActor(CameraActor camera, float detailFactor)
111 GetImpl(*this).SetCameraActor( camera, detailFactor );
114 void ImageView::SetDetail(float detail)
116 GetImpl(*this).SetDetail( detail );
119 } // namespace Toolkit