2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
19 #include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
20 #include <dali-toolkit/public-api/controls/buttons/button.h>
26 const float DEFAULT_MINIMUM_DETAIL = 0.125f; ///< Default Minimum Detail level 12.5% of original size.
27 const float DEFAULT_MAXIMUM_DETAIL = 1.0f; ///< Default Maximum Detail level 100% (original size)
28 const float CAMERA_100_PCT_DISTANCE(1695.0f); ///< Based on Camera/Viewport/Projection settings at this distance object is 100% size.
29 } // unnamed namespace
37 ///////////////////////////////////////////////////////////////////////////////////////////////////
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 const std::string ImageView::DETAIL_PROPERTY_NAME( "image-view-detail" );
43 ImageView::ImageView()
47 ImageView::ImageView( const ImageView& handle )
52 ImageView& ImageView::operator=( const ImageView& handle )
56 Control::operator=( handle );
61 ImageView::ImageView(Internal::ImageView& implementation)
62 : Control(implementation)
66 ImageView::ImageView( Dali::Internal::CustomActor* internal )
69 VerifyCustomActorPointer<Internal::ImageView>(internal);
72 ImageView ImageView::New()
74 return Internal::ImageView::New();
77 ImageView ImageView::DownCast( BaseHandle handle )
79 return Control::DownCast<ImageView, Internal::ImageView>( handle );
82 ImageView::~ImageView()
86 void ImageView::SetImage(const std::string& filename, ImageType type)
88 GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL );
91 void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
93 GetImpl(*this).SetImage( filename, type, min, max );
96 void ImageView::SetImage(Image image)
98 GetImpl(*this).SetImage( image );
101 void ImageView::SetCameraActor(CameraActor camera)
103 // TODO: Default detail factor should be calculated based on
104 // current Camera's field of view/viewport/projection.
105 // Ideal place would be inside the constraint, and have the Camera
106 // settings as properties.
107 GetImpl(*this).SetCameraActor( camera, CAMERA_100_PCT_DISTANCE );
110 void ImageView::SetCameraActor(CameraActor camera, float detailFactor)
112 GetImpl(*this).SetCameraActor( camera, detailFactor );
115 void ImageView::SetDetail(float detail)
117 GetImpl(*this).SetDetail( detail );
120 } // namespace Toolkit