Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShapeRegion"/> class.
        /// </summary>
        /// <param name="shape">The shape.</param>
        public ShapeRegion(IPath shape)
        {
            this.Shape = shape.AsClosedPath();
            int left   = (int)MathF.Floor(shape.Bounds.Left);
            int top    = (int)MathF.Floor(shape.Bounds.Top);
            int right  = (int)MathF.Ceiling(shape.Bounds.Right);
            int bottom = (int)MathF.Ceiling(shape.Bounds.Bottom);

            this.Bounds = Rectangle.FromLTRB(left, top, right, bottom);
        }
        public FillPathProcessor(
            Configuration configuration,
            FillPathProcessor definition,
            Image <TPixel> source,
            Rectangle sourceRectangle)
            : base(configuration, source, sourceRectangle)
        {
            IPath path   = definition.Region;
            int   left   = (int)MathF.Floor(path.Bounds.Left);
            int   top    = (int)MathF.Floor(path.Bounds.Top);
            int   right  = (int)MathF.Ceiling(path.Bounds.Right);
            int   bottom = (int)MathF.Ceiling(path.Bounds.Bottom);

            this.bounds     = Rectangle.FromLTRB(left, top, right, bottom);
            this.path       = path.AsClosedPath();
            this.definition = definition;
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShapeRegion"/> class.
 /// </summary>
 /// <param name="shape">The shape.</param>
 public ShapeRegion(IPath shape)
 {
     this.Shape  = shape.AsClosedPath();
     this.Bounds = shape.Bounds.Convert();
 }