#include <dali-toolkit/public-api/controls/effects-view/effects-view.h>
#include <dali-toolkit/public-api/controls/gaussian-blur-view/gaussian-blur-view.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/magnifier/magnifier.h>
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-view.h>
#include <dali-toolkit/public-api/controls/page-turn-view/page-turn-portrait-view.h>
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <dali-toolkit/internal/controls/image-view/image-view-impl.h>
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/animation/constraints.h>
-#include <dali/public-api/object/type-registry.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/shader-effects/distance-field-effect.h>
-
-using namespace Dali;
-
-namespace
-{
-//Type registration
-BaseHandle Create()
-{
- return Toolkit::ImageView::New();
-}
-TypeRegistration mType( typeid(Toolkit::ImageView), typeid(Toolkit::Control), Create );
-
- /**
- * CameraDetailConstraint, generates detail value
- * based on camera's position and ImageView's position.
- */
- struct CameraDetailConstraint
- {
- CameraDetailConstraint(float detailFactor)
- : mDetailFactor(detailFactor)
- {
-
- }
-
- float operator()(const float& current,
- const PropertyInput& propertyTargetPosition,
- const PropertyInput& propertySourcePosition)
- {
- const Vector3& targetPosition = propertyTargetPosition.GetVector3();
- const Vector3& sourcePosition = propertySourcePosition.GetVector3();
- const float distance = (targetPosition - sourcePosition).Length();
- const float detail = mDetailFactor / distance;
-
- return detail;
- }
-
- const float mDetailFactor;
- };
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// ImageView
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-Dali::Toolkit::ImageView ImageView::New()
-{
- // Create the implementation
- ImageViewPtr imageView(new ImageView());
-
- // Pass ownership to CustomActor via derived handle
- Dali::Toolkit::ImageView handle(*imageView);
-
- // Second-phase init of the implementation
- // This can only be done after the CustomActor connection has been made...
- imageView->Initialize();
-
- return handle;
-}
-
-ImageView::ImageView()
-: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
- mPropertyDetail( Property::INVALID_INDEX )
-{
-}
-
-void ImageView::Initialize()
-{
- Actor self = Self();
- // Register property that represents the level of detail.
- mPropertyDetail = self.RegisterProperty(Toolkit::ImageView::DETAIL_PROPERTY_NAME, 0.0f);
-
- // Create an empty image actor, filling the entire size of this ImageView.
- Image emptyImage;
- mImageActor = ImageActor::New( emptyImage );
- self.Add( mImageActor );
- mImageActor.SetParentOrigin( ParentOrigin::CENTER );
-}
-
-ImageView::~ImageView()
-{
-
-}
-
-void ImageView::OnControlSizeSet( const Vector3& targetSize )
-{
- mImageActor.SetSize( targetSize );
-}
-
-void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
-{
- switch(type)
- {
- case Toolkit::ImageView::BitmapType:
- {
- SetImageBitmap(filename, min, max);
- break;
- }
- case Toolkit::ImageView::DistanceFieldType:
- {
- SetImageDistanceField(filename);
- break;
- }
- }
-}
-
-void ImageView::SetImageBitmap(const std::string& filename, float min, float max)
-{
- int minLevel = ceilf(logf(min) / logf(2.0f));
- int maxLevel = ceilf(logf(max) / logf(2.0f));
-
- ImageAttributes attributes;
- const Vector3 size = Self().GetCurrentSize();
-
- if(minLevel==maxLevel)
- { // Single image detail level, no need for any notifications.
- const float detail = powf(2.0f, maxLevel);
- attributes.SetSize( size.x * detail, size.y * detail );
- Image image = Image::New( filename, attributes);
- mImageActor.SetImage( image );
- }
- else
- { // Multi image detail level...
- for( int level = minLevel; level <= maxLevel; level++)
- {
- const float minDetail = powf(2.0f, level - 1);
- const float maxDetail = powf(2.0f, level);
- ImageRequest req(filename, size.x * maxDetail, size.y * maxDetail );
-
- if(level==minLevel)
- {
- AddImage(req, LessThanCondition(maxDetail) );
- }
- else if(level==maxLevel)
- {
- AddImage(req, GreaterThanCondition(minDetail) );
- }
- else
- {
- AddImage(req, InsideCondition(minDetail, maxDetail) );
- }
- }
- }
-}
-
-void ImageView::SetImageDistanceField(const std::string& filename)
-{
- ImageAttributes attributes = Dali::ImageAttributes::NewDistanceField(1.0f, 1);
- const Vector3 size = Self().GetCurrentSize();
-
- attributes.SetSize( size.x, size.y );
- Image image = Image::NewDistanceField(filename, attributes);
- mImageActor.SetImage( image );
-
- DistanceFieldEffect effect = DistanceFieldEffect::New();
- mImageActor.SetShaderEffect( effect );
-}
-
-void ImageView::SetImage(Image image)
-{
- mImageActor.SetImage( image );
-}
-
-void ImageView::AddImage(ImageRequest& req, PropertyCondition condition)
-{
- Actor self = Self();
-
- PropertyNotification notification = self.AddPropertyNotification( mPropertyDetail, condition );
-
- notification.NotifySignal().Connect( this, &ImageView::OnDetailChange );
-
- mNotifications[notification] = req;
-}
-
-void ImageView::SetDetail(float detail)
-{
- Self().SetProperty( mPropertyDetail, detail );
-}
-
-void ImageView::SetCameraActor(CameraActor camera, float detailFactor)
-{
- Constraint constraint = Constraint::New<float>( mPropertyDetail,
- LocalSource( Actor::WORLD_POSITION ),
- Source( camera, Actor::WORLD_POSITION ),
- CameraDetailConstraint(detailFactor));
- Self().RemoveConstraints();
- Self().ApplyConstraint(constraint);
-}
-
-void ImageView::OnDetailChange( PropertyNotification& notification )
-{
- ImageRequest& req = mNotifications[notification];
- Image image = Image::New( req.mFilename, req.mAttributes );
- mImageActor.SetImage( image );
-}
-
-} // namespace Internal
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_INTERNAL_ImageView_H__
-#define __DALI_TOOLKIT_INTERNAL_ImageView_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/actors/image-actor.h>
-#include <dali/public-api/common/map-wrapper.h>
-#include <dali/public-api/images/image-attributes.h>
-#include <dali/public-api/object/property-notification.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal
-{
-
-class ImageView;
-
-typedef IntrusivePtr<ImageView> ImageViewPtr;
-
-/**
- * @copydoc Toolkit::ImageView
- */
-class ImageView : public Control
-{
-public:
-
- typedef Toolkit::ImageView::ImageType ImageType;
-
- /**
- * ImageRequest element
- * represents an image to be loaded and displayed
- * with given attributes.
- */
- struct ImageRequest
- {
- /**
- * Default constructor
- */
- ImageRequest()
- {
- }
-
- /**
- * @param[in] filename to load
- * @param[in] width Width of image.
- * @param[in] height Height of image.
- */
- ImageRequest( const std::string& filename, unsigned int width, unsigned int height )
- : mFilename( filename )
- {
- mAttributes.SetSize( width, height );
- }
-
- std::string mFilename; ///< filename of image
- ImageAttributes mAttributes; ///< attributes of image
- };
-
-public:
-
- /**
- * Create a new ImageView.
- * @return A public handle to the newly allocated ImageView.
- */
- static Dali::Toolkit::ImageView New();
-
-public:
-
- /**
- * @copydoc Toolkit::ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
- */
- void SetImage(const std::string& filename, ImageType type, float min, float max);
-
- /**
- * @copydoc Toolkit::ImageView::SetImage(Image& image);
- */
- void SetImage(Image image);
-
- /**
- * Adds an image to displayed at a detail range.
- *
- * @note If two or more images are specified to be displayed at
- * the same overlapping range. Then the last image that was added
- * will be displayed.
- *
- * @param[in] req The image to load and display
- * @param[in] condition The detail condition to be satisified for the image to display
- */
- void AddImage(ImageRequest& req, PropertyCondition condition);
-
- /**
- * @copydoc Toolkit::ImageView::SetCameraActor
- */
- void SetCameraActor(CameraActor camera, float detailFactor);
-
- /**
- * @copydoc Toolkit::ImageView::SetDetail
- */
- void SetDetail(float detail);
-
-protected:
-
- /**
- * Construct a new ImageView.
- */
- ImageView();
-
- /**
- * 2nd-phase initialization.
- */
- void Initialize();
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~ImageView();
-
- /**
- *
- * @copydoc Toolkit::Control::OnControlSizeSet( const Vector3& targetSize )
- */
- virtual void OnControlSizeSet( const Vector3& targetSize );
-
-private:
-
- /**
- * Sets a Bitmap Image as the image to display for this ImageView
- * min and max represent the minimum and maximum sizes to load.
- * sizes will be created at 2^n scale factor. where n goes from
- * ceil(log2(min)) to ceil(log2(max))
- *
- * @param[in] filename the image path to load
- * @param[in] min the minimum size to load
- * @param[in] max the maximum size to load
- */
- void SetImageBitmap(const std::string& filename, float min, float max);
-
- /**
- * Sets a Distance Field Image as the image to display for this ImageView
- *
- * @param[in] filename the image path to load
- */
- void SetImageDistanceField(const std::string& filename);
-
- /**
- * Invoked whenever the detail property passes a notification point.
- * @param[in] notification The notification instance.
- */
- virtual void OnDetailChange(PropertyNotification& notification );
-
-private:
-
- // Undefined
- ImageView(const ImageView&);
-
- // Undefined
- ImageView& operator=(const ImageView& rhs);
-
-private:
-
- Property::Index mPropertyDetail; ///< Detail property, changing this affects the level of detail of the content.
- ImageActor mImageActor; ///< Holding image actor for the various images at differing levels of detail.
- std::map<PropertyNotification, ImageRequest> mNotifications; ///< Property Notification -> Image map table.
-
- PropertyNotification mPropertyNotification; ///< Property notification
-};
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Toolkit::Internal::ImageView& GetImpl(Toolkit::ImageView& pub)
-{
- DALI_ASSERT_ALWAYS(pub);
-
- Dali::RefObject& handle = pub.GetImplementation();
-
- return static_cast<Toolkit::Internal::ImageView&>(handle);
-}
-
-inline const Toolkit::Internal::ImageView& GetImpl(const Toolkit::ImageView& pub)
-{
- DALI_ASSERT_ALWAYS(pub);
-
- const Dali::RefObject& handle = pub.GetImplementation();
-
- return static_cast<const Toolkit::Internal::ImageView&>(handle);
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_INTERNAL_ImageView_H__
$(toolkit_optional_src_dir)/controls/cluster/cluster-style-impl.cpp \
$(toolkit_optional_src_dir)/controls/effects-view/effects-view-impl.cpp \
$(toolkit_optional_src_dir)/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp \
- $(toolkit_optional_src_dir)/controls/image-view/image-view-impl.cpp \
$(toolkit_optional_src_dir)/controls/image-view/masked-image-view-impl.cpp \
$(toolkit_optional_src_dir)/controls/page-turn-view/page-turn-view-impl.cpp \
$(toolkit_optional_src_dir)/controls/page-turn-view/page-turn-portrait-view-impl.cpp \
+++ /dev/null
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/internal/controls/image-view/image-view-impl.h>
-#include <dali-toolkit/public-api/controls/buttons/button.h>
-
-using namespace Dali;
-
-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
-
-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::operator=( const ImageView& handle )
-{
- if( &handle != this )
- {
- Control::operator=( handle );
- }
- return *this;
-}
-
-ImageView::ImageView(Internal::ImageView& implementation)
-: Control(implementation)
-{
-}
-
-ImageView::ImageView( Dali::Internal::CustomActor* internal )
-: Control( internal )
-{
- VerifyCustomActorPointer<Internal::ImageView>(internal);
-}
-
-ImageView ImageView::New()
-{
- return Internal::ImageView::New();
-}
-
-ImageView ImageView::DownCast( BaseHandle handle )
-{
- return Control::DownCast<ImageView, Internal::ImageView>( handle );
-}
-
-ImageView::~ImageView()
-{
-}
-
-void ImageView::SetImage(const std::string& filename, ImageType type)
-{
- GetImpl(*this).SetImage( filename, type, DEFAULT_MINIMUM_DETAIL, DEFAULT_MAXIMUM_DETAIL );
-}
-
-void ImageView::SetImage(const std::string& filename, ImageType type, float min, float max)
-{
- GetImpl(*this).SetImage( filename, type, min, max );
-}
-
-void ImageView::SetImage(Image image)
-{
- GetImpl(*this).SetImage( image );
-}
-
-void ImageView::SetCameraActor(CameraActor camera)
-{
- // 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 );
-}
-
-void ImageView::SetCameraActor(CameraActor camera, float detailFactor)
-{
- GetImpl(*this).SetCameraActor( camera, detailFactor );
-}
-
-void ImageView::SetDetail(float detail)
-{
- GetImpl(*this).SetDetail( detail );
-}
-
-} // namespace Toolkit
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_TOOLKIT_IMAGE_VIEW_H__
-#define __DALI_TOOLKIT_IMAGE_VIEW_H__
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <dali/public-api/actors/camera-actor.h>
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Internal DALI_INTERNAL
-{
-class ImageView;
-}
-
-class Button;
-
-/**
- * ImageView control loads and displays the correct
- * image for the current level of detail (LOD) required.
- * LOD is typically calculated from the Camera distance.
- *
- * Example:
- *
- * ImageView imageView = ImageView::New();
- * imageView.SetCameraActor( mCamera );
- * imageView.SetSize( Vector2(64.0f, 64.0f) );
- * imageView.SetImage( "my-image.png", ImageView::BitmapType, 0.125f, 4.0f );
- * layer.Add(imageView);
- *
- * The above creates an ImageView at 64x64 in size. Images of 12.5% the size up
- * to 400% the size of imageView are created
- * i.e. 8x8, 16x16, 32x32, 64x64, 128x128, and 256x256
- *
- * based on the distance imageView is from mCamera an appropriate, different
- * image will be loaded and dispayed.
- */
-class DALI_IMPORT_API ImageView : public Control
-{
-public:
-
- /**
- * Image Types, determines how image should be rendered.
- */
- enum ImageType
- {
- BitmapType, ///< Standard Bitmap image
- DistanceFieldType ///< Distance Field encoded image
- };
-
- static const std::string DETAIL_PROPERTY_NAME; ///< The level of detail property
-
-public:
-
- /**
- * Creates an empty ImageView handle
- */
- ImageView();
-
- /**
- * Copy constructor. Creates another handle that points to the same real object
- * @param handle to copy from
- */
- ImageView( const ImageView& handle );
-
- /**
- * Assignment operator. Changes this handle to point to another real object
- */
- ImageView& operator=( const ImageView& handle );
-
- /**
- * @brief Destructor
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- */
- ~ImageView();
-
- /**
- * Create the Poup control
- * @return A handle to the ImageView control.
- */
- static ImageView New();
-
- /**
- * Downcast an Object handle to ImageView. If handle points to an ImageView the
- * downcast produces valid handle. If not the returned handle is left uninitialized.
- * @param[in] handle Handle to an object
- * @return handle to a ImageView or an uninitialized handle
- */
- static ImageView DownCast( BaseHandle handle );
-
-public:
-
- /**
- * Load image into ImageView for level of detail scaling.
- * Will automatically create different sized versions
- * of the source image.
- *
- * @param[in] filename The image path to load
- * @param[in] type The type of image e.g. BitmapType or DistanceFieldType
- */
- void SetImage(const std::string& filename, ImageType type);
-
- /**
- * Load image into ImageView for level of detail scaling.
- * The minimum scale is a percentage of the size of the
- * image view, and represents the smallest version of the
- * source image to display e.g. 0.125 for 12.5%
- * While the maximum scale represents the largest version of
- * the source image to display e.g. 1.00 for 100% (original
- * image view size)
- *
- * @note ImageView SetSize must be set specified prior to
- * calling this.
- *
- * @param[in] filename The image path to load
- * @param[in] type The type of image e.g. BitmapImage or DistanceFieldImage
- * @param[in] min The minimum scale detail to load.
- * @param[in] max The maximum scale detail to load.
- */
- void SetImage(const std::string& filename, ImageType type, float min, float max);
-
- /**
- * Sets an image to displayed for the entire detail range.
- * Regardless of the detail level this image will be displayed.
- *
- * @param[in] image The image to display
- */
- void SetImage(Image image);
-
- /**
- * Sets the camera to use for determining level of detail.
- * Which is based on distance from camera to this ImageView.
- * The detailFactor is the distance at which the ImageView
- * should appear at 100% scale. Which may differ based on
- * Projection, and ShaderEffect settings.
- * @param[in] camera The camera
- */
- void SetCameraActor(CameraActor camera);
-
- /**
- * Sets the camera to use for determining level of detail.
- * Which is based on distance from camera to this ImageView.
- * The detailFactor is the distance at which the ImageView
- * should appear at 100% scale. Which may differ based on
- * Projection, and ShaderEffect settings.
- * @param[in] camera The camera
- * @param[in] detailFactor The Camera distance where detail should be 1.0
- * (ImageView should appear at 100% scale)
- */
- void SetCameraActor(CameraActor camera, float detailFactor);
-
- /**
- * Sets the current detail level.
- * @note This sets the detail property value.
- * @param[in] detail The level of detail to be viewed at.
- */
- void SetDetail(float detail);
-
-public: // Not intended for application developers
-
- /**
- * Creates a handle using the Toolkit::Internal implementation.
- * @param[in] implementation The Control implementation.
- */
- DALI_INTERNAL ImageView(Internal::ImageView& implementation);
-
- /**
- * Allows the creation of this Control from an Internal::CustomActor pointer.
- * @param[in] internal A pointer to the internal CustomActor.
- */
- explicit DALI_INTERNAL ImageView(Dali::Internal::CustomActor* internal);
-};
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // __DALI_TOOLKIT_IMAGE_VIEW_H__
$(public_api_optional_src_dir)/controls/cluster/cluster-style.cpp \
$(public_api_optional_src_dir)/controls/effects-view/effects-view.cpp \
$(public_api_optional_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
- $(public_api_optional_src_dir)/controls/image-view/image-view.cpp \
$(public_api_optional_src_dir)/controls/image-view/masked-image-view.cpp \
$(public_api_optional_src_dir)/controls/magnifier/magnifier.cpp \
$(public_api_optional_src_dir)/controls/page-turn-view/page-turn-view.cpp \
$(public_api_optional_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.h
public_api_optional_image_view_header_files = \
- $(public_api_optional_src_dir)/controls/image-view/image-view.h \
$(public_api_optional_src_dir)/controls/image-view/masked-image-view.h
public_api_optional_magnifier_header_files = \