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