-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2006-03-31 Sebastien Pouliot <sebastien@ximian.com>
* Makefile: Build all (4) samples and their common assembly (dll); * README: Description of every samples; * binary.cs: Sample to test binary operations on regions. * binary.Designer.cs: VS2k5 generated partial class for controls. * clippy.cs: Sample to test clipping with regions. * clippy.Designer.cs: VS2k5 generated partial class for controls. * flatten.cs: Sample to convert region (curves) into polygons. * flatten.Designer.cs: VS2k5 generated partial class for controls. * scan.cs: Sample to convert regions into rectangles. * scan.Designer.cs: VS2k5 generated partial class for controls. * Matrices.cs: Shared class to created different Matrix. * Shapes.cs: Shared class to create different GraphicsPath. svn path=/trunk/mcs/; revision=58839
- Loading branch information
Sebastien Pouliot
committed
Mar 31, 2006
1 parent
99cd6c0
commit 246665c
Showing
13 changed files
with
1,829 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
2006-03-31 Sebastien Pouliot <sebastien@ximian.com> | ||
|
||
* Makefile: Build all (4) samples and their common assembly (dll); | ||
* README: Description of every samples; | ||
* binary.cs: Sample to test binary operations on regions. | ||
* binary.Designer.cs: VS2k5 generated partial class for controls. | ||
* clippy.cs: Sample to test clipping with regions. | ||
* clippy.Designer.cs: VS2k5 generated partial class for controls. | ||
* flatten.cs: Sample to convert region (curves) into polygons. | ||
* flatten.Designer.cs: VS2k5 generated partial class for controls. | ||
* scan.cs: Sample to convert regions into rectangles. | ||
* scan.Designer.cs: VS2k5 generated partial class for controls. | ||
* Matrices.cs: Shared class to created different Matrix. | ||
* Shapes.cs: Shared class to create different GraphicsPath. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
all: Samples.Common.dll binary.exe clippy.exe flatten.exe scan.exe | ||
|
||
Samples.Common.dll: Shapes.cs Matrices.cs | ||
gmcs Shapes.cs Matrices.cs -r:System.Drawing.dll -target:library -out:Samples.Common.dll | ||
|
||
binary.exe: Samples.Common.dll binary.cs binary.Designer.cs | ||
gmcs binary.cs binary.Designer.cs -r:Samples.Common.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll | ||
|
||
clippy.exe: Samples.Common.dll clippy.cs clippy.Designer.cs | ||
gmcs clippy.cs clippy.Designer.cs -r:Samples.Common.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll | ||
|
||
flatten.exe: Samples.Common.dll flatten.cs flatten.Designer.cs | ||
gmcs flatten.cs flatten.Designer.cs -r:Samples.Common.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll | ||
|
||
scan.exe: Samples.Common.dll scan.cs scan.Designer.cs | ||
gmcs scan.cs scan.Designer.cs -r:Samples.Common.dll -r:System.Drawing.dll -r:System.Windows.Forms.dll | ||
|
||
clean: | ||
rm -f *.exe Samples.Common.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// Matrices.cs | ||
// | ||
// Authors: | ||
// Sebastien Pouliot <sebastien@ximian.com> | ||
// | ||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com) | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
|
||
namespace Samples.Common { | ||
|
||
public class Matrices { | ||
|
||
static public object[] GetList () | ||
{ | ||
return new object[] { | ||
"Null", | ||
"Empty", | ||
"Rotate 15\'", | ||
"Rotate 45\' at 100,100", | ||
"Scale 1.5 x 0.5", | ||
"Shear 2.0 x 2.0", | ||
"Translate 50, 50" | ||
}; | ||
} | ||
|
||
static public Matrix GetMatrix (int index) | ||
{ | ||
// not defined (-1) or first (0) | ||
if (index <= 0) | ||
return null; | ||
|
||
Matrix m = new Matrix (); | ||
switch (index) { | ||
case 1: | ||
// empty | ||
break; | ||
case 2: | ||
m.Rotate (15); | ||
break; | ||
case 3: | ||
m.RotateAt (45, new PointF (100, 100)); | ||
break; | ||
case 4: | ||
m.Scale (1.5f, 0.5f); | ||
break; | ||
case 5: | ||
m.Shear (2.0f, 2.0f); | ||
break; | ||
case 6: | ||
m.Translate (50, 50); | ||
break; | ||
} | ||
return m; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
This directory contains a few samples originally created with Visual Studio | ||
2005 to test certain features before implementing them into libgdiplus. | ||
|
||
They are provided here, with a Makefile, to help test any changes in those | ||
functionalities. All samples are compiled using gmcs (2.0). | ||
|
||
* binary.exe | ||
|
||
Perform binary operation (union, intersect, exclude, complement and | ||
xoir) on regions of different shapes. | ||
|
||
* clippy.exe | ||
|
||
Perform clipping using region of different shapes. | ||
|
||
* flatten | ||
|
||
Convert different shapes (including beziers curves) into shapes | ||
with only polygons. | ||
|
||
* scan.exe | ||
|
||
Convert different shapes into a serie of rectangles. | ||
|
||
* Samples.Common.dll | ||
|
||
Common code between the samples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
// | ||
// Shapes.cs | ||
// | ||
// Authors: | ||
// Sebastien Pouliot <sebastien@ximian.com> | ||
// | ||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com) | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining | ||
// a copy of this software and associated documentation files (the | ||
// "Software"), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to | ||
// permit persons to whom the Software is furnished to do so, subject to | ||
// the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be | ||
// included in all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
|
||
using System; | ||
using System.Drawing; | ||
using System.Drawing.Drawing2D; | ||
|
||
namespace Samples.Common { | ||
|
||
public class Shapes { | ||
|
||
static public object[] GetList () | ||
{ | ||
return new object[] { | ||
"Arc", | ||
"Bezier", | ||
"Beziers", | ||
"Closed Curve", | ||
"Curve", | ||
"Ellipse", | ||
"Line", | ||
"Lines", | ||
"Pie", | ||
"Polygon", | ||
"Rectangle", | ||
"Rectangles", | ||
"String", | ||
"Complex (AddPath)" | ||
}; | ||
} | ||
|
||
static public GraphicsPath GetShape (int index) | ||
{ | ||
switch (index) { | ||
case 0: | ||
return Arc (); | ||
case 1: | ||
return Bezier (); | ||
case 2: | ||
return Beziers (); | ||
case 3: | ||
return ClosedCurve (); | ||
case 4: | ||
return Curve (); | ||
case 5: | ||
return Ellipse (); | ||
case 6: | ||
return Line (); | ||
case 7: | ||
return Lines (); | ||
case 8: | ||
return Pie (); | ||
case 9: | ||
return Polygon (); | ||
case 10: | ||
return Rectangle (); | ||
case 11: | ||
return Rectangles (); | ||
case 12: | ||
return String (); | ||
case 13: | ||
return Complex (); | ||
default: | ||
// nothing to show | ||
return null; | ||
} | ||
} | ||
|
||
static private GraphicsPath Arc () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddArc (20, 20, 200, 200, 60, 120); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Bezier () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddBezier ( | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100) | ||
); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Beziers () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddBeziers (new Point[7] { | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100), | ||
new Point (200, 100), new Point (240, 240), | ||
new Point (20, 100) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath ClosedCurve () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddClosedCurve (new Point[4] { | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Curve () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddCurve (new Point[4] { | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Ellipse () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddEllipse (20, 20, 200, 100); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Line () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddLine (20, 20, 200, 100); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Lines () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddLines (new Point[4] { | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Pie () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddPie (20, 20, 200, 200, 60, 120); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Polygon () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddPolygon (new Point[4] { | ||
new Point (20, 100), new Point (70, 10), | ||
new Point (130, 200), new Point (180, 100) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Rectangle () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddRectangle (new Rectangle (20, 20, 200, 200)); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Rectangles () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddRectangles (new Rectangle[2] { | ||
new Rectangle (20, 20, 100, 100), | ||
new Rectangle (100, 100, 20, 20) | ||
}); | ||
return path; | ||
} | ||
|
||
static private GraphicsPath String () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
try { | ||
path.AddString ("Mono", FontFamily.GenericMonospace, 0, 10f, new Point (20, 20), StringFormat.GenericDefault); | ||
} | ||
catch (NotImplementedException) { | ||
// not implemented in libgdiplus | ||
} | ||
return path; | ||
} | ||
|
||
static private GraphicsPath Complex () | ||
{ | ||
GraphicsPath path = new GraphicsPath (); | ||
path.AddPath (Pie (), false); | ||
path.AddPath (Rectangle (), true); | ||
path.AddPath (Polygon (), false); | ||
return path; | ||
} | ||
} | ||
} |
Oops, something went wrong.