1 #ifndef DALI_INTERNAL_ANIMATED_IMAGE_LOADING_IMPL_H
2 #define DALI_INTERNAL_ANIMATED_IMAGE_LOADING_IMPL_H
5 * Copyright (c) 2020 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.
21 #include <dali/public-api/common/dali-vector.h>
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/math/uint-16-pair.h>
24 #include <dali/public-api/common/intrusive-ptr.h>
25 #include <dali/public-api/object/base-object.h>
28 #include <dali/public-api/dali-adaptor-common.h>
29 #include <dali/devel-api/adaptor-framework/animated-image-loading.h>
34 typedef Dali::Uint16Pair ImageDimensions;
42 class AnimatedImageLoading;
43 typedef IntrusivePtr<AnimatedImageLoading> AnimatedImageLoadingPtr;
46 * Class interface for animated image loading.
47 * Each loading classes for animated image file format(e.g., gif and webp) needs to inherit this interface
49 class AnimatedImageLoading : public BaseObject
54 * @copydoc Dali::AnimatedImageLoading::New()
56 static AnimatedImageLoadingPtr New( const std::string& url, bool isLocalResource );
58 AnimatedImageLoading() = default;
60 // Moveable but not copyable
61 AnimatedImageLoading( const AnimatedImageLoading& );
62 AnimatedImageLoading& operator=( const AnimatedImageLoading& );
63 AnimatedImageLoading( AnimatedImageLoading&& ) = default;
64 AnimatedImageLoading& operator=( AnimatedImageLoading&& ) = default;
69 ~AnimatedImageLoading() override = default;
72 * @copydoc Dali::AnimatedImageLoading::LoadNextNFrames()
74 virtual bool LoadNextNFrames( uint32_t frameStartIndex, int count, std::vector<Dali::PixelData>& pixelData ) = 0;
77 * @copydoc Dali::AnimatedImageLoading::LoadFrame()
79 virtual Dali::Devel::PixelBuffer LoadFrame( uint32_t frameIndex ) = 0;
82 * @copydoc Dali::AnimatedImageLoading::GetImageSize()
84 virtual ImageDimensions GetImageSize() const = 0;
87 * @copydoc Dali::AnimatedImageLoading::GetImageCount()
89 virtual uint32_t GetImageCount() const = 0;
92 * @copydoc Dali::AnimatedImageLoading::LoadFrameDelays()
94 virtual uint32_t GetFrameInterval( uint32_t frameIndex ) const = 0;
97 * @copydoc Dali::AnimatedImageLoading::GetUrl()
99 virtual std::string GetUrl() const = 0;
102 } // namespace Adaptor
104 } // namespace Internal
106 // Helpers for api forwarding methods
108 inline Internal::Adaptor::AnimatedImageLoading& GetImplementation( Dali::AnimatedImageLoading& handle)
110 DALI_ASSERT_ALWAYS( handle && "AnimatedImageLoading handle is empty" );
112 BaseObject& object = handle.GetBaseObject();
114 return static_cast< Internal::Adaptor::AnimatedImageLoading& >( object );
117 inline const Internal::Adaptor::AnimatedImageLoading& GetImplementation( const Dali::AnimatedImageLoading& handle )
119 DALI_ASSERT_ALWAYS( handle && "AnimatedImageLoading handle is empty" );
121 const BaseObject& object = handle.GetBaseObject();
123 return static_cast< const Internal::Adaptor::AnimatedImageLoading& >( object );
128 #endif // DALI_INTERNAL_ANIMATED_IMAGE_LOADING_IMPL_H