/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace ElmSharp
{
///
/// This class is a static class for a utility methods.
///
public static class Utility
{
///
/// Appends a font path to the list of font paths used by the application.
///
/// The new font path.
public static void AppendGlobalFontPath(string path)
{
Interop.Evas.evas_font_path_global_append(path);
}
///
/// Prepends a font path to the list of font paths used by the application.
///
/// The new font path.
public static void PrependEvasGlobalFontPath(string path)
{
Interop.Evas.evas_font_path_global_prepend(path);
}
///
/// Removes all font paths loaded into memory by evas_font_path_app_* APIs for the application.
///
public static void ClearEvasGlobalFontPath()
{
Interop.Evas.evas_font_path_global_clear();
}
///
/// Sets Edje color class.
///
/// Color class
/// Object Red value
/// Object Red value
/// Object Red value
/// Object Red value
/// Outline Red value
/// Outline Green value
/// Outline Blue value
/// Outline Alpha value
/// Shadow Red value
/// Shadow Green value
/// Shadow Bluevalue
/// Shadow Alpha value
///
public static bool SetEdjeColorClass(string colorClass, int red, int green, int blue, int alpha, int outlineRed, int outlineGreen, int outlineBlue, int outlineAlpha,
int shadowRed, int shadowGreen, int shadowBlue, int shadowAlpha)
{
return Interop.Elementary.edje_color_class_set(colorClass, red, green, blue, alpha, outlineRed, outlineGreen, outlineBlue, outlineAlpha, shadowRed, shadowGreen, shadowBlue, shadowAlpha);
}
///
/// Gets Edje color class.
///
/// Color class
/// Object Red value
/// Object Red value
/// Object Red value
/// Object Red value
/// Outline Red value
/// Outline Green value
/// Outline Blue value
/// Outline Alpha value
/// Shadow Red value
/// Shadow Green value
/// Shadow Bluevalue
/// Shadow Alpha value
///
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,
out int outlineAlpha, out int shadowRed, out int shadowGreen, out int shadowBlue, out int shadowAlpha)
{
return Interop.Elementary.edje_color_class_get(colorClass, out red, out green, out blue, out alpha, out outlineRed, out outlineGreen, out outlineBlue, out outlineAlpha,
out shadowRed, out shadowGreen, out shadowBlue, out shadowAlpha);
}
///
/// Processes all queued up edje messages.
/// This function triggers the processing of messages addressed to any (alive) edje objects.
///
public static void ProcessEdjeMessageSignal()
{
Interop.Elementary.edje_message_signal_process();
}
///
/// Sets the Edje text class.
///
/// The text class name
/// The font name
/// The font size
/// True, on success or false, on error
public static bool SetEdjeTextClass(string textClass, string font, int size)
{
return Interop.Elementary.edje_text_class_set(textClass, font, size);
}
///
/// Gets the Edje text class.
///
/// The text class name
/// The font name
/// The font size
/// True, on success or false, on error
public static bool GetEdjeTextClass(string textClass, out string font, out int size)
{
return Interop.Elementary.edje_text_class_get(textClass, out font, out size);
}
///
/// Delete the text class.
///
///
public static void DeleteEdjeTextClass(string textClass)
{
Interop.Elementary.edje_text_class_del(textClass);
}
///
/// Pre-multiplies a rgb triplet by an alpha factor.
///
/// The alpha factor
/// The Red component of the color
/// The Green component of the color
/// The Blue component of the color
public static void PremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue)
{
Interop.Evas.evas_color_argb_premul(alpha, ref red, ref green, ref blue);
}
///
/// Undoes pre-multiplies a rgb triplet by an alpha factor.
///
/// The alpha factor
/// The Red component of the color
/// The Green component of the color
/// The Blue component of the color
public static void UnPremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue)
{
Interop.Evas.evas_color_argb_unpremul(alpha, ref red, ref green, ref blue);
}
}
}