X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fpublic-api%2Fcontrols%2Fimage-view%2Fimage-view.cpp;h=33332896cc2fba13183055067d83d83fa9972d2d;hp=ac42aeb2dc6c6e2f55efa5aa692eb9dfb1642ac7;hb=0d8064d02fc1c0a8c343b5a201b91098984ceb88;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/public-api/controls/image-view/image-view.cpp b/dali-toolkit/public-api/controls/image-view/image-view.cpp index ac42aeb..3333289 100644 --- a/dali-toolkit/public-api/controls/image-view/image-view.cpp +++ b/dali-toolkit/public-api/controls/image-view/image-view.cpp @@ -1,31 +1,29 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER #include -#include -#include -using namespace Dali; +// EXTERNAL INCLUDES +#include +#include -namespace -{ -const float DEFAULT_MINIMUM_DETAIL = 0.125f; ///< Default Minimum Detail level 12.5% of original size. -const float DEFAULT_MAXIMUM_DETAIL = 1.0f; ///< Default Maximum Detail level 100% (original size) -const float CAMERA_100_PCT_DISTANCE(1695.0f); ///< Based on Camera/Viewport/Projection settings at this distance object is 100% size. -} // unnamed namespace +// INTERNAL INCLUDES +#include namespace Dali { @@ -33,87 +31,88 @@ namespace Dali namespace Toolkit { -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ImageView -/////////////////////////////////////////////////////////////////////////////////////////////////// - -const std::string ImageView::DETAIL_PROPERTY_NAME( "image-view-detail" ); - ImageView::ImageView() { } -ImageView::ImageView( const ImageView& handle ) -: Control( handle ) +ImageView::ImageView( const ImageView& imageView ) +: Control( imageView ) { } -ImageView& ImageView::operator=( const ImageView& handle ) +ImageView& ImageView::operator=( const ImageView& imageView ) { - if( &handle != this ) + if( &imageView != this ) { - Control::operator=( handle ); + Control::operator=( imageView ); } return *this; } -ImageView::ImageView(Internal::ImageView& implementation) -: Control(implementation) +ImageView::~ImageView() { } -ImageView::ImageView( Dali::Internal::CustomActor* internal ) -: Control( internal ) +ImageView ImageView::New() { - VerifyCustomActorPointer(internal); + return Internal::ImageView::New(); } -ImageView ImageView::New() +ImageView ImageView::New( Image image ) { - return Internal::ImageView::New(); + ImageView imageView = Internal::ImageView::New(); + imageView.SetImage( image ); + return imageView; } -ImageView ImageView::DownCast( BaseHandle handle ) +ImageView ImageView::New( const std::string& url ) { - return Control::DownCast( handle ); + ImageView imageView = Internal::ImageView::New(); + imageView.SetImage( url, ImageDimensions() ); + return imageView; } -ImageView::~ImageView() +ImageView ImageView::New( const std::string& url, ImageDimensions size ) +{ + ImageView imageView = Internal::ImageView::New(); + imageView.SetImage( url, size ); + return imageView; +} + +ImageView ImageView::DownCast( BaseHandle handle ) { + return Control::DownCast( handle ); } -void ImageView::SetImage(const std::string& filename, ImageType type) +void ImageView::SetImage( Image image ) { - GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL ); + Dali::Toolkit::GetImpl( *this ).SetImage( image ); } -void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max) +void ImageView::SetImage( const std::string& url ) { - GetImpl(*this).SetImage( filename, type, min, max ); + Dali::Toolkit::GetImpl( *this ).SetImage( url, ImageDimensions() ); } -void ImageView::SetImage(Image image) +void ImageView::SetImage( const std::string& url, ImageDimensions size ) { - GetImpl(*this).SetImage( image ); + Dali::Toolkit::GetImpl( *this ).SetImage( url, size ); } -void ImageView::SetCameraActor(CameraActor camera) +Image ImageView::GetImage() const { - // TODO: Default detail factor should be calculated based on - // current Camera's field of view/viewport/projection. - // Ideal place would be inside the constraint, and have the Camera - // settings as properties. - GetImpl(*this).SetCameraActor( camera, CAMERA_100_PCT_DISTANCE ); + return Image(); } -void ImageView::SetCameraActor(CameraActor camera, float detailFactor) +ImageView::ImageView( Internal::ImageView& implementation ) + : Control( implementation ) { - GetImpl(*this).SetCameraActor( camera, detailFactor ); } -void ImageView::SetDetail(float detail) +ImageView::ImageView( Dali::Internal::CustomActor* internal ) + : Control( internal ) { - GetImpl(*this).SetDetail( detail ); + VerifyCustomActorPointer( internal ); } } // namespace Toolkit