2 * Copyright (c) 2018 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/devel-api/adaptor-framework/vector-animation-renderer.h>
19 #include <dali/public-api/object/base-object.h>
20 #include <toolkit-application.h>
31 class VectorAnimationRenderer: public Dali::BaseObject
35 VectorAnimationRenderer( const std::string& url, Dali::Renderer renderer, uint32_t width, uint32_t height )
37 mRenderer( renderer ),
43 void SetSize( uint32_t width, uint32_t height )
58 void Render( uint32_t frameNumber )
62 uint32_t GetTotalFrameNumber()
70 Dali::Renderer mRenderer;
76 inline VectorAnimationRenderer& GetImplementation( Dali::VectorAnimationRenderer& renderer )
78 DALI_ASSERT_ALWAYS( renderer && "VectorAnimationRenderer handle is empty." );
79 BaseObject& handle = renderer.GetBaseObject();
80 return static_cast< Internal::Adaptor::VectorAnimationRenderer& >( handle );
83 inline const VectorAnimationRenderer& GetImplementation( const Dali::VectorAnimationRenderer& renderer )
85 DALI_ASSERT_ALWAYS( renderer && "VectorAnimationRenderer handle is empty." );
86 const BaseObject& handle = renderer.GetBaseObject();
87 return static_cast< const Internal::Adaptor::VectorAnimationRenderer& >( handle );
90 } // namespace Adaptor
92 } // namespace Internal
95 /********************************************************************************/
96 /********************************* PUBLIC CLASS *******************************/
97 /********************************************************************************/
99 VectorAnimationRenderer VectorAnimationRenderer::New( const std::string& url, Renderer renderer, uint32_t width, uint32_t height )
101 Internal::Adaptor::VectorAnimationRenderer* animationRenderer = new Internal::Adaptor::VectorAnimationRenderer( url, renderer, width, height );
103 return VectorAnimationRenderer( animationRenderer );
106 VectorAnimationRenderer::VectorAnimationRenderer()
110 VectorAnimationRenderer::~VectorAnimationRenderer()
114 VectorAnimationRenderer::VectorAnimationRenderer( Internal::Adaptor::VectorAnimationRenderer* internal )
115 : BaseHandle( internal )
119 VectorAnimationRenderer::VectorAnimationRenderer( const VectorAnimationRenderer& handle )
120 : BaseHandle( handle )
124 VectorAnimationRenderer& VectorAnimationRenderer::operator=( const VectorAnimationRenderer& rhs )
126 BaseHandle::operator=( rhs );
130 void VectorAnimationRenderer::SetSize( uint32_t width, uint32_t height )
132 Internal::Adaptor::GetImplementation( *this ).SetSize( width, height );
135 bool VectorAnimationRenderer::StartRender()
137 return Internal::Adaptor::GetImplementation( *this ).StartRender();
140 void VectorAnimationRenderer::StopRender()
142 Internal::Adaptor::GetImplementation( *this ).StopRender();
145 void VectorAnimationRenderer::Render( uint32_t frameNumber )
147 Internal::Adaptor::GetImplementation( *this ).Render( frameNumber );
150 uint32_t VectorAnimationRenderer::GetTotalFrameNumber()
152 return Internal::Adaptor::GetImplementation( *this ).GetTotalFrameNumber();