Добавьте файлы проекта.
This commit is contained in:
49
CairoObjective/Text.cs
Normal file
49
CairoObjective/Text.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace CairoObjective
|
||||
{
|
||||
#pragma warning disable CS8602 // Разыменование вероятной пустой ссылки.
|
||||
public class Text
|
||||
{
|
||||
public static double DefaultFontSize = 20;//Default Font Size
|
||||
|
||||
public static void Make(string text, int pointX, int pointY, double size, Cairo.Color color)
|
||||
{
|
||||
Set.CheckContext();
|
||||
var context = Set.Context;
|
||||
context.SetSourceColor(color);
|
||||
context.SetFontSize(size);
|
||||
Cairo.TextExtents extents = context.TextExtents(text);
|
||||
context.MoveTo(pointX - extents.Width / 2, pointY + extents.Height / 2);
|
||||
context.ShowText(text);
|
||||
}
|
||||
public static void Make(string text, int pointX, int pointY, Cairo.Color color)
|
||||
{
|
||||
Set.CheckContext();
|
||||
var context = Set.Context;
|
||||
context.SetSourceColor(color);
|
||||
context.SetFontSize(DefaultFontSize);
|
||||
Cairo.TextExtents extents = context.TextExtents(text);
|
||||
context.MoveTo(pointX - extents.Width / 2, pointY + extents.Height / 2);
|
||||
context.ShowText(text);
|
||||
}
|
||||
public static void Make(string text, int pointX, int pointY, double size)
|
||||
{
|
||||
Set.CheckContext();
|
||||
var context = Set.Context;
|
||||
context.SetSourceColor(Set.Color);
|
||||
context.SetFontSize(size);
|
||||
Cairo.TextExtents extents = context.TextExtents(text);
|
||||
context.MoveTo(pointX - extents.Width / 2, pointY + extents.Height / 2);
|
||||
context.ShowText(text);
|
||||
}
|
||||
public static void Make(string text, int pointX, int pointY)
|
||||
{
|
||||
Set.CheckContext();
|
||||
var context = Set.Context;
|
||||
context.SetSourceColor(Set.Color);
|
||||
context.SetFontSize(DefaultFontSize);
|
||||
Cairo.TextExtents extents = context.TextExtents(text);
|
||||
context.MoveTo(pointX - extents.Width / 2, pointY + extents.Height / 2);
|
||||
context.ShowText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user