public MediaRenditionInfo Crop(Rectangle rect) { var transformation = MediaTransformation.ParsePath(this.path); transformation.Crop(rect); return new MediaRenditionInfo(transformation); }
/// <summary> /// 図形パスの開始Nodeを用いてFigurePathクラスを初期化する. /// </summary> /// <param name="start_point"></param> public FigurePath(Point2D start_point) { points = new List<Point2D>(); lines = new List<LineSegment2D>(); min_x = max_x = start_point.X; min_y = max_y = start_point.Y; envelope = new Rectangle(start_point, 0, 0, 0); points.Add(start_point); }
public Crop(int x, int y, int width, int height) { #region Preconditions if (width <= 0) throw new ArgumentOutOfRangeException("width", width, "Must be greater than 0"); if (height <= 0) throw new ArgumentOutOfRangeException("height", height, "Must be greater than 0"); #endregion Rectangle = new Rectangle(x, y, width, height); }
static void Main() { var circle = new Circle(4.0f); Console.WriteLine("Area of a circle with a 4.0 radius is {0}", circle.GetArea()); var rectangle = new Rectangle(7.0, 2.0); Console.WriteLine("Area of a rectangle with 7.0 Height and 2.0 Width is {0}", rectangle.GetArea()); var equilateralTriangle = new EquilateralTriangle(4.5); Console.WriteLine("Area of an equilateral triangle with a 4.5 long side is {0}", equilateralTriangle.GetArea()); var square = new Square(5.0); Console.WriteLine("Area of a square with 5.0 long sides is {0}", square.GetArea()); Console.ReadKey(); }
static void Main() { Shape[] someShapes = new Shape[6]; someShapes[0] = new Rectangle(5, 6); someShapes[1] = new Triangle(5, 6); someShapes[2] = new Circle(4); someShapes[3] = new Triangle(11, 7); someShapes[4] = new Rectangle(5, 6); someShapes[5] = new Circle(15); foreach (Shape shape in someShapes) { Console.WriteLine("Shape type: {0} \nSurface: {1}", shape.GetType(), shape.CalculateSurface()); Console.WriteLine(); } }
public Crop(Rectangle rectangle) { Rectangle = rectangle; }
public MediaTransformation Crop(Rectangle rect) { Transform(new Crop(rect)); return this; }