1 #ifndef DALI_DEMO_COLOR_TRANSITION_CONTROLLER_H
2 #define DALI_DEMO_COLOR_TRANSITION_CONTROLLER_H
4 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include "dali/public-api/adaptor-framework/window.h"
20 #include "dali/public-api/object/weak-handle.h"
21 #include "dali/public-api/actors/actor.h"
22 #include "dali/public-api/animation/animation.h"
23 #include "dali/public-api/rendering/texture.h"
24 #include "dali/public-api/render-tasks/render-task.h"
25 #include "dali/public-api/render-tasks/render-task-list.h"
27 class ColorTransitionController: public Dali::ConnectionTracker
30 using OnFinished = void(*)(void*);
32 ColorTransitionController(Dali::WeakHandle<Dali::RenderTaskList> renderTasks, Dali::Actor content, Dali::RenderTaskList tasks, Dali::Vector3 initialColor);
33 ~ColorTransitionController();
35 Dali::Actor GetComposite();
37 void SetFlowMap(Dali::Texture flowMap);
39 void SetUvTransform(float initialRotation, float initialScale, float targetRotation, float targetScale);
41 void SetOnFinished(OnFinished onFinished, void* onFinishedData);
43 void RequestTransition(float duration, const Dali::Vector3& targetColor);
46 void OnTransitionFinished(Dali::Animation& anim);
48 Dali::Actor mComposite;
49 Dali::Property::Index mPropFlow;
50 Dali::Property::Index mPropUvTransform;
51 Dali::Property::Index mPropRgb[2];
53 Dali::RenderTask mRtCompositor;
55 Dali::Animation mAnimation;
57 OnFinished mOnFinished = nullptr;
58 void* mOnFinishedData = nullptr;
60 Dali::WeakHandle<Dali::RenderTaskList> mWeakRenderTasks;
63 #endif //DALI_DEMO_COLOR_TRANSITION_CONTROLLER_H