|
[Visual Basic]
Dim ca As New Canvas
Dim myshape, myrot, mytra As String
Dim i, j As Integer
myshape = "Size=30,30 Operation=both PaintColor=green PenColor=red"
ca.Width = 200
ca.Height = 200
For i = 0 To 4
For j = 0 To 4
myrot = " Rotation=" + (i * 50).ToString()
+ (j * 10).ToString() + ",15,15"
mytra = " Translate=" + (j * 40).ToString()
+ "," + (i * 40).ToString()
ca.DrawShape("rect", myshape +
myrot + mytra)
Next
Next
Response.ContentType = "image/png"
Response.BinaryWrite(ca.GetAs("getas.png",""))
[C#]
Canvas ca = new Canvas();
string myshape = "Size=30,30 Operation=both PaintColor=green
PenColor=red";
ca.Width = 200;
ca.Height = 200;
for (int i = 0; i <= 4; i++) {
for (int j = 0; j <= 4; j++) {
int r = (i * 50) + (j * 10);
string myrot = " Rotation=" +
r.ToString() + ",15,15";
string mytra = " Translate=" +
(j * 40).ToString() + "," + (i * 40).ToString();
ca.DrawShape("rect", myshape +
myrot + mytra);
}
}
Response.ContentType = "image/png";
Response.BinaryWrite(ca.GetAs("getas.png",""));
A sample output file is shown below.
getas.png
|
|
|