| private void Page_Load(object sender, System.EventArgs e)
|
| { |
| // Create instance of PhotoSprite |
| Graphic MyGraphic = new PhotoSprite.Graphic();
|
| |
| // Original image name |
| MyGraphic.SourceFile = Server.MapPath( "/images/demo.jpg" );
|
| // Destination image name, and can make the same as the original image name |
| MyGraphic.DestFile = Server.MapPath( "/images/tmp/crop.jpg" );
|
| |
| // Crop shape |
| // Rect, Square, Ellipse, Circle |
| |
| // Rectangle |
| // X and Y are the rectangle's top left apex coordinate |
| // Width and Height are the rectangle's width and height |
| MyGraphic.CropShape = PhotoSprite.Graphic.ShapeMode.Rectangle;
|
| MyGraphic.X = 70;
|
| MyGraphic.Y = 25;
|
| MyGraphic.Width = 260;
|
| MyGraphic.Height = 240;
|
| |
| // Square |
| // X and Y are the square's top left apex coordinate |
| // Width is square's edge length |
| // Height is invalid |
| // MyGraphic.CropShape = PhotoSprite.Graphic.ShapeMode.Square; |
| // MyGraphic.X = 70; |
| // MyGraphic.Y = 25; |
| // MyGraphic.Width = 250; |
| |
| // Ellipse |
| // X and Y are the ellipse's center coordinate |
| // Width is the ellipse's major axis |
| // Height is the ellipse's minor axis |
| // MyGraphic.CropShape = PhotoSprite.Graphic.ShapeMode.Ellipse; |
| // MyGraphic.X = 70; |
| // MyGraphic.Y = 30; |
| // MyGraphic.Width = 260; |
| // MyGraphic.Height = 240; |
| |
| // Circle |
| // X and Y are the circle's center coordinate |
| // Width is the circle's radius |
| // Height is invalid |
| // MyGraphic.CropShape = PhotoSprite.Graphic.ShapeMode.Circle; |
| // MyGraphic.X = 70; |
| // MyGraphic.Y = 30; |
| // MyGraphic.Width = 250; |
| |
| // Croping image by appointed shape |
| MyGraphic.Crop();
|
| |
| |
| // Show the contrastive effect |
| SrcImage.Src = "/images/demo.jpg";
|
| DstImage.Src = "/images/tmp/crop.jpg";
|
| } |
|