1010using System ;
1111using System . Drawing ;
1212using System . Drawing . Drawing2D ;
13+ using System . Globalization ;
1314using System . IO ;
15+ using System . Threading ;
1416using System . Windows . Forms ;
1517
1618namespace SvgGdiTest
@@ -26,6 +28,7 @@ public partial class SvgGdiTestForm : Form
2628 [ STAThread ]
2729 private static void Main ( )
2830 {
31+ Thread . CurrentThread . CurrentCulture = new CultureInfo ( "nb-NO" ) ; // To catch culture formatting errors
2932 Application . Run ( new SvgGdiTestForm ( ) ) ;
3033 }
3134
@@ -73,8 +76,8 @@ private void Render(IGraphics ig)
7376 }
7477 else if ( s == "Clipping" )
7578 {
76- Pen pn = new Pen ( Color . LightGray , 5 ) ;
77- Pen pn2 = new Pen ( Color . Yellow ) ;
79+ Pen pn = new Pen ( Color . LightGray , 5.6f ) ;
80+ Pen pn2 = new Pen ( Color . Yellow , 1.2f ) ;
7881
7982 ig . Clear ( Color . Black ) ;
8083
@@ -103,9 +106,9 @@ private void Render(IGraphics ig)
103106 ig . Clear ( Color . Black ) ;
104107
105108 ig . RotateTransform ( 15 ) ;
106- ig . DrawRectangle ( new Pen ( Color . Red , 2 ) , 260 , 80 , 50 , 40 ) ;
109+ ig . DrawRectangle ( new Pen ( Color . Red , 2.7f ) , 260 , 80 , 50 , 40 ) ;
107110 ig . ResetTransform ( ) ;
108- ig . DrawRectangle ( new Pen ( Color . Red , 2 ) , 260 , 80 , 50 , 40 ) ;
111+ ig . DrawRectangle ( new Pen ( Color . Red , 2.7f ) , 260 , 80 , 50 , 40 ) ;
109112
110113 ig . TranslateTransform ( 15 , - 5 ) ;
111114
@@ -125,7 +128,7 @@ private void Render(IGraphics ig)
125128 ig . ScaleTransform ( 1.1f , 1.2f ) ;
126129
127130 ig . FillEllipse ( new SolidBrush ( Color . YellowGreen ) , 130 , 180 , 80 , 40 ) ;
128- ig . DrawRectangle ( new Pen ( Color . YellowGreen , 2 ) , 62 , 80 , 40 , 40 ) ;
131+ ig . DrawRectangle ( new Pen ( Color . YellowGreen , 2.7f ) , 62 , 80 , 40 , 40 ) ;
129132
130133 GraphicsContainer cnt3 = ig . BeginContainer ( ) ;
131134
@@ -158,15 +161,15 @@ private void Render(IGraphics ig)
158161 {
159162 ig . SmoothingMode = SmoothingMode . AntiAlias ;
160163
161- Pen ow = new Pen ( Color . Purple , 12 ) ;
164+ Pen ow = new Pen ( Color . Purple , 12.6f ) ;
162165 ow . EndCap = LineCap . Round ;
163166 ow . StartCap = LineCap . Round ;
164167 ow . MiterLimit = 6f ;
165168 ow . LineJoin = LineJoin . Miter ;
166169
167170 ig . SmoothingMode = SmoothingMode . None ;
168171
169- Pen tp = new Pen ( Color . Red , 2 ) ;
172+ Pen tp = new Pen ( Color . Red , 2.7f ) ;
170173 tp . DashStyle = DashStyle . DashDot ;
171174
172175 ig . DrawLine ( tp , 70 , 20 , 190 , 20 ) ;
@@ -201,7 +204,7 @@ private void Render(IGraphics ig)
201204 ig . DrawPolygon ( tp , polly ) ;
202205
203206 //arrows
204- Pen arr = new Pen ( Color . DarkGoldenrod , 5 ) ;
207+ Pen arr = new Pen ( Color . DarkGoldenrod , 5.7f ) ;
205208
206209 {
207210 arr . Width = 2 ;
@@ -270,7 +273,7 @@ private void Render(IGraphics ig)
270273 new PointF ( 190 , 210 )
271274 } ;
272275
273- Pen bpn = new Pen ( Color . MediumSeaGreen , 2 ) ;
276+ Pen bpn = new Pen ( Color . MediumSeaGreen , 2.3f ) ;
274277 bpn . DashStyle = DashStyle . Custom ;
275278 bpn . DashPattern = new float [ ] { 6 , 1 , 5 , 2 , 4 , 3 , 3 , 4 , 2 , 5 , 6 , 1 } ;
276279 ig . DrawBeziers ( bpn , bezzie ) ;
@@ -286,9 +289,9 @@ private void Render(IGraphics ig)
286289 new PointF ( 80 , 110 )
287290 } ;
288291
289- ig . DrawCurve ( new Pen ( Color . Blue , 5 ) , curvy ) ;
290- ig . DrawCurve ( new Pen ( Color . Red , 2 ) , curvy , 2 , 3 ) ;
291- ig . DrawCurve ( new Pen ( Color . Yellow , 1 ) , curvy , 1f ) ;
292+ ig . DrawCurve ( new Pen ( Color . Blue , 5.7f ) , curvy ) ;
293+ ig . DrawCurve ( new Pen ( Color . Red , 2.7f ) , curvy , 2 , 3 ) ;
294+ ig . DrawCurve ( new Pen ( Color . Yellow , 1.7f ) , curvy , 1f ) ;
292295
293296 Point [ ] ccurvy = new Point [ ]
294297 {
@@ -300,8 +303,8 @@ private void Render(IGraphics ig)
300303 new Point ( 230 , 150 ) ,
301304 new Point ( 150 , 50 )
302305 } ;
303- ig . DrawClosedCurve ( new Pen ( Color . Green , 3 ) , ccurvy , 1f , FillMode . Alternate ) ;
304- ig . DrawClosedCurve ( new Pen ( Color . Purple , 1 ) , ccurvy , 0f , FillMode . Alternate ) ;
306+ ig . DrawClosedCurve ( new Pen ( Color . Green , 3.7f ) , ccurvy , 1f , FillMode . Alternate ) ;
307+ ig . DrawClosedCurve ( new Pen ( Color . Purple , 1.7f ) , ccurvy , 0f , FillMode . Alternate ) ;
305308
306309 Point [ ] fcc = new Point [ ]
307310 {
@@ -402,19 +405,19 @@ private void Render(IGraphics ig)
402405 {
403406 //GDI does not seem to draw arcs correctly except when the ellipse is a circle.
404407 //These arcs demonstrate the problem. SVGGraphics calculates arcs correctly.
405- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 5 * 3 , 120 , 110 * 3 , 110 , 0 , 240 ) ;
406- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 10 * 3 , 125 , 100 * 3 , 100 , 0 , 210 ) ;
407- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 15 * 3 , 130 , 90 * 3 , 90 , 0 , 180 ) ;
408- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 20 * 3 , 135 , 80 * 3 , 80 , 0 , 150 ) ;
409- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 25 * 3 , 140 , 70 * 3 , 70 , 0 , 120 ) ;
410- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 30 * 3 , 145 , 60 * 3 , 60 , 0 , 90 ) ;
411- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 35 * 3 , 150 , 50 * 3 , 50 , 0 , 60 ) ;
412- ig . DrawArc ( new Pen ( Color . Black , 2 ) , 120 + 40 * 3 , 155 , 40 * 3 , 40 , 0 , 270 ) ;
413-
414- ig . DrawPie ( new Pen ( Color . Pink , 2 ) , 110 , 50 , 100 , 100 , 315 , 90 ) ;
415- ig . DrawPie ( new Pen ( Color . Purple , 2 ) , 110 , 50 , 100 , 100 , 250 , - 90 ) ;
416- ig . DrawPie ( new Pen ( Color . DarkRed , 2 ) , 115 , 55 , 90 , 90 , 180 , 270 ) ;
417- ig . DrawPie ( new Pen ( Color . Red , 2 ) , 120 , 60 , 80 , 80 , 45 , - 270 ) ;
408+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 5 * 3 , 120 , 110 * 3 , 110 , 0 , 240 ) ;
409+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 10 * 3 , 125 , 100 * 3 , 100 , 0 , 210 ) ;
410+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 15 * 3 , 130 , 90 * 3 , 90 , 0 , 180 ) ;
411+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 20 * 3 , 135 , 80 * 3 , 80 , 0 , 150 ) ;
412+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 25 * 3 , 140 , 70 * 3 , 70 , 0 , 120 ) ;
413+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 30 * 3 , 145 , 60 * 3 , 60 , 0 , 90 ) ;
414+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 35 * 3 , 150 , 50 * 3 , 50 , 0 , 60 ) ;
415+ ig . DrawArc ( new Pen ( Color . Black , 2.7f ) , 120 + 40 * 3 , 155 , 40 * 3 , 40 , 0 , 270 ) ;
416+
417+ ig . DrawPie ( new Pen ( Color . Pink , 2.7f ) , 110 , 50 , 100 , 100 , 315 , 90 ) ;
418+ ig . DrawPie ( new Pen ( Color . Purple , 2.7f ) , 110 , 50 , 100 , 100 , 250 , - 90 ) ;
419+ ig . DrawPie ( new Pen ( Color . DarkRed , 2.7f ) , 115 , 55 , 90 , 90 , 180 , 270 ) ;
420+ ig . DrawPie ( new Pen ( Color . Red , 2.7f ) , 120 , 60 , 80 , 80 , 45 , - 270 ) ;
418421 }
419422 else if ( s == "Text" )
420423 {
@@ -498,7 +501,7 @@ private void Render(IGraphics ig)
498501 myPath . AddRectangle ( myRect ) ;
499502 myPath . SetMarkers ( ) ;
500503 myPath . AddEllipse ( 220 , 220 , 100 , 100 ) ;
501- ig . DrawPath ( new Pen ( Color . Black ) , myPath ) ;
504+ ig . DrawPath ( new Pen ( Color . Black , 1.7f ) , myPath ) ;
502505 LinearGradientBrush gbr2 = new LinearGradientBrush ( new Point ( 0 , 0 ) , new Point ( 10 , 20 ) , Color . WhiteSmoke , Color . CornflowerBlue ) ;
503506 gbr2 . WrapMode = WrapMode . TileFlipXY ;
504507 ig . FillPath ( gbr2 , myPath ) ;
@@ -507,7 +510,7 @@ private void Render(IGraphics ig)
507510 myPath2 . AddLine ( 100 , 100 , 130 , 120 ) ;
508511 myPath2 . AddEllipse ( 120 , 120 , 120 , 140 ) ;
509512 myPath2 . AddBezier ( 130 , 160 , 170 , 160 , 150 , 130 , 200 , 110 ) ;
510- ig . DrawPath ( new Pen ( Color . Blue ) , myPath2 ) ;
513+ ig . DrawPath ( new Pen ( Color . Blue , 1.7f ) , myPath2 ) ;
511514 }
512515 else if ( s == "Path 2 (Slow)" )
513516 {
@@ -529,7 +532,7 @@ private void Render(IGraphics ig)
529532 0 , 24 , myPointF , myStringFormat ) ;
530533 myGraphicsPath . AddPie ( 230 , 10 , 40 , 40 , 40 , 110 ) ;
531534 ig . FillPath ( mySolidBrush , myGraphicsPath ) ;
532- ig . DrawPath ( new Pen ( Color . Green ) , myGraphicsPath ) ;
535+ ig . DrawPath ( new Pen ( Color . Green , 1.7f ) , myGraphicsPath ) ;
533536 }
534537 else
535538 {
0 commit comments