1: ShapeStyle shape;
2: try
3: {
4: shape = (ShapeStyle)int.Parse(Request.QueryString["shape"]);
5: }
6: catch
7: {
8: shape = ShapeStyle.Default;
9: }
10:
11: EffectStyle effect;
12:
13: try
14: {
15: effect = (EffectStyle)int.Parse(Request.QueryString["effect"]);
16: }
17: catch
18: {
19: effect = EffectStyle.Default;
20: }
21:
22: Shape sp = new Shape();
23: sp.ShapeStyle = shape;
24: switch (shape)
25: {
26: case ShapeStyle.ShearHorizontal:
27: case ShapeStyle.ShearVertical:
28: case ShapeStyle.SwellHorizontal:
29: case ShapeStyle.SwellVertical:
30: case ShapeStyle.RainbowLower:
31: case ShapeStyle.RainbowUpper:
32: sp.Degree = 50;
33: break;
34: case ShapeStyle.Squeeze:
35: case ShapeStyle.ArchLower:
36: case ShapeStyle.ArchUpper:
37: case ShapeStyle.Bulge:
38: sp.Degree = 200;
39: break;
40: case ShapeStyle.Dither :
41: sp.Degree = 3;
42: break;
43: case ShapeStyle.RipTop:
44: case ShapeStyle.RipBottom:
45: sp.Degree = 10;
46: break;
47: default:
48: sp.Degree = 20;
49: break;
50: }
51:
52: Effect et = new Effect();
53: et.EffectStyle = effect;
54: et.Distance = 5;
55:
56: Writer writer = new Writer(canvas);
57:
58: //writer.Colors = new Color[] {Color.White,
Color.Orange };
59: writer.Effect = et;
60: writer.Shape = sp;
61: writer.PositionStyle = PositionStyle.BottomRight;
62: writer.FontFamily = new FontFamily("Arial");
63: writer.FontSize = 28;
64: System.Drawing.Image result = writer.WriteText("ImageComponent.NET");
65: MemoryStream oStream = new MemoryStream();
66: result.Save(oStream, System.Drawing.Imaging.ImageFormat.Jpeg);
67: Response.BinaryWrite(oStream.ToArray());