forked from managed-commons/SvgNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGDIGraphics.cs
More file actions
354 lines (192 loc) · 19.7 KB
/
GDIGraphics.cs
File metadata and controls
354 lines (192 loc) · 19.7 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
/*
Copyright © 2003 RiskCare Ltd. All rights reserved.
Copyright © 2010 SvgNet & SvgGdi Bridge Project. All rights reserved.
Copyright © 2015-2019 Rafael Teixeira, Mojmír Němeček, Benjamin Peterson and Other Contributors
Original source code licensed with BSD-2-Clause spirit, treat it thus, see accompanied LICENSE for more
*/
namespace SvgNet;
/// <summary>
/// An IGraphics implementation that simply passes every call through to a GDI+ <c>Graphics</c> object.
/// </summary>
public sealed class GdiGraphics(Graphics g) : IGraphics {
public Region Clip { get => _g.Clip; set => _g.Clip = value; }
public RectangleF ClipBounds => _g.ClipBounds;
public CompositingMode CompositingMode { get => _g.CompositingMode; set => _g.CompositingMode = value; }
public CompositingQuality CompositingQuality { get => _g.CompositingQuality; set => _g.CompositingQuality = value; }
public float DpiX => _g.DpiX;
public float DpiY => _g.DpiY;
public InterpolationMode InterpolationMode { get => _g.InterpolationMode; set => _g.InterpolationMode = value; }
public bool IsClipEmpty => _g.IsClipEmpty;
public bool IsVisibleClipEmpty => _g.IsVisibleClipEmpty;
public float PageScale { get => _g.PageScale; set => _g.PageScale = value; }
public GraphicsUnit PageUnit { get => _g.PageUnit; set => _g.PageUnit = value; }
public PixelOffsetMode PixelOffsetMode { get => _g.PixelOffsetMode; set => _g.PixelOffsetMode = value; }
public Point RenderingOrigin { get => _g.RenderingOrigin; set => _g.RenderingOrigin = value; }
public SmoothingMode SmoothingMode { get => _g.SmoothingMode; set => _g.SmoothingMode = value; }
public int TextContrast { get => _g.TextContrast; set => _g.TextContrast = value; }
public TextRenderingHint TextRenderingHint { get => _g.TextRenderingHint; set => _g.TextRenderingHint = value; }
public Matrix Transform { get => _g.Transform; set => _g.Transform = value; }
public RectangleF VisibleClipBounds => _g.VisibleClipBounds;
public void AddMetafileComment(byte[] data) => _g.AddMetafileComment(data);
public GraphicsContainer BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit) => _g.BeginContainer(dstrect, srcrect, unit);
public GraphicsContainer BeginContainer() => _g.BeginContainer();
public GraphicsContainer BeginContainer(Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit) => _g.BeginContainer(dstrect, srcrect, unit);
public void Clear(Color color) => _g.Clear(color);
public void Dispose() => _g.Dispose();
public void DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) => _g.DrawArc(pen, x, y, width, height, startAngle, sweepAngle);
public void DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle) => _g.DrawArc(pen, rect, startAngle, sweepAngle);
public void DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) => _g.DrawArc(pen, x, y, width, height, startAngle, sweepAngle);
public void DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle) => _g.DrawArc(pen, rect, startAngle, sweepAngle);
public void DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) => _g.DrawBezier(pen, x1, y1, x2, y2, x3, y3, x4, y4);
public void DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4) => _g.DrawBezier(pen, pt1, pt2, pt3, pt4);
public void DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4) => _g.DrawBezier(pen, pt1, pt2, pt3, pt4);
public void DrawBeziers(Pen pen, PointF[] points) => _g.DrawBeziers(pen, points);
public void DrawBeziers(Pen pen, Point[] points) => _g.DrawBeziers(pen, points);
public void DrawClosedCurve(Pen pen, PointF[] points) => _g.DrawClosedCurve(pen, points);
public void DrawClosedCurve(Pen pen, PointF[] points, float tension, FillMode fillMode) => _g.DrawClosedCurve(pen, points, tension, fillMode);
public void DrawClosedCurve(Pen pen, Point[] points) => _g.DrawClosedCurve(pen, points);
public void DrawClosedCurve(Pen pen, Point[] points, float tension, FillMode fillMode) => _g.DrawClosedCurve(pen, points, tension, fillMode);
public void DrawCurve(Pen pen, PointF[] points) => _g.DrawCurve(pen, points);
public void DrawCurve(Pen pen, PointF[] points, float tension) => _g.DrawCurve(pen, points, tension);
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments) => _g.DrawCurve(pen, points, offset, numberOfSegments);
public void DrawCurve(Pen pen, PointF[] points, int offset, int numberOfSegments, float tension) => _g.DrawCurve(pen, points, offset, numberOfSegments, tension);
public void DrawCurve(Pen pen, Point[] points) => _g.DrawCurve(pen, points);
public void DrawCurve(Pen pen, Point[] points, float tension) => _g.DrawCurve(pen, points, tension);
public void DrawCurve(Pen pen, Point[] points, int offset, int numberOfSegments, float tension) => _g.DrawCurve(pen, points, offset, numberOfSegments, tension);
public void DrawEllipse(Pen pen, RectangleF rect) => _g.DrawEllipse(pen, rect);
public void DrawEllipse(Pen pen, float x, float y, float width, float height) => _g.DrawEllipse(pen, x, y, width, height);
public void DrawEllipse(Pen pen, Rectangle rect) => _g.DrawEllipse(pen, rect);
public void DrawEllipse(Pen pen, int x, int y, int width, int height) => _g.DrawEllipse(pen, x, y, width, height);
public void DrawIcon(Icon icon, int x, int y) => _g.DrawIcon(icon, x, y);
public void DrawIcon(Icon icon, Rectangle targetRect) => _g.DrawIcon(icon, targetRect);
public void DrawIconUnstretched(Icon icon, Rectangle targetRect) => _g.DrawIconUnstretched(icon, targetRect);
public void DrawImage(Image image, PointF point) => _g.DrawImage(image, point);
public void DrawImage(Image image, float x, float y) => _g.DrawImage(image, x, y);
public void DrawImage(Image image, RectangleF rect) => _g.DrawImage(image, rect);
public void DrawImage(Image image, float x, float y, float width, float height) => _g.DrawImage(image, x, y, width, height);
public void DrawImage(Image image, Point point) => _g.DrawImage(image, point);
public void DrawImage(Image image, int x, int y) => _g.DrawImage(image, x, y);
public void DrawImage(Image image, Rectangle rect) => _g.DrawImage(image, rect);
public void DrawImage(Image image, int x, int y, int width, int height) => _g.DrawImage(image, x, y, width, height);
public void DrawImage(Image image, PointF[] destPoints) => _g.DrawImage(image, destPoints);
public void DrawImage(Image image, Point[] destPoints) => _g.DrawImage(image, destPoints);
public void DrawImage(Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, x, y, srcRect, srcUnit);
public void DrawImage(Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, x, y, srcRect, srcUnit);
public void DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, destRect, srcRect, srcUnit);
public void DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, destRect, srcRect, srcUnit);
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, destPoints, srcRect, srcUnit);
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr) => _g.DrawImage(image, destPoints, srcRect, srcUnit);
public void DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, Graphics.DrawImageAbort callback) => _g.DrawImage(image, destPoints, srcRect, srcUnit);
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit) => _g.DrawImage(image, destPoints, srcRect, srcUnit);
public void DrawImage(Image image, Point[] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr) => _g.DrawImage(image, destPoints, srcRect, srcUnit);
public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit) => _g.DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit);
public void DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs) => _g.DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit);
public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit) => _g.DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit);
public void DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr) => _g.DrawImage(image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr);
public void DrawImageUnscaled(Image image, Point point) => _g.DrawImageUnscaled(image, point);
public void DrawImageUnscaled(Image image, int x, int y) => _g.DrawImageUnscaled(image, x, y);
public void DrawImageUnscaled(Image image, Rectangle rect) => _g.DrawImageUnscaled(image, rect);
public void DrawImageUnscaled(Image image, int x, int y, int width, int height) => _g.DrawImageUnscaled(image, x, y, width, height);
public void DrawLine(Pen pen, float x1, float y1, float x2, float y2) => _g.DrawLine(pen, x1, y1, x2, y2);
public void DrawLine(Pen pen, PointF pt1, PointF pt2) => _g.DrawLine(pen, pt1, pt2);
public void DrawLine(Pen pen, int x1, int y1, int x2, int y2) => _g.DrawLine(pen, x1, y1, x2, y2);
public void DrawLine(Pen pen, Point pt1, Point pt2) => _g.DrawLine(pen, pt1, pt2);
public void DrawLines(Pen pen, PointF[] points) => _g.DrawLines(pen, points);
public void DrawLines(Pen pen, Point[] points) => _g.DrawLines(pen, points);
public void DrawPath(Pen pen, GraphicsPath path) => _g.DrawPath(pen, path);
public void DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle) => _g.DrawPie(pen, rect, startAngle, sweepAngle);
public void DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle) => _g.DrawPie(pen, x, y, width, height, startAngle, sweepAngle);
public void DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle) => _g.DrawPie(pen, rect, startAngle, sweepAngle);
public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle) => _g.DrawPie(pen, x, y, width, height, startAngle, sweepAngle);
public void DrawPolygon(Pen pen, PointF[] points) => _g.DrawPolygon(pen, points);
public void DrawPolygon(Pen pen, Point[] points) => _g.DrawPolygon(pen, points);
public void DrawRectangle(Pen pen, Rectangle rect) => _g.DrawRectangle(pen, rect);
public void DrawRectangle(Pen pen, float x, float y, float width, float height) => _g.DrawRectangle(pen, x, y, width, height);
public void DrawRectangle(Pen pen, int x, int y, int width, int height) => _g.DrawRectangle(pen, x, y, width, height);
public void DrawRectangles(Pen pen, RectangleF[] rects) => _g.DrawRectangles(pen, rects);
public void DrawRectangles(Pen pen, Rectangle[] rects) => _g.DrawRectangles(pen, rects);
public void DrawString(string s, Font font, Brush brush, float x, float y) => _g.DrawString(s, font, brush, x, y);
public void DrawString(string s, Font font, Brush brush, PointF point) => _g.DrawString(s, font, brush, point);
public void DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format) => _g.DrawString(s, font, brush, x, y, format);
public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format) => _g.DrawString(s, font, brush, point, format);
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle) => _g.DrawString(s, font, brush, layoutRectangle);
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format) => _g.DrawString(s, font, brush, layoutRectangle, format);
public void EndContainer(GraphicsContainer container) => _g.EndContainer(container);
public void ExcludeClip(Rectangle rect) => _g.ExcludeClip(rect);
public void ExcludeClip(Region region) => _g.ExcludeClip(region);
public void FillClosedCurve(Brush brush, PointF[] points) => _g.FillClosedCurve(brush, points);
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode) => _g.FillClosedCurve(brush, points, fillMode);
public void FillClosedCurve(Brush brush, PointF[] points, FillMode fillMode, float tension) => _g.FillClosedCurve(brush, points, fillMode, tension);
public void FillClosedCurve(Brush brush, Point[] points) => _g.FillClosedCurve(brush, points);
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillMode) => _g.FillClosedCurve(brush, points, fillMode);
public void FillClosedCurve(Brush brush, Point[] points, FillMode fillMode, float tension) => _g.FillClosedCurve(brush, points, fillMode, tension);
public void FillEllipse(Brush brush, RectangleF rect) => _g.FillEllipse(brush, rect);
public void FillEllipse(Brush brush, float x, float y, float width, float height) => _g.FillEllipse(brush, x, y, width, height);
public void FillEllipse(Brush brush, Rectangle rect) => _g.FillEllipse(brush, rect);
public void FillEllipse(Brush brush, int x, int y, int width, int height) => _g.FillEllipse(brush, x, y, width, height);
public void FillPath(Brush brush, GraphicsPath path) => _g.FillPath(brush, path);
public void FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle) => _g.FillPie(brush, rect, startAngle, sweepAngle);
public void FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle) => _g.FillPie(brush, x, y, width, height, startAngle, sweepAngle);
public void FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle) => _g.FillPie(brush, x, y, width, height, startAngle, sweepAngle);
public void FillPolygon(Brush brush, PointF[] points) => _g.FillPolygon(brush, points);
public void FillPolygon(Brush brush, PointF[] points, FillMode fillMode) => _g.FillPolygon(brush, points, fillMode);
public void FillPolygon(Brush brush, Point[] points) => _g.FillPolygon(brush, points);
public void FillPolygon(Brush brush, Point[] points, FillMode fillMode) => _g.FillPolygon(brush, points, fillMode);
public void FillRectangle(Brush brush, RectangleF rect) => _g.FillRectangle(brush, rect);
public void FillRectangle(Brush brush, float x, float y, float width, float height) => _g.FillRectangle(brush, x, y, width, height);
public void FillRectangle(Brush brush, Rectangle rect) => _g.FillRectangle(brush, rect);
public void FillRectangle(Brush brush, int x, int y, int width, int height) => _g.FillRectangle(brush, x, y, width, height);
public void FillRectangles(Brush brush, RectangleF[] rects) => _g.FillRectangles(brush, rects);
public void FillRectangles(Brush brush, Rectangle[] rects) => _g.FillRectangles(brush, rects);
public void FillRegion(Brush brush, Region region) => _g.FillRegion(brush, region);
public void Flush() => _g.Flush();
public void Flush(FlushIntention intention) => _g.Flush(intention);
public Color GetNearestColor(Color color) => _g.GetNearestColor(color);
public void IntersectClip(Rectangle rect) => _g.IntersectClip(rect);
public void IntersectClip(RectangleF rect) => _g.IntersectClip(rect);
public void IntersectClip(Region region) => _g.IntersectClip(region);
public bool IsVisible(int x, int y) => _g.IsVisible(x, y);
public bool IsVisible(Point point) => _g.IsVisible(point);
public bool IsVisible(float x, float y) => _g.IsVisible(x, y);
public bool IsVisible(PointF point) => _g.IsVisible(point);
public bool IsVisible(int x, int y, int width, int height) => _g.IsVisible(x, y, width, height);
public bool IsVisible(Rectangle rect) => _g.IsVisible(rect);
public bool IsVisible(float x, float y, float width, float height) => _g.IsVisible(x, y, width, height);
public bool IsVisible(RectangleF rect) => _g.IsVisible(rect);
public Region[] MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat) => _g.MeasureCharacterRanges(text, font, layoutRect, stringFormat);
public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled) {
SizeF siz = _g.MeasureString(text, font, layoutArea, stringFormat, out int a, out int b); charactersFitted = a; linesFilled = b; return siz;
}
public SizeF MeasureString(string text, Font font, PointF origin, StringFormat stringFormat) => _g.MeasureString(text, font, origin, stringFormat);
public SizeF MeasureString(string text, Font font, SizeF layoutArea) => _g.MeasureString(text, font, layoutArea);
public SizeF MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat) => _g.MeasureString(text, font, layoutArea, stringFormat);
public SizeF MeasureString(string text, Font font) => _g.MeasureString(text, font);
public SizeF MeasureString(string text, Font font, int width) => _g.MeasureString(text, font, width);
public SizeF MeasureString(string text, Font font, int width, StringFormat format) => _g.MeasureString(text, font, width, format);
public void MultiplyTransform(Matrix matrix) => _g.MultiplyTransform(matrix);
public void MultiplyTransform(Matrix matrix, MatrixOrder order) => _g.MultiplyTransform(matrix, order);
public void ResetClip() => _g.ResetClip();
public void ResetTransform() => _g.ResetTransform();
public void Restore(GraphicsState gstate) => _g.Restore(gstate);
public void RotateTransform(float angle) => _g.RotateTransform(angle);
public void RotateTransform(float angle, MatrixOrder order) => _g.RotateTransform(angle, order);
public GraphicsState Save() => _g.Save();
public void ScaleTransform(float sx, float sy) => _g.ScaleTransform(sx, sy);
public void ScaleTransform(float sx, float sy, MatrixOrder order) => _g.ScaleTransform(sx, sy);
public void SetClip(Graphics g) => _g.SetClip(g);
public void SetClip(Graphics g, CombineMode combineMode) => _g.SetClip(g, combineMode);
public void SetClip(Rectangle rect) => _g.SetClip(rect);
public void SetClip(Rectangle rect, CombineMode combineMode) => _g.SetClip(rect, combineMode);
public void SetClip(RectangleF rect) => _g.SetClip(rect);
public void SetClip(RectangleF rect, CombineMode combineMode) => _g.SetClip(rect, combineMode);
public void SetClip(GraphicsPath path) => _g.SetClip(path);
public void SetClip(GraphicsPath path, CombineMode combineMode) => _g.SetClip(path, combineMode);
public void SetClip(Region region, CombineMode combineMode) => _g.SetClip(region, combineMode);
public void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF[] pts) => _g.TransformPoints(destSpace, srcSpace, pts);
public void TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, Point[] pts) => _g.TransformPoints(destSpace, srcSpace, pts);
public void TranslateClip(float dx, float dy) => _g.TranslateClip(dx, dy);
public void TranslateClip(int dx, int dy) => _g.TranslateClip(dx, dy);
public void TranslateTransform(float dx, float dy) => _g.TranslateTransform(dx, dy);
public void TranslateTransform(float dx, float dy, MatrixOrder order) => _g.TranslateTransform(dx, dy, order);
private readonly Graphics _g = g ?? throw new ArgumentNullException(nameof(g));
}