aboutsummaryrefslogtreecommitdiffstatsci
path: root/Drawing2D/src/IContext.cs
blob: e19f97384491964a370fbfbc917f077a0472e377 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2018-2022  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)

using System;

namespace Drawing2D
{
	public interface IContext : IDisposable
	{

		double LineWidth { get; set; }
		LineJoin LineJoin { get; set; }
		LineCap LineCap { get; set; }
		void SetFontSize (double scale);
		void SelectFontFace (string family, FontSlant slant, FontWeight weight);
		Operator Operator { get; set; }
		FillRule FillRule { get; set; }
		FontExtents FontExtents { get; }
		Antialias Antialias  { get; set; }
		void SetDash (double [] dashes, double offset = 0);

		TextExtents TextExtents (ReadOnlySpan<char> s, int tabSize = 4);
		void TextExtents (ReadOnlySpan<char> s, int tabSize, out TextExtents extents);
		void TextExtents (Span<byte> bytes, out TextExtents extents);
		void ShowText (string text);
		void ShowText (ReadOnlySpan<char> s, int tabSize = 4);
		void ShowText (Span<byte> bytes);

		void Save();
		void Restore();
		void SaveTransformations ();
		void RestoreTransformations ();
		void Scale(double sx, double sy);
		void Translate(double dx, double dy);
		void Translate(PointD p);
		void Rotate(double alpha);

		void Flush();
		void Clear();

		void NewPath();
		void NewSubPath();
		void ClosePath();
		void Arc(double xc, double yc, double radius, double a1, double a2);
		void Arc (PointD center, double radius, double angle1, double angle2);
		void ArcNegative(double xc, double yc, double radius, double a1, double a2);
		void ArcNegative (PointD center, double radius, double angle1, double angle2);
		void MoveTo(Point p);
		void MoveTo(PointD p);
		void MoveTo(double x, double y);
		void RelMoveTo(double x, double y);
		void LineTo(double x, double y);
		void LineTo(Point p);
		void LineTo(PointD p);
		void RelLineTo(double x, double y);
		void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
		void RelCurveTo(double x1, double y1, double x2, double y2, double x3, double y3);
		void Rectangle(double x, double y, double width, double height);
		void Rectangle(Rectangle r);

		void Paint();
		void PaintWithAlpha (double alpha);
		void Fill();
		void FillPreserve();
		Rectangle StrokeExtents ();
		void Stroke();
		void StrokePreserve();
		void Clip();
		void ClipPreserve();
		void ResetClip();

		void SetSource(IPattern pat);
		void SetSource (Color color);
		void SetSource(double r, double g, double b, double a = 1.0);
		void SetSource(ISurface surf, double x = 0f, double y = 0f);
		void RenderSvg(ISvgHandle svgHandle, string subId = null);

		void PushGroup ();
		void PopGroupToSource ();
	}
}