[NUI]ImageView OrientationCorrection support
[platform/core/csapi/tizenfx.git] / test / NUITestSample / NUITestSample / examples / svg-test.cs
1 using Tizen.NUI;
2 using Tizen.NUI.BaseComponents;
3
4 namespace SvgTest
5 {
6     class Program : NUIApplication
7     {
8         protected override void OnCreate()
9         {
10             base.OnCreate();
11             Initialize();
12         }
13
14         string test_url = "/home/owner/apps_rw/org.tizen.example.NUITemplate3/res/3.svg";
15
16         TextField[] textField = new TextField[5];
17         ImageView[] imageView = new ImageView[10];
18         int iSVGimage = 50, iSynchronous = 0, iTextColor = 0, iPointSize = 20, iPointSize2 = 20, mImageCombinationIndex = 0;
19         int resol = 1;
20
21         void Initialize()
22         {
23             //NUILog.Debug("### SvgTest => OnCreate()!");
24
25             Window window = Window.Instance;
26             window.BackgroundColor = Color.White;
27             //NUILog.Debug($"### window.Dpi={window.Dpi}");
28
29             Vector2 dpi = new Vector2();
30             dpi = window.Dpi;
31             //NUILog.Debug($"### window.Dpi x={dpi.X}, y={dpi.Y}");
32
33             textField[0] = new TextField();
34             textField[0].Size2D = new Size2D(300 * resol, 64 * resol);
35             textField[0].Position2D = new Position2D(10 * resol, 600 * resol);
36             textField[0].PivotPoint = PivotPoint.TopLeft;
37             textField[0].BackgroundColor = Color.White;
38             textField[0].PointSize = iPointSize * resol;
39             textField[0].PlaceholderText = "imageview setsize X";
40             textField[0].TextColor = Color.Red;
41
42             textField[1] = new TextField();
43             textField[1].Size2D = new Size2D(350 * resol, 64 * resol);
44             textField[1].Position2D = new Position2D(400 * resol, 600 * resol);
45             textField[1].PivotPoint = PivotPoint.TopLeft;
46             textField[1].BackgroundColor = Color.White;
47             textField[1].PointSize = iPointSize * resol;
48             textField[1].PlaceholderText = "imageview setsize 200,400";
49             textField[1].TextColor = Color.Red;
50
51             textField[2] = new TextField();
52             textField[2].Size2D = new Size2D(350 * resol, 64 * resol);
53             textField[2].Position2D = new Position2D(750 * resol, 600 * resol);
54             textField[2].PivotPoint = PivotPoint.TopLeft;
55             textField[2].BackgroundColor = Color.White;
56             textField[2].PointSize = iPointSize * resol;
57             textField[2].PlaceholderText = "imageview setsize 300,300";
58             textField[2].TextColor = Color.Red;
59
60             textField[3] = new TextField();
61             textField[3].Size2D = new Size2D(350 * resol, 64 * resol);
62             textField[3].Position2D = new Position2D(1100 * resol, 600 * resol);
63             textField[3].PivotPoint = PivotPoint.TopLeft;
64             textField[3].BackgroundColor = Color.White;
65             textField[3].PointSize = iPointSize * resol;
66             textField[3].PlaceholderText = "imageview setsize 500,500";
67             textField[3].TextColor = Color.Red;
68
69             window.Add(textField[0]);
70             window.Add(textField[1]);
71             window.Add(textField[2]);
72             window.Add(textField[3]);
73
74             PropertyMap map0 = new PropertyMap();
75             map0.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
76             string test_url0 = "/home/owner/apps_rw/org.tizen.example.NUITemplate3/res/images/test-image.png";
77             map0.Add(ImageVisualProperty.URL, new PropertyValue(test_url0));
78             map0.Add(ImageVisualProperty.CropToMask + 3, new PropertyValue(true));
79             imageView[0] = new ImageView();
80             imageView[0].Position2D = new Position2D(10 * resol, 20 * resol);
81             imageView[0].PivotPoint = PivotPoint.TopLeft;
82             imageView[0].ParentOrigin = ParentOrigin.TopLeft;
83             imageView[0].ImageMap = map0;
84             imageView[0].BackgroundColor = Color.Black;
85             window.Add(imageView[0]);
86
87             return;
88
89             PropertyMap map1 = new PropertyMap();
90             map1.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
91             //map1.Add(ImageVisualProperty.URL, new PropertyValue(IMAGE_PATH[iSVGimage]));
92             map1.Add(ImageVisualProperty.URL, new PropertyValue(test_url));
93             map1.Add((int)Visual.Property.MixColor, new PropertyValue(new Color(0.7f, 0.0f, 0.0f, 1.0f)));
94             imageView[1] = new ImageView();
95             imageView[1].Size2D = new Size2D(200 * resol, 400 * resol);
96             imageView[1].Position2D = new Position2D(400 * resol, 20 * resol);
97             imageView[1].PivotPoint = PivotPoint.TopLeft;
98             imageView[1].ParentOrigin = ParentOrigin.TopLeft;
99             imageView[1].Image = map1;
100             imageView[1].BackgroundColor = Color.Black;
101             //            ConnectSignal(imageView[1]);
102
103             PropertyMap map2 = new PropertyMap();
104             map2.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
105             //map2.Add(ImageVisualProperty.URL, new PropertyValue(IMAGE_PATH[iSVGimage]));
106             map2.Add(ImageVisualProperty.URL, new PropertyValue(test_url));
107             imageView[2] = new ImageView();
108             imageView[2].Size2D = new Size2D(300 * resol, 300 * resol);
109             imageView[2].Position2D = new Position2D(700 * resol, 20 * resol);
110             imageView[2].PivotPoint = PivotPoint.TopLeft;
111             imageView[2].ParentOrigin = ParentOrigin.TopLeft;
112             imageView[2].Image = map2;
113             imageView[2].BackgroundColor = Color.Black;
114             //            ConnectSignal(imageView[2]);
115
116             PropertyMap map3 = new PropertyMap();
117             map3.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG));
118             //map3.Add(ImageVisualProperty.URL, new PropertyValue(IMAGE_PATH[iSVGimage]));
119             map3.Add(ImageVisualProperty.URL, new PropertyValue(test_url));
120             imageView[3] = new ImageView();
121             imageView[3].Size2D = new Size2D(500 * resol, 500 * resol);
122             imageView[3].Position2D = new Position2D(1100 * resol, 20 * resol);
123             imageView[3].PivotPoint = PivotPoint.TopLeft;
124             imageView[3].ParentOrigin = ParentOrigin.TopLeft;
125             imageView[3].Image = map3;
126             imageView[3].BackgroundColor = Color.Black;
127             //            ConnectSignal(imageView[3]);
128
129
130
131             window.Add(imageView[1]);
132             window.Add(imageView[2]);
133             window.Add(imageView[3]);
134         }
135
136         static void _Main(string[] args)
137         {
138             var app = new Program();
139             app.Run(args);
140         }
141     }
142 }