public SKFileWStream(string path) : base(SkiaApi.sk_filewstream_new(StringUtilities.GetEncodedText(path, SKEncoding.Utf8)), true) { if (Handle == IntPtr.Zero) { throw new InvalidOperationException("Unable to create a new SKFileWStream instance."); } }
private static IntPtr CreateNew(string path) { var bytes = StringUtilities.GetEncodedText(path, SKEncoding.Utf8); fixed(byte *p = bytes) { return(SkiaApi.sk_filewstream_new(p)); } }
// Draw*Annotation public void DrawAnnotation(SKRect rect, string key, SKData value) { var bytes = StringUtilities.GetEncodedText(key, SKTextEncoding.Utf8, true); fixed(byte *b = bytes) { SkiaApi.sk_canvas_draw_annotation(base.Handle, &rect, b, value == null ? IntPtr.Zero : value.Handle); } }
public long BreakText(string text, float maxWidth, out float measuredWidth) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, TextEncoding); return((long)SkiaApi.sk_paint_break_text(Handle, bytes, (IntPtr)bytes.Length, maxWidth, out measuredWidth)); }
public SKPath GetTextPath(string text, SKPoint[] points) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, TextEncoding); return(GetObject <SKPath> (SkiaApi.sk_paint_get_pos_text_path(Handle, bytes, (IntPtr)bytes.Length, points))); }
public SKPath GetTextPath(string text, float x, float y) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, TextEncoding); return(GetTextPath(bytes, x, y)); }
public static SKData Create(string filename) { if (string.IsNullOrEmpty(filename)) { throw new ArgumentException("The filename cannot be empty.", nameof(filename)); } var utf8path = StringUtilities.GetEncodedText(filename, SKEncoding.Utf8); return(GetObject <SKData> (SkiaApi.sk_data_new_from_file(utf8path))); }
public int CountGlyphs(string str, SKEncoding encoding) { if (str == null) { throw new ArgumentNullException(nameof(str)); } var bytes = StringUtilities.GetEncodedText(str, encoding); return(CountGlyphs(bytes, encoding)); }
public float MeasureText(string text, ref SKRect bounds) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, TextEncoding); return(MeasureText(bytes, ref bounds)); }
public int GetGlyphs(string text, SKEncoding encoding, out ushort [] glyphs) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, encoding); return(GetGlyphs(bytes, encoding, out glyphs)); }
public SKTypeface CreateTypeface(string path, int index = 0) { if (path == null) { throw new ArgumentNullException(nameof(path)); } var utf8path = StringUtilities.GetEncodedText(path, SKEncoding.Utf8); return(GetObject <SKTypeface> (SkiaApi.sk_fontmgr_create_from_file(Handle, utf8path, index))); }
public static SKTypeface FromFile(string path, int index = 0) { if (path == null) { throw new ArgumentNullException(nameof(path)); } var utf8path = StringUtilities.GetEncodedText(path, SKTextEncoding.Utf8, true); fixed(byte *u = utf8path) { return(GetObject(SkiaApi.sk_typeface_create_from_file(u, index))); } }
public void DrawText(string text, float x, float y, SKPaint paint) { if (text == null) { throw new ArgumentNullException(nameof(text)); } if (paint == null) { throw new ArgumentNullException(nameof(paint)); } var bytes = StringUtilities.GetEncodedText(text, paint.TextEncoding); DrawText(bytes, x, y, paint); }
public void DrawTextOnPath(string text, SKPath path, float hOffset, float vOffset, SKPaint paint) { if (text == null) { throw new ArgumentNullException(nameof(text)); } if (paint == null) { throw new ArgumentNullException(nameof(paint)); } if (paint == null) { throw new ArgumentNullException(nameof(paint)); } var bytes = StringUtilities.GetEncodedText(text, paint.TextEncoding); DrawTextOnPath(bytes, path, hOffset, vOffset, paint); }
public void DrawPositionedText(string text, SKPoint [] points, SKPaint paint) { if (text == null) { throw new ArgumentNullException(nameof(text)); } if (paint == null) { throw new ArgumentNullException(nameof(paint)); } if (points == null) { throw new ArgumentNullException(nameof(points)); } var bytes = StringUtilities.GetEncodedText(text, paint.TextEncoding); DrawPositionedText(bytes, points, paint); }
public long BreakText(string text, float maxWidth, out float measuredWidth, out string measuredText) { if (text == null) { throw new ArgumentNullException(nameof(text)); } var bytes = StringUtilities.GetEncodedText(text, TextEncoding); var byteLength = (int)SkiaApi.sk_paint_break_text(Handle, bytes, (IntPtr)bytes.Length, maxWidth, out measuredWidth); if (byteLength == 0) { measuredText = String.Empty; return(0); } if (byteLength == bytes.Length) { measuredText = text; return(text.Length); } measuredText = StringUtilities.GetString(bytes, 0, byteLength, TextEncoding); return(measuredText.Length); }
public int CountGlyphs(ReadOnlySpan <char> str) { var bytes = StringUtilities.GetEncodedText(str, SKTextEncoding.Utf16); return(CountGlyphs(bytes, SKTextEncoding.Utf16)); }
public void DrawAnnotation(SKRect rect, string key, SKData value) { SkiaApi.sk_canvas_draw_annotation(Handle, ref rect, StringUtilities.GetEncodedText(key, SKTextEncoding.Utf8), value == null ? IntPtr.Zero : value.Handle); }
public void AddPositionedRun(SKPaint font, ushort[] glyphs, SKPoint[] positions, string text, uint[] clusters) { var utf8Text = StringUtilities.GetEncodedText(text, SKEncoding.Utf8); AddPositionedRunInternal(font, glyphs, positions, utf8Text, clusters, null, true); }
public void SetText(string text) { var utf8Text = StringUtilities.GetEncodedText(text, SKEncoding.Utf8); SetText(utf8Text); }
public void AddRun(SKPaint font, float x, float y, ushort[] glyphs, string text, uint[] clusters) { var utf8Text = StringUtilities.GetEncodedText(text, SKEncoding.Utf8); AddRunInternal(font, x, y, glyphs, utf8Text, clusters, null, true); }
public void AddRun(SKPaint font, float x, float y, ushort[] glyphs, string text, uint[] clusters, SKRect bounds) { var utf8Text = StringUtilities.GetEncodedText(text, SKTextEncoding.Utf8); AddRun(font, x, y, glyphs, utf8Text, clusters, (SKRect?)bounds); }
public void AddPositionedRun(SKPaint font, ushort[] glyphs, SKPoint[] positions, string text, uint[] clusters, SKRect bounds) { var utf8Text = StringUtilities.GetEncodedText(text, SKTextEncoding.Utf8); AddPositionedRun(font, glyphs, positions, utf8Text, clusters, (SKRect?)bounds); }
// AddHorizontalRun public void AddHorizontalRun(SKPaint font, float y, ushort[] glyphs, float[] positions, string text, uint[] clusters) { var utf8Text = StringUtilities.GetEncodedText(text, SKTextEncoding.Utf8); AddHorizontalRun(font, y, glyphs, positions, utf8Text, clusters, null); }
public SKString(string str) : this(StringUtilities.GetEncodedText(str, SKTextEncoding.Utf8)) { }
public void AddHorizontalRun(SKPaint font, float y, ushort[] glyphs, float[] positions, string text, uint[] clusters, SKRect bounds) { var utf8Text = StringUtilities.GetEncodedText(text, SKEncoding.Utf8); AddHorizontalRunInternal(font, y, glyphs, positions, utf8Text, clusters, bounds, true); }