Added Colour Transition example.
[platform/core/uifw/dali-demo.git] / examples / color-transition / utils.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 #ifndef DALI_DEMO_COLOR_TRANSITION_UTILS_H_
18 #define DALI_DEMO_COLOR_TRANSITION_UTILS_H_
19
20 #include "dali/public-api/actors/actor.h"
21 #include "dali/public-api/rendering/geometry.h"
22 #include "dali/public-api/rendering/renderer.h"
23 #include "dali/public-api/rendering/texture.h"
24
25 #define ACTOR_DECL(x) auto x = Dali::Actor::New(); x.SetProperty(Actor::Property::NAME, #x);
26
27 /**
28  * @brief Creates a unit quad centered on the origin (i.e. vertex positions
29  * between -.5 and .5).
30  */
31 Dali::Geometry CreateQuadGeometry();
32
33 struct RendererOptions
34 {
35   enum
36   {
37     NONE = 0x0,
38     BLEND = 0x01,
39     DEPTH_TEST = 0x02,
40     DEPTH_WRITE = 0x04,
41     CULL_BACK = 0x08,
42     CULL_FRONT = 0x10,
43   };
44 };
45
46 ///@brief Creates a renderer with the given @a textures set, @a geometry, @a shader
47 /// and @a options from above.
48 ///@note Back face culling is on.
49 ///@note If textures is not a valid handle, an empty texture set will be created.
50 Dali::Renderer CreateRenderer(
51   Dali::TextureSet textures,
52   Dali::Geometry geometry,
53   Dali::Shader shader,
54   uint32_t options = RendererOptions::NONE);
55
56 ///@brief Sets @a actor's anchor point and parent origin to center.
57 void CenterActor(Dali::Actor actor);
58
59 #endif //DALI_DEMO_COLOR_TRANSITION_UTILS_H_