|
|
[C#]
Canvas canvas = new Canvas(200, 200, new XColor(Color.Yellow));
canvas.Pattern = XImage.FromFile(Server.MapPath("rez/boat.gif"));
double[] points = { 30,190, 100,10, 170,190, 10,70, 190,70 };
canvas.DrawPoly(points, new DrawOptions(canvas));
canvas.SaveAs(Server.MapPath("pattern.jpg"));
[Visual Basic]
Dim canvas As New Canvas(200, 200, New XColor(Color.Yellow))
canvas.Pattern = XImage.FromFile(Server.MapPath("rez/boat.gif"))
Dim points As Double() = {30, 190, 100, 10, 170, 190, _
10, 70, 190, 70}
canvas.DrawPoly(points, New DrawOptions(canvas))
canvas.SaveAs(Server.MapPath("pattern.jpg"))
The page draws a closed polygon in the shape of a star filling
it with a pattern. It then saves the image out as a jpeg. The input
and output images are shown below.
boat.gif
pattern.jpg
|