4884f4772c3044ec4f3174804ef63eefa07c923e
[platform/core/csapi/tizenfx.git] / src / ElmSharp / ElmSharp / Utility.cs
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
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 namespace ElmSharp
18 {
19     /// <summary>
20     /// This class is a static class for utility methods.
21     /// </summary>
22     /// <since_tizen> preview </since_tizen>
23     public static class Utility
24     {
25         /// <summary>
26         /// Appends a font path to the list of font paths used by the application.
27         /// </summary>
28         /// <param name="path">The new font path.</param>
29         /// <since_tizen> preview </since_tizen>
30         public static void AppendGlobalFontPath(string path)
31         {
32             Interop.Evas.evas_font_path_global_append(path);
33         }
34
35         /// <summary>
36         /// Prepends a font path to the list of font paths used by the application.
37         /// </summary>
38         /// <param name="path">The new font path.</param>
39         /// <since_tizen> preview </since_tizen>
40         public static void PrependEvasGlobalFontPath(string path)
41         {
42             Interop.Evas.evas_font_path_global_prepend(path);
43         }
44
45         /// <summary>
46         /// Removes all font paths loaded into the memory by evas_font_path_app_* APIs for the application.
47         /// </summary>
48         /// <since_tizen> preview </since_tizen>
49         public static void ClearEvasGlobalFontPath()
50         {
51             Interop.Evas.evas_font_path_global_clear();
52         }
53
54         /// <summary>
55         /// Sets the Edje color class.
56         /// </summary>
57         /// <param name="colorClass">Color class.</param>
58         /// <param name="red">Object red value.</param>
59         /// <param name="green">Object green value.</param>
60         /// <param name="blue">Object blue value.</param>
61         /// <param name="alpha">Object alpha value.</param>
62         /// <param name="outlineRed">Outline red value.</param>
63         /// <param name="outlineGreen">Outline green value.</param>
64         /// <param name="outlineBlue">Outline blue value.</param>
65         /// <param name="outlineAlpha">Outline alpha value.</param>
66         /// <param name="shadowRed">Shadow red value.</param>
67         /// <param name="shadowGreen">Shadow green value.</param>
68         /// <param name="shadowBlue">Shadow blue value.</param>
69         /// <param name="shadowAlpha">Shadow alpha value.</param>
70         /// <returns></returns>
71         /// <since_tizen> preview </since_tizen>
72         public static bool SetEdjeColorClass(string colorClass, int red, int green, int blue, int alpha, int outlineRed, int outlineGreen, int outlineBlue, int outlineAlpha,
73             int shadowRed, int shadowGreen, int shadowBlue, int shadowAlpha)
74         {
75             return Interop.Elementary.edje_color_class_set(colorClass, red, green, blue, alpha, outlineRed, outlineGreen, outlineBlue, outlineAlpha, shadowRed, shadowGreen, shadowBlue, shadowAlpha);
76         }
77
78         /// <summary>
79         /// Gets the Edje color class.
80         /// </summary>
81         /// <param name="colorClass">Color class.</param>
82         /// <param name="red">Object red value.</param>
83         /// <param name="green">Object green value.</param>
84         /// <param name="blue">Object blue value.</param>
85         /// <param name="alpha">Object alpha value.</param>
86         /// <param name="outlineRed">Outline red value.</param>
87         /// <param name="outlineGreen">Outline green value.</param>
88         /// <param name="outlineBlue">Outline blue value.</param>
89         /// <param name="outlineAlpha">Outline alpha value.</param>
90         /// <param name="shadowRed">Shadow red value.</param>
91         /// <param name="shadowGreen">Shadow green value.</param>
92         /// <param name="shadowBlue">Shadow blue value.</param>
93         /// <param name="shadowAlpha">Shadow alpha value.</param>
94         /// <returns></returns>
95         /// <since_tizen> preview </since_tizen>
96         public static bool GetEdjeColorClass(string colorClass, out int red, out int green, out int blue, out int alpha, out int outlineRed, out int outlineGreen, out int outlineBlue,
97             out int outlineAlpha, out int shadowRed, out int shadowGreen, out int shadowBlue, out int shadowAlpha)
98         {
99             return Interop.Elementary.edje_color_class_get(colorClass, out red, out green, out blue, out alpha, out outlineRed, out outlineGreen, out outlineBlue, out outlineAlpha,
100                 out shadowRed, out shadowGreen, out shadowBlue, out shadowAlpha);
101         }
102
103         /// <summary>
104         /// Processes all the queued up edje messages.
105         /// This function triggers the processing of messages addressed to any (alive) edje objects.
106         /// </summary>
107         /// <since_tizen> preview </since_tizen>
108         public static void ProcessEdjeMessageSignal()
109         {
110             Interop.Elementary.edje_message_signal_process();
111         }
112
113         /// <summary>
114         /// Sets the Edje text class.
115         /// </summary>
116         /// <param name="textClass">The text class name.</param>
117         /// <param name="font">The font name.</param>
118         /// <param name="size">The font size.</param>
119         /// <returns>True on success, or False on error.</returns>
120         /// <since_tizen> preview </since_tizen>
121         public static bool SetEdjeTextClass(string textClass, string font, int size)
122         {
123             return Interop.Elementary.edje_text_class_set(textClass, font, size);
124         }
125
126         /// <summary>
127         /// Gets the Edje text class.
128         /// </summary>
129         /// <param name="textClass">The text class name.</param>
130         /// <param name="font">The font name.</param>
131         /// <param name="size">The font size.</param>
132         /// <returns>True on success, or False on error.</returns>
133         /// <since_tizen> preview </since_tizen>
134         public static bool GetEdjeTextClass(string textClass, out string font, out int size)
135         {
136             return Interop.Elementary.edje_text_class_get(textClass, out font, out size);
137         }
138
139         /// <summary>
140         /// Delete the text class.
141         /// </summary>
142         /// <param name="textClass">The text class name.</param>
143         /// <since_tizen> preview </since_tizen>
144         public static void DeleteEdjeTextClass(string textClass)
145         {
146             Interop.Elementary.edje_text_class_del(textClass);
147         }
148
149         /// <summary>
150         /// Pre-multiplies the RGB triplet by an alpha factor.
151         /// </summary>
152         /// <param name="alpha">The alpha factor.</param>
153         /// <param name="red">The red component of the color.</param>
154         /// <param name="green">The green component of the color.</param>
155         /// <param name="blue">The blue component of the color.</param>
156         /// <since_tizen> preview </since_tizen>
157         public static void PremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue)
158         {
159             Interop.Evas.evas_color_argb_premul(alpha, ref red, ref green, ref blue);
160         }
161
162         /// <summary>
163         /// Undoes pre-multiplication of the RGB triplet by an alpha factor.
164         /// </summary>
165         /// <param name="alpha">The alpha factor.</param>
166         /// <param name="red">The red component of the color.</param>
167         /// <param name="green">The green component of the color.</param>
168         /// <param name="blue">The blue component of the color.</param>
169         /// <since_tizen> preview </since_tizen>
170         public static void UnPremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue)
171         {
172             Interop.Evas.evas_color_argb_unpremul(alpha, ref red, ref green, ref blue);
173         }
174     }
175 }