Dali 3D User Interface Engine
utc-Dali-DistanceField.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 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 
18 #include <iostream>
19 #include <algorithm>
20 
21 #include <stdlib.h>
22 
25 #include <dali-test-suite-utils.h>
26 
27 using std::max;
28 using namespace Dali;
29 
30 namespace
31 {
32 
33 static const float ROTATION_EPSILON = 0.0001f;
34 
35 static unsigned char sourceImage[] =
36 {
37  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
38  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
39  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
40  0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,
41  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
42  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
43  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
44  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
45 };
46 
47 } // anonymous namespace
48 
49 
50 
52 {
53  unsigned char distanceField[4*4];
54 
55  GenerateDistanceFieldMap(sourceImage, Size(8.0f, 8.0f), distanceField, Size(4.0f, 4.0f), 0, Size(4.0f, 4.0f));
56 
57  if(distanceField[0] <= distanceField[5] &&
58  distanceField[5] <= distanceField[10] &&
59  distanceField[10] <= distanceField[15])
60  {
62  }
63  else
64  {
66  }
67  END_TEST;
68 }
Dali Docs Home
Read more about Dali