Updated all files to new format
[platform/core/uifw/dali-demo.git] / examples / color-transition / utils.h
1 /*
2  * Copyright (c) 2021 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)          \
26   auto x = Dali::Actor::New(); \
27   x.SetProperty(Actor::Property::NAME, #x);
28
29 /**
30  * @brief Creates a unit quad centered on the origin (i.e. vertex positions
31  * between -.5 and .5).
32  */
33 Dali::Geometry CreateQuadGeometry();
34
35 struct RendererOptions
36 {
37   enum
38   {
39     NONE        = 0x0,
40     BLEND       = 0x01,
41     DEPTH_TEST  = 0x02,
42     DEPTH_WRITE = 0x04,
43     CULL_BACK   = 0x08,
44     CULL_FRONT  = 0x10,
45   };
46 };
47
48 ///@brief Creates a renderer with the given @a textures set, @a geometry, @a shader
49 /// and @a options from above.
50 ///@note Back face culling is on.
51 ///@note If textures is not a valid handle, an empty texture set will be created.
52 Dali::Renderer CreateRenderer(
53   Dali::TextureSet textures,
54   Dali::Geometry   geometry,
55   Dali::Shader     shader,
56   uint32_t         options = RendererOptions::NONE);
57
58 ///@brief Sets @a actor's anchor point and parent origin to center.
59 void CenterActor(Dali::Actor actor);
60
61 #endif //DALI_DEMO_COLOR_TRANSITION_UTILS_H_