Exemple #1
0
        /// <summary>Initializes a new instance of the <see cref="Metrics"/> class.</summary>
        /// <param name="bitmapSize">The <see cref="System.Drawing.Size"/> of the <see cref="System.Drawing.Bitmap"/></param>
        /// <param name="innerRect"><see cref="System.Drawing.Rectangle"/> that contains information about position and size of inner corners.</param>
        public Metrics(Size bitmapSize, Rectangle innerRect)
        {
            // From one rectangle, we're creating 12, each of them represents
            // corner (vertical/horizontal) or side. Yes, we could calculate
            // them later, right before updating layered windows, but, then
            // it would becomes a mess. Also, instead of creating 12 rectangles
            // once, we would create them each update, so it's an issue.

            // Calculating Metrics
            Left = new Rectangle(new Point(0, innerRect.Top), new Size(innerRect.Left, innerRect.Bottom - innerRect.Top));
            Top = new Rectangle(new Point(innerRect.Left, 0), new Size(innerRect.Right - innerRect.Left, innerRect.Top));
            Right = new Rectangle(new Point(innerRect.Right, innerRect.Top), new Size(bitmapSize.Width - innerRect.Right, innerRect.Bottom - innerRect.Top));
            Bottom = new Rectangle(new Point(innerRect.Left, innerRect.Bottom), new Size(innerRect.Right - innerRect.Left, bitmapSize.Height - innerRect.Bottom));

            // Corners for vertical sides (left, right)
            Vertical = new Corners {
                TopLeft = new Rectangle(new Point(0, 0), new Size(innerRect.Left, innerRect.Top)),
                TopRight = new Rectangle(new Point(innerRect.Right, 0), new Size(bitmapSize.Width - innerRect.Right, innerRect.Top)),
                BottomLeft = new Rectangle(new Point(0, innerRect.Bottom), new Size(innerRect.Left, bitmapSize.Height - innerRect.Bottom)),
                BottomRight = new Rectangle(new Point(innerRect.Right, innerRect.Bottom), new Size(Right.Width, Bottom.Height)),
            };

            // Corners for horizontal sides (top, bottom)
            Horizontal = new Corners {
                TopLeft = new Rectangle(new Point(innerRect.Left, innerRect.Top), new Size(innerRect.Left, innerRect.Top)),
                TopRight = new Rectangle(new Point(innerRect.Right - Vertical.TopRight.Width, innerRect.Top), Vertical.TopRight.Size),
                BottomLeft = new Rectangle(new Point(innerRect.Left, innerRect.Top * 2), new Size(innerRect.Left, innerRect.Bottom - innerRect.Top * 2)),
                BottomRight = new Rectangle(new Point(Right.X - Right.Width, Bottom.Y - Bottom.Height), new Size(Right.Width, Bottom.Height)),
            };
        }
Exemple #2
0
        //---------------------------------------------------------------------------

        public void AddCorners()
        {
            foreach (CorridorSegment segment in Segments)
            {
                Corners.Add(new Corner(new Point(segment.End.X - 2, segment.End.Y - 2), new Vector2(0.0f, -5.0f)));
                Corners.Add(new Corner(new Point(segment.End.X - 2, segment.Start.Y + 3), new Vector2(0.0f, 5.0f)));
                Corners.Add(new Corner(new Point(segment.Start.X + 3, segment.End.Y - 2), new Vector2(0.0f, -5.0f)));
                Corners.Add(new Corner(new Point(segment.Start.X + 3, segment.Start.Y + 3), new Vector2(0.0f, 5.0f)));

                Corners.Add(new Corner(new Point(segment.End.X - 2, segment.End.Y - 2), new Vector2(0.0f, 5.0f)));
                Corners.Add(new Corner(new Point(segment.End.X - 2, segment.Start.Y + 3), new Vector2(0.0f, -5.0f)));
                Corners.Add(new Corner(new Point(segment.Start.X + 3, segment.End.Y - 2), Vector2.Zero));
                Corners.Add(new Corner(new Point(segment.Start.X + 3, segment.Start.Y + 3), Vector2.Zero));
            }
        }
Exemple #3
0
        public void Transformation(float Dx, float Dy, float Dlg, float Dlv, Corners Corner)
        {
            switch (Corner)
            {
            case Corners.TopLeft:
                _Rec.X      += Dx;
                _Rec.Width  -= Dx;
                _Rec.Y      += Dy;
                _Rec.Height -= Dy;
                break;

            case Corners.BottomRight:
                _Rec.Width  += Dx;
                _Rec.Height += Dy;
                break;

            case Corners.TopRight:
                _Rec.Width  += Dx;
                _Rec.Y      += Dy;
                _Rec.Height -= Dy;
                break;

            case Corners.BottomLeft:
                _Rec.X      += Dx;
                _Rec.Width  -= Dx;
                _Rec.Height += Dy;
                break;

            case Corners.Top:
                _Rec.Y      += Dy;
                _Rec.Height -= Dy;
                break;

            case Corners.Bottom:
                _Rec.Height += Dy;
                break;

            case Corners.Left:
                _Rec.X     += Dx;
                _Rec.Width -= Dx;
                break;

            case Corners.Right:
                _Rec.Width += Dx;
                break;
            }
            DoXY();
        }
Exemple #4
0
        /**
         * Returns the eight corners of this frustum.
         *
         * @return the eight frustum corners.
         */
        public Corners getCorners()
        {
            Corners corners = new Corners();

            corners.nbl = Plane.intersect(this.near, this.bottom, this.left);
            corners.nbr = Plane.intersect(this.near, this.bottom, this.right);
            corners.ntl = Plane.intersect(this.near, this.top, this.left);
            corners.ntr = Plane.intersect(this.near, this.top, this.right);

            corners.fbl = Plane.intersect(this.far, this.bottom, this.left);
            corners.fbr = Plane.intersect(this.far, this.bottom, this.right);
            corners.ftl = Plane.intersect(this.far, this.top, this.left);
            corners.ftr = Plane.intersect(this.far, this.top, this.right);

            return(corners);
        }
Exemple #5
0
        private void AssignLandandBaseElevations(Corners crn, double variant)
        {
            var stdx = GetStdCoord(crn.location.X);
            var stdy = GetStdCoord(crn.location.Y);

            crn.mapdata.Water = !_islandFactory.RadialLand(stdx, stdy, variant);
            if (crn.border)
            {
                crn.mapdata.Elevation = 0.0;
                cornerQueue.Enqueue(crn);
            }
            else
            {
                crn.mapdata.Elevation = 255;
            }
        }
 public RegionBase(int mapResoultion, int terrainHeight, Corners corner, Regions region, RatingScale maxHeight, RatingScale minHeight, RatingScale hillHeight, RatingScale hillyness, RatingScale hillWidth)
 {
     Length = mapResoultion / 2;
     ResetMap();
     Corner           = corner;
     MaxHeight        = maxHeight;
     MinHeight        = minHeight;
     Hillyness        = hillyness;
     HillHeight       = hillHeight;
     random           = random ?? new System.Random();
     GrassLandsRadius = Length / 4;
     MaxNumberOfMountainsAtOneTime = 5;
     HillWidth     = hillWidth;
     TerrainHeight = terrainHeight;
     Region        = region;
 }
        /// <summary>
        /// Creates a rectangle with the specified corners rounded
        /// </summary>
        /// <param name="r"></param>
        /// <param name="radius"></param>
        /// <param name="corners"></param>
        /// <returns></returns>
        public static GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            var path = new GraphicsPath();
            radius -= 2;
            int d = radius * 2;

            int nw = (corners & Corners.NorthWest) == Corners.NorthWest ? d : 0;
            int ne = (corners & Corners.NorthEast) == Corners.NorthEast ? d : 0;
            int se = (corners & Corners.SouthEast) == Corners.SouthEast ? d : 0;
            int sw = (corners & Corners.SouthWest) == Corners.SouthWest ? d : 0;

            path.AddLine(r.Left + nw, r.Top, r.Right - ne, r.Top);

            if (ne > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Right - ne, r.Top, r.Right, r.Top + ne),
                            -90, 90);
            }

            path.AddLine(r.Right, r.Top + ne, r.Right, r.Bottom - se);

            if (se > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Right - se, r.Bottom - se, r.Right, r.Bottom),
                            0, 90);
            }

            path.AddLine(r.Right - se, r.Bottom, r.Left + sw, r.Bottom);

            if (sw > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Left, r.Bottom - sw, r.Left + sw, r.Bottom),
                            90, 90);
            }

            path.AddLine(r.Left, r.Bottom - sw, r.Left, r.Top + nw);

            if (nw > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Left, r.Top, r.Left + nw, r.Top + nw),
                            180, 90);
            }

            path.CloseFigure();

            return path;
        }
        /// <summary>
        /// Creates a rectangle with the specified corners rounded
        /// </summary>
        /// <param name="r"></param>
        /// <param name="radius"></param>
        /// <param name="corners"></param>
        /// <returns></returns>
        public static GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            GraphicsPath path = new GraphicsPath();
            int          d    = radius * 2;

            int nw = (corners & Corners.NorthWest) == Corners.NorthWest ? d : 0;
            int ne = (corners & Corners.NorthEast) == Corners.NorthEast ? d : 0;
            int se = (corners & Corners.SouthEast) == Corners.SouthEast ? d : 0;
            int sw = (corners & Corners.SouthWest) == Corners.SouthWest ? d : 0;

            path.AddLine(r.Left + nw, r.Top, r.Right - ne, r.Top);

            if (ne > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Right - ne, r.Top, r.Right, r.Top + ne),
                            -90, 90);
            }

            path.AddLine(r.Right, r.Top + ne, r.Right, r.Bottom - se);

            if (se > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Right - se, r.Bottom - se, r.Right, r.Bottom),
                            0, 90);
            }

            path.AddLine(r.Right - se, r.Bottom, r.Left + sw, r.Bottom);

            if (sw > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Left, r.Bottom - sw, r.Left + sw, r.Bottom),
                            90, 90);
            }

            path.AddLine(r.Left, r.Bottom - sw, r.Left, r.Top + nw);

            if (nw > 0)
            {
                path.AddArc(Rectangle.FromLTRB(r.Left, r.Top, r.Left + nw, r.Top + nw),
                            180, 90);
            }

            path.CloseFigure();

            return(path);
        }
    private GameObject AddCorner(Corners corner)
    {
        GameObject go = new GameObject("Corner " + corner.ToString());

        Image img = go.AddComponent <Image>();

        img.color = _cornerColor;
        if (_cornerSprite != null)
        {
            img.sprite = _cornerSprite;
        }

        ResizableUICorner resizableUICorner = go.AddComponent <ResizableUICorner>();

        resizableUICorner.ResizableUIComponent = this;
        resizableUICorner.DraggableID          = corner;

        RectTransform imgRect = img.GetComponent <RectTransform>();

        imgRect.pivot = new Vector2(0.5f, 0.5f);
        imgRect.SetParent(transform);

        switch (corner)
        {
        case Corners.TopLeft:
            imgRect.SetAnchorTopLeft(true);
            break;

        case Corners.TopRight:
            imgRect.SetAnchorTopRight(true);
            break;

        case Corners.BottomLeft:
            imgRect.SetAnchorBottomLeft(true);
            break;

        case Corners.BottomRight:
            imgRect.SetAnchorBottomRight(true);
            break;
        }

        imgRect.sizeDelta = new Vector2(_cornerSize, _cornerSize);
        go.SetActive(false);
        return(go);
    }
Exemple #10
0
        /// <summary>
        /// </summary>
        void Update()
        {
            if (this._draw_bounds)
            {
                var corners =
                    Corners.ExtractCorners(this.ActorBounds.center, this.ActorBounds.extents, this.transform);

                Corners.DrawBox(corners[0],
                                corners[1],
                                corners[2],
                                corners[3],
                                corners[4],
                                corners[5],
                                corners[6],
                                corners[7],
                                Color.gray);
            }
        }
Exemple #11
0
        public void UpdateProperties()
        {
            Position = new Vector3(Corners.Average(p => p.position.x), Corners.Average(p => p.position.y), Corners.Average(p => p.position.z));

            float heightAv = (Vector3.Distance(Corners[0].position, Corners[2].position) +
                              Vector3.Distance(Corners[1].position, Corners[7].position) +
                              Vector3.Distance(Corners[6].position, Corners[4].position) +
                              Vector3.Distance(Corners[3].position, Corners[5].position)) / 4;

            float widthAv = (Vector3.Distance(Corners[0].position, Corners[1].position) +
                             Vector3.Distance(Corners[3].position, Corners[6].position) +
                             Vector3.Distance(Corners[2].position, Corners[7].position) +
                             Vector3.Distance(Corners[4].position, Corners[5].position)) / 4;

            float deepAv = (Vector3.Distance(Corners[0].position, Corners[3].position) +
                            Vector3.Distance(Corners[1].position, Corners[6].position) +
                            Vector3.Distance(Corners[7].position, Corners[4].position) +
                            Vector3.Distance(Corners[2].position, Corners[5].position)) / 4;

            Size = new Vector3(deepAv, heightAv, widthAv);

            float angleAv = Mathf.Atan2(Corners[1].position.x - Corners[0].position.x, Corners[1].position.z - Corners[0].position.z) * Mathf.Rad2Deg +
                            Mathf.Atan2(Corners[6].position.x - Corners[3].position.x, Corners[6].position.z - Corners[3].position.z) * Mathf.Rad2Deg +
                            Mathf.Atan2(Corners[7].position.x - Corners[2].position.x, Corners[7].position.z - Corners[2].position.z) * Mathf.Rad2Deg +
                            Mathf.Atan2(Corners[4].position.x - Corners[5].position.x, Corners[4].position.z - Corners[5].position.z) * Mathf.Rad2Deg;


            Rotation = Quaternion.Euler(0, angleAv / 4, 0);


            // Update ObjectClass
            ObjectClass = Scores.OrderByDescending(x => x.Value).FirstOrDefault().Key;
            Score       = Scores[ObjectClass] / NDetections;

            Defined = (!Corners[0].occluded &&
                       !Corners[1].occluded &&
                       (!Corners[7].occluded || !Corners[2].occluded || !Corners[4].occluded || !Corners[5].occluded) &&
                       (!Corners[4].occluded || !Corners[5].occluded || !Corners[6].occluded || !Corners[3].occluded)) || Defined;

            if (Defined)
            {
                Corners.ForEach(c => c.SetOccluded(false));
            }
        }
        public Primitives.Path Create( double x, double y, double width, double height, double radius, Corners corners )
        {
            bool topLeft = (corners & Corners.TopLeft) != 0;
            bool topRight = (corners & Corners.TopRight) != 0;
            bool bottomLeft = (corners & Corners.BottomLeft) != 0;
            bool bottomRight = (corners & Corners.BottomRight) != 0;

            Primitives.Path path = new Primitives.Path();

            path.Add( new Primitives.Path.Move( new Types.Point( x + (topLeft ? radius : 0), y ) ) );
            path.Add( new Primitives.Path.Line( new Types.Point( x + width - (topRight ? radius : 0), y ) ) );

            if( topRight )
            {
                path.Add( new Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new Types.Point( x + width, y + radius ) ) );
            }

            path.Add( new Primitives.Path.Line( new Types.Point( x + width, y + height - (bottomRight ? radius : 0) ) ) );

            if( bottomRight )
            {
                path.Add( new Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new Types.Point( x + width - radius, y + height ) ) );
            }

            path.Add( new Primitives.Path.Line( new Types.Point( x + (bottomLeft ? radius : 0), y + height ) ) );

            if( bottomLeft )
            {
                path.Add( new Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new Types.Point( x, y + height - radius ) ) );
            }

            path.Add( new Primitives.Path.Line( new Types.Point( x, y + (topLeft ? radius : 0) ) ) );

            if( topLeft )
            {
                path.Add( new Primitives.Path.EllipticalArc( radius, radius, 0, false, true, new Types.Point( x + radius, y ) ) );
            }

            path.Add( new Primitives.Path.Close() );

            return path;
        }
Exemple #13
0
        private bool needToDrawCorner(MazeNode n, Corners corner)
        {
            switch (corner)
            {
            case Corners.TopLeft:
                return(needToDrawCorner(n.LeftEdge, n.TopEdge));

            case Corners.TopRight:
                return(needToDrawCorner(n.RightEdge, n.TopEdge));

            case Corners.BottomLeft:
                return(needToDrawCorner(n.LeftEdge, n.BottomEdge));

            case Corners.BottomRight:
                return(needToDrawCorner(n.RightEdge, n.BottomEdge));

            default:
                return(false);
            }
        }
Exemple #14
0
        private static int SwwepStart(Corners corner)
        {
            switch (corner)
            {
            case Corners.TopLeft:
                return(180);

            case Corners.TopRight:
                return(270);

            case Corners.BottomRight:
                return(0);

            case Corners.BottomLeft:
                return(90);

            default:
                return(0);
            }
        }
Exemple #15
0
        private void UpdateOverlappingCorners()
        {
            _cropCorners = Corners.None;
            var corners = new Vector3[4];

            _window.GetWorldCorners(corners);

            for (int cornerIndex = 0; cornerIndex < 4; cornerIndex++)
            {
                var viewPortPosition =
                    _cam.ScreenToViewportPoint((Vector2)corners[cornerIndex] + MouseOffset);

                if (OnViewPort(viewPortPosition))
                {
                    continue;
                }

                _cropCorners |= GetCorner(cornerIndex);
            }
        }
Exemple #16
0
        /// <summary>Returns the smallest "IsFlat" rectangle that encloses this rectangle.</summary>
        public WRectangle GetFlatEnclosingRectangle()
        {
            if (IsFlat)
            {
                return(this);
            }
            double minX = Corners.Min(c => c.X);
            double minY = Corners.Min(c => c.Y);
            double maxX = Corners.Max(c => c.X);
            double maxY = Corners.Max(c => c.Y);

            if (Geometry.IsCoordinatePlanePaper)
            {
                return(new WRectangle(width: maxX - minX, height: maxY - minY, corner: new WPoint(minX, maxY), rotation: 0));
            }
            else if (Geometry.IsCoordinatePlaneScreen)
            {
                return(new WRectangle(width: maxX - minX, height: maxY - minY, corner: new WPoint(minX, minY), rotation: 0));
            }
            throw new NotImplementedException("Unknown Coordinate Plane: " + Geometry.CoordinatePlane);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="labelerPanel">LabelerPanel holding the Strokes to fragment</param>
        public AutoFragmentCmd(LabelerPanel labelerPanel)
        {
            this.labelerPanel = labelerPanel;
            Sketch.Stroke[] strokes = this.labelerPanel.Sketch.Strokes;

            this.oldStrokeToCorners = new Dictionary <Sketch.Stroke, List <int> >(strokes.Length);
            foreach (Sketch.Stroke stroke in strokes)
            {
                List <int> corners;
                if (this.labelerPanel.LTool.StrokeToCorners.TryGetValue(stroke, out corners))
                {
                    this.oldStrokeToCorners.Add(stroke, corners);
                }
            }

            this.strokeToCorners = new Dictionary <Sketch.Stroke, List <int> >();

            // Initialize the FeatureStrokes
            FeatureStroke[] featureStrokes = new FeatureStroke[strokes.Length];
            for (int i = 0; i < featureStrokes.Length; i++)
            {
                featureStrokes[i] = new FeatureStroke(strokes[i]);
            }

            for (int i = 0; i < featureStrokes.Length; i++)
            {
                List <int> currCorners = new List <int>();

                int[] corners = new Corners(featureStrokes[i]).FindCorners();

                if (corners.Length > 0)
                {
                    this.strokeToCorners.Add(strokes[i], new List <int>(corners));
                }
                else
                {
                    this.strokeToCorners.Add(strokes[i], new List <int>());
                }
            }
        }
            public Corners ToSides(float top = n, float left = n, float right = n, float bottom = n)
            {
                var c = new Corners(this);

                if (!Nan(top))
                {
                    c.topLeft = c.topRight = top;
                }
                if (!Nan(left))
                {
                    c.topLeft = c.bottomLeft = left;
                }
                if (!Nan(right))
                {
                    c.topRight = c.bottomRight = right;
                }
                if (!Nan(bottom))
                {
                    c.bottomLeft = c.bottomRight = bottom;
                }
                return(c);
            }
    public CellItem GetCellForCorner(CellItem initialPoint, Corners corner)
    {
        //inverse because we iterate to the other ends
        int xIncrmenet = corner == Corners.BL || corner == Corners.TL ? -1 : 1;
        int yIncrmenet = corner == Corners.BL || corner == Corners.BR ? -1 : 1;

        CellItem foundCell      = initialPoint;
        int      nextIterationX = foundCell.CellColumn + xIncrmenet;
        int      nextIterationY = foundCell.CellRow + yIncrmenet;

        //Check still in array bounds
        while (nextIterationX >= 0 && nextIterationX < GetRowLength() &&
               nextIterationY >= 0 && nextIterationY < GetColLength())
        {
            //iterate the item
            foundCell = GetGridCell(nextIterationX, nextIterationY);

            nextIterationX = foundCell.CellColumn + xIncrmenet;
            nextIterationY = foundCell.CellRow + yIncrmenet;
        }
        return(foundCell);
    }
Exemple #20
0
    private void FindPotentialCorners()
    {
        var groupSize = Vertices.Count / NumberOfCorners;

        for (var i = 0; i < NumberOfCorners; i++)
        {
            var thisGroup      = i;
            var thisOuterGroup = thisGroup - 1 < 0 ? NumberOfCorners - 1 : thisGroup - 1;
            var nextGroup      = thisGroup + 1 >= NumberOfCorners ? 0 : thisGroup + 1;
            var nextOuterGroup = nextGroup + 1 >= NumberOfCorners ? 0 : nextGroup + 1;

            Corners.Add(new Exit(i,
                                 Vertices[thisOuterGroup * groupSize + 6],
                                 Vertices[thisOuterGroup * groupSize + 5],
                                 Vertices[thisGroup * groupSize + 5],
                                 Vertices[thisGroup * groupSize + 6],
                                 Vertices[nextGroup * groupSize + 6],
                                 Vertices[nextGroup * groupSize + 5],
                                 Vertices[nextOuterGroup * groupSize + 5],
                                 Vertices[nextOuterGroup * groupSize + 6]));
        }
    }
Exemple #21
0
 public void InsetCorner(float inset, Corners corner)
 {
     if (cornerInsets == null || cornerInsets.Length == 0)
     {
         cornerInsets = new float[] { 0, 0, 0, 0 };
     }
     if (corner == Corners.Left)
     {
         cornerInsets[(int)Corners.Left] = inset;
     }
     if (corner == Corners.Front)
     {
         cornerInsets[(int)Corners.Front] = inset;
     }
     if (corner == Corners.Right)
     {
         cornerInsets[(int)Corners.Right] = inset;
     }
     if (corner == Corners.Back)
     {
         cornerInsets[(int)Corners.Back] = inset;
     }
 }
        /// <summary>
        /// Gets the corners to round on the specified button
        /// </summary>
        /// <param name="r"></param>
        /// <param name="button"></param>
        /// <returns></returns>
        private Corners ToolStripItemCorners(ToolStripItem item)
        {
            if (!(item.Owner is ToolStrip))
            {
                return(Corners.All);
            }

            ToolStrip g     = item.Owner;
            int       iLast = item.Owner.Items.Count - 1;
            Corners   c     = Corners.None;

            if (item.Owner.Items.IndexOf(item) == 0)
            {
                c |= Corners.West;
            }

            if (item.Owner.Items.IndexOf(item) == iLast)
            {
                c |= Corners.East;
            }

            return(c);
        }
Exemple #23
0
        public override Object EditValue(ITypeDescriptorContext context, IServiceProvider provider, Object value)
        {
            if (value.GetType() != typeof(Corners) || provider == null)
            {
                return(value);
            }

            var edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc != null)
            {
                var lb = new CheckedListBox
                {
                    BorderStyle  = BorderStyle.None,
                    CheckOnClick = true
                };

                lb.Items.Add("TopLeft", (((Button)context.Instance).RoundCorners & Corners.TopLeft) == Corners.TopLeft);
                lb.Items.Add("TopRight", (((Button)context.Instance).RoundCorners & Corners.TopRight) == Corners.TopRight);
                lb.Items.Add("BottomLeft", (((Button)context.Instance).RoundCorners & Corners.BottomLeft) == Corners.BottomLeft);
                lb.Items.Add("BottomRight", (((Button)context.Instance).RoundCorners & Corners.BottomRight) == Corners.BottomRight);

                edSvc.DropDownControl(lb);
                Corners cornerFlags = Corners.None;

                foreach (object o in lb.CheckedItems)
                {
                    cornerFlags = cornerFlags | (Corners)Enum.Parse(typeof(Corners), o.ToString());
                }

                lb.Dispose();
                edSvc.CloseDropDown();
                return(cornerFlags);
            }

            return(value);
        }
Exemple #24
0
        private void drawCornerIfNeeded(IRenderer r, MazeNode node,
                                        Corners corner,
                                        int x1, int y1, int x2, int y2,
                                        double xStep, double yStep)
        {
            if (needToDrawCorner(node, corner))
            {
                int halfLinewidth = -(LineWidth / 2);

                Rectangle cornerRec = normilisedRectangle(
                    (int)((x1 + x2) / 2),
                    (int)((y1 + y2) / 2),
                    ((int)(xStep / 2) * HorizComponent(corner)) - halfLinewidth,
                    ((int)(yStep / 2) * VertComponent(corner)) - halfLinewidth);

                r.SetHighQuality(false);
                r.FillRectangle(this.LineColor, cornerRec);
                r.SetHighQuality(true);
                r.FillPie(this.fillColor,
                          x1 - halfLinewidth, y1 - halfLinewidth,
                          (int)xStep - lineWidth, (int)yStep - lineWidth,
                          SwwepStart(corner), 90);
            }
        }
Exemple #25
0
        private void RenderHexagon(Hexagon hexagon)
        {
            var visualSettings           = World.GameSettings.VisualSettings;
            var colorCollection          = visualSettings.ColorCollection;
            var layoutSettings           = World.GameSettings.LayoutSettings;
            var worldPosition            = hexagon.Position.GetWorldPosition(layoutSettings.HexagonRadius, layoutSettings.HexagonMargin);
            var corners                  = Corners.Select(c => c * layoutSettings.HexagonRadius + worldPosition).ToArray();
            var innerColor               = colorCollection.GetInnerHexagonColor(hexagon.ResourceType);
            var outerColor               = colorCollection.GetOuterHexagonColor(hexagon.ResourceType);
            var center                   = new CCV3F_C4B(worldPosition, innerColor);
            var adjacentHexagonPositions = hexagon.Position.GetAdjacentHexagonPositions();

            for (int i = 0; i < corners.Length; i++)
            {
                var p1 = new CCV3F_C4B(corners[i], outerColor);
                var p2 = new CCV3F_C4B(corners[(i + 1) % corners.Length], outerColor);
                DrawNode.DrawTriangle(p1, center, p2);
                if (World.HexagonManager[adjacentHexagonPositions[(6 - i + 2) % 6]]?.ResourceType != hexagon.ResourceType)
                {
                    DrawNode.DrawLine(corners[i], corners[(i + 1) % corners.Length], visualSettings.HexagonOuterBorderThickness, colorCollection.HexagonBorder);
                }
            }
            DrawNode.DrawText(worldPosition, hexagon.ResourceType.GetText(), Font.ArialFonts[32], new CCSize(layoutSettings.HexagonRadius * 2, layoutSettings.HexagonRadius * 2));
        }
 public void Transform(float Dx, float Dy, float Dlg, float Dlv, Color BackColor, Corners Corner, Graphics G)
 {
     for (int i = 0; i < _GroupItem.Count; i++)
     {
         Item It = (Item) _GroupItem[i];
         switch (It.TypeShape)
         {
             case Nows.Line:
                 Line L = (Line) _GroupItem[i];
                 L.Transform(Dx, Dy, Dlg, Dlv, BackColor, Corner, G);
                 break;
             case Nows.Rec:
                 Rec R = (Rec) _GroupItem[i];
                 R.Transform(Dx, Dy, Dlg, Dlv, BackColor, Corner, G);
                 break;
             case Nows.Ellip:
             case Nows.Pie:
                 Pie P = (Pie) _GroupItem[i];
                 P.Transform(Dx, Dy, Dlg, Dlv, BackColor, Corner, G);
                 break;
             case Nows.Group:
                 GroupItem GI = (GroupItem)_GroupItem[i];
                 GI.Transform(Dx, Dy, Dlg, Dlv, BackColor, Corner, G);
                 break;
         }
     }
     DoXY();
 }
Exemple #27
0
                bool IsRemoved(CornerSet cS, Corners cornersToIgnore)
                {
                    if ((cornersToIgnore & Corners.BR) == 0)
                    {
                        if (cS.cornerIndices[0].HasValue)
                        {
                            var c0 = cS.cornerIndices[0].Value;
                            if (_indicesToRemove.ContainsKey(c0))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c0 + 1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c0 + 2))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c0 + 3))
                            {
                                return(true);
                            }
                        }
                    }

                    if ((cornersToIgnore & Corners.FR) == 0)
                    {
                        if (cS.cornerIndices[1].HasValue)
                        {
                            var c1 = cS.cornerIndices[1].Value;

                            if (_indicesToRemove.ContainsKey(c1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c1 - 1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c1 - 2))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c1 - 3))
                            {
                                return(true);
                            }
                        }
                    }

                    if ((cornersToIgnore & Corners.BL) == 0)
                    {
                        if (cS.cornerIndices[2].HasValue)
                        {
                            var c2 = cS.cornerIndices[2].Value;

                            if (_indicesToRemove.ContainsKey(c2))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c2 - 1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c2 + 1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c2 + 2))
                            {
                                return(true);
                            }
                        }
                    }

                    if ((cornersToIgnore & Corners.FL) == 0)
                    {
                        if (cS.cornerIndices[3].HasValue)
                        {
                            var c3 = cS.cornerIndices[3].Value;

                            if (_indicesToRemove.ContainsKey(c3))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c3 - 1))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c3 - 2))
                            {
                                return(true);
                            }
                            if (_indicesToRemove.ContainsKey(c3 + 1))
                            {
                                return(true);
                            }
                        }
                    }

                    return(false);
                }
                public static void DrawTab(Graphics g, Rectangle r, Corners corner, GradientType gradient, Color darkColor, Color lightColor, Color edgeColor, bool closed)
                {
                    //dims
                    Point[] points;
                    GraphicsPath path;
                    Region Region;
                    LinearGradientBrush linearBrush;
                    Brush brush = null;
                    Pen pen;
                    r.Inflate(- 1, - 1);
                    //set brushes
                    switch (gradient)
                    {
                        case GradientType.Flat:
                            brush = new SolidBrush(darkColor);
                            break;
                        case GradientType.Linear:
                            brush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
                            break;
                        case GradientType.Bell:
                            linearBrush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
                            linearBrush.SetSigmaBellShape((float) (0.17F), (float) (0.67F));
                            brush = linearBrush;
                            break;
                    }
                    pen = new pen(edgeColor, 1);
                    //generic points
                    points = new Point[12] {new Point(r.Left, r.Bottom), new Point(r.Left, r.Bottom - bshift), new Point(r.Left, r.Top + bshift), new Point(r.Left, r.Top), new Point(r.Left + bshift, r.Top), new Point(r.Right - bshift, r.Top), new Point(r.Right, r.Top), new Point(r.Right, r.Top + bshift), new Point(r.Right, r.Bottom - bshift), new Point(r.Right, r.Bottom), new Point(r.Right - bshift, r.Bottom), new Point(r.Left + bshift, r.Bottom)};

                    path = new GraphicsPath();
                    switch (corner)
                    {
                        case Corners.LeftBottom:
                            path.AddLine(points[3], points[1]);
                            path.AddBezier(points[1], points[0], points[0], points[11]);
                            path.AddLine(points[11], points[9]);
                            path.AddLine(points[9], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[3], points[1]);
                            g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
                            g.DrawLine(pen, points[11], points[9]);
                            g.DrawLine(pen, points[9], points[6]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }
                            break;
                        case Corners.LeftTop:
                            path.AddLine(points[0], points[2]);
                            path.AddBezier(points[2], points[3], points[3], points[4]);
                            path.AddLine(points[4], points[6]);
                            path.AddLine(points[6], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[0], points[2]);
                            g.DrawBezier(pen, points[2], points[3], points[3], points[4]);
                            g.DrawLine(pen, points[4], points[6]);
                            g.DrawLine(pen, points[6], points[9]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }
                            break;
                        case Corners.Bottom:

                            path.AddLine(points[1], points[3]);
                            path.AddBezier(points[1], points[0], points[0], points[11]);
                            path.AddLine(points[11], points[10]);
                            path.AddBezier(points[10], points[9], points[9], points[8]);
                            path.AddLine(points[8], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);

                            g.DrawLine(pen, points[1], points[3]);
                            g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
                            g.DrawLine(pen, points[11], points[10]);
                            g.DrawBezier(pen, points[10], points[9], points[9], points[8]);
                            g.DrawLine(pen, points[8], points[6]);

                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }

                            break;

                        case Corners.Top:
                            path.AddLine(points[0], points[2]);
                            path.AddBezier(points[2], points[3], points[3], points[4]);
                            path.AddLine(points[4], points[5]);
                            path.AddBezier(points[5], points[6], points[6], points[7]);
                            path.AddLine(points[7], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);

                            g.DrawLine(pen, points[0], points[2]);
                            g.DrawBezier(pen, points[2], points[3], points[3], points[4]);
                            g.DrawLine(pen, points[4], points[5]);
                            g.DrawBezier(pen, points[5], points[6], points[6], points[7]);
                            g.DrawLine(pen, points[7], points[9]);

                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }

                            break;

                        case Corners.RightBottom:
                            path.AddLine(points[3], points[0]);
                            path.AddLine(points[0], points[10]);
                            path.AddBezier(points[10], points[9], points[9], points[8]);
                            path.AddLine(points[8], points[6]);
                            path.AddLine(points[6], points[3]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[3], points[0]);
                            g.DrawLine(pen, points[0], points[10]);
                            g.DrawBezier(pen, points[10], points[9], points[9], points[8]);
                            g.DrawLine(pen, points[8], points[6]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[6], points[3]);
                            }
                            break;
                        case Corners.RightTop:
                            path.AddLine(points[0], points[3]);
                            path.AddLine(points[3], points[5]);
                            path.AddBezier(points[5], points[6], points[6], points[7]);
                            path.AddLine(points[7], points[9]);
                            path.AddLine(points[9], points[0]);
                            Region = new Region(path);
                            g.FillRegion(brush, Region);
                            g.DrawLine(pen, points[0], points[3]);
                            g.DrawLine(pen, points[3], points[5]);
                            g.DrawBezier(pen, points[5], points[6], points[6], points[7]);
                            g.DrawLine(pen, points[7], points[9]);
                            if (closed)
                            {
                                g.DrawLine(pen, points[9], points[0]);
                            }
                            break;
                    }
                }
Exemple #29
0
        void Select(float X, float Y, bool CtrlPressed)
        {
            Graphics g = Graphics.FromHwnd(tcTabs.TabPages[tcTabs.SelectedIndex].Handle);

            if ((Corner = CurrentPage.Selected.Corners.Contains(X, Y)) != Corners.None)
                return;

            Object Shape = CurrentPage.FindShape(X, Y);
            if (CurrentPage.Selected.Count > 0)
                CurrentPage.Selected.Corners.Hide(Dlg, Dlv, g, tcTabs.TabPages[tcTabs.SelectedIndex].BackColor);
            if (Shape == null)
            {
                if ((Corner = CurrentPage.Selected.Corners.Contains(X, Y)) == Corners.None)
                {

                    CurrentPage.Selected.Clear();
                    tcTabs.TabPages[tcTabs.SelectedIndex].Cursor = Now == Nows.None ? Cursors.Default : Cursors.Cross;
                    CurrentPage.DoPos = false;
                    tscbAlls.SelectedIndex = -1;
                }
                return;
            }
            //если фигура есть среди выделенных
            if (CurrentPage.Selected.ObjectIsPresent(Shape))
            {
                if (CtrlPressed) //если нажат Ctrl, то надо эту фигуру удалить из выделенных
                    CurrentPage.Selected.RemoveObj(Shape);
                //else //если Ctrl не нажат
            }
            else if (CtrlPressed) //если фигуры нет среди выделенных и если нажат Ctrl то надо добавить эту фигуру
            {
                CurrentPage.Selected.Add(Shape);
                tscbAlls.SelectedIndex = -1;
            }
            else //если Ctrl не нажат, то надо выделить эту фигуру и еще проверить может просто меняется позиция фигур.
            {
                CurrentPage.Selected.Clear();
                CurrentPage.Selected.Add(Shape);
                if (CurrentPage.DoPos)//когда меняем позицию относительно других фигур
                    DoPositionAt(tcTabs.TabPages[tcTabs.SelectedIndex].Cursor);
                else
                    tscbAlls.SelectedIndex = CurrentPage.Selected.ZOrder;
            }
            CurrentPage.Selected.ReSelect();
            tcTabs.TabPages[tcTabs.SelectedIndex].Cursor = Cursors.SizeAll;
            Corner = Corners.None;
            if (CurrentPage.Selected.Count == 1)
                tscbAlls.SelectedIndex = CurrentPage.Selected.ZOrder;
        }
Exemple #30
0
        private System.Drawing.Drawing2D.GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            //Make sure the Path fits inside the rectangle
            r.Width  -= 1;
            r.Height -= 1;

            //Scale the radius if it's too large to fit.
            if (radius > (r.Width))
            {
                radius = r.Width;
            }
            if (radius > (r.Height))
            {
                radius = r.Height;
            }

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();

            if (radius <= 0)
            {
                path.AddRectangle(r);
            }
            else
            if ((corners & Corners.TopLeft) == Corners.TopLeft)
            {
                path.AddArc(r.Left, r.Top, radius, radius, 180, 90);
            }
            else
            {
                path.AddLine(r.Left, r.Top, r.Left, r.Top);
            }

            if ((corners & Corners.TopRight) == Corners.TopRight)
            {
                path.AddArc(r.Right - radius, r.Top, radius, radius, 270, 90);
            }
            else
            {
                path.AddLine(r.Right, r.Top, r.Right, r.Top);
            }

            if ((corners & Corners.BottomRight) == Corners.BottomRight)
            {
                path.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, 0, 90);
            }
            else
            {
                path.AddLine(r.Right, r.Bottom, r.Right, r.Bottom);
            }

            if ((corners & Corners.BottomLeft) == Corners.BottomLeft)
            {
                path.AddArc(r.Left, r.Bottom - radius, radius, radius, 90, 90);
            }
            else
            {
                path.AddLine(r.Left, r.Bottom, r.Left, r.Bottom);
            }

            path.CloseFigure();

            return(path);
        }
Exemple #31
0
        public static void RoundedRectangle(Context cr,
                                            Gdk.Rectangle area,
                                            int radius,
                                            Corners corners)
        {
            // Top Line
            cr.MoveTo(area.X + radius + m_Offset, area.Y + m_Offset);
            cr.LineTo(area.X + area.Width - radius - m_Offset,
                      area.Y + m_Offset);

            // Top Right Corner
            if ((corners & Corners.TopRight) > 0)
            {
                cr.CurveTo(area.X + area.Width - radius - m_Offset,
                           area.Y + m_Offset,
                           area.X + area.Width,
                           area.Y,
                           area.X + area.Width - m_Offset,
                           area.Y + radius + m_Offset);
            }
            else
            {
                cr.LineTo(area.X + area.Width - m_Offset,
                          area.Y + m_Offset);
                cr.LineTo(area.X + area.Width - m_Offset,
                          area.Y + m_Offset + radius);
            }

            // Right Line
            cr.LineTo(area.X + area.Width - m_Offset,
                      area.Y + area.Height - radius - m_Offset);

            // Bottom Right Corner
            if ((corners & Corners.BottomRight) > 0)
            {
                cr.CurveTo(area.X + area.Width - m_Offset,
                           area.Y + area.Height - m_Offset - radius,
                           area.X + area.Width,
                           area.Y + area.Height,
                           area.X + area.Width - m_Offset - radius,
                           area.Y + area.Height - m_Offset);
            }
            else
            {
                cr.LineTo(area.X + area.Width - m_Offset,
                          area.Y + area.Height - m_Offset);
                cr.LineTo(area.X + area.Width - m_Offset - radius,
                          area.Y + area.Height - m_Offset);
            }

            // Bottom Line
            cr.LineTo(area.X + m_Offset + radius,
                      area.Y + area.Height - m_Offset);

            // Bottom Left Corner
            if ((corners & Corners.BottomLeft) > 0)
            {
                cr.CurveTo(area.X + m_Offset + radius,
                           area.Y + area.Height - m_Offset,
                           area.X,
                           area.Y + area.Height,
                           area.X + m_Offset,
                           area.Y + area.Height - m_Offset - radius);
            }
            else
            {
                cr.LineTo(area.X + m_Offset,
                          area.Y + area.Height - m_Offset);
                cr.LineTo(area.X + m_Offset,
                          area.Y + area.Height - m_Offset - radius);
            }

            // Left Line
            cr.LineTo(area.X + m_Offset,
                      area.Y + m_Offset + radius);

            // Top Left Corner
            if ((corners & Corners.TopLeft) > 0)
            {
                cr.CurveTo(area.X + m_Offset,
                           area.Y + m_Offset + radius,
                           area.X,
                           area.Y,
                           area.X + m_Offset + radius,
                           area.Y + m_Offset);
            }
            else
            {
                cr.LineTo(area.X + m_Offset, area.Y + m_Offset);
                cr.LineTo(area.X + m_Offset + radius, area.Y + m_Offset);
            }
        }
 private static void addCornerStatus(CornerData cornerData, Enum e, Corners corners)
 {
     if (cornerData.cornersForEachStatus.ContainsValue(corners))
     {
         var item = cornerData.cornersForEachStatus.First(kvp => kvp.Value == corners);
         cornerData.cornersForEachStatus.Remove(item.Key);
     }
     cornerData.cornersForEachStatus.Add(e, corners);
 }
        /// <summary>
        /// Draws a regular buttton in selected state
        /// </summary>
        public void DrawButtonSelected(Graphics g, Rectangle bounds, Corners corners)
        {
            var outerR = Rectangle.FromLTRB(
                bounds.Left,
                bounds.Top,
                bounds.Right - 1,
                bounds.Bottom - 1);

            var innerR = Rectangle.FromLTRB(
                bounds.Left + 1,
                bounds.Top + 1,
                bounds.Right - 2,
                bounds.Bottom - 2);

            var glossyR = Rectangle.FromLTRB(
                bounds.Left + 1,
                bounds.Top + 1,
                bounds.Right - 2,
                bounds.Top + Convert.ToInt32((double)bounds.Height * .36));

            using (var boundsPath = RoundRectangle(outerR, 3, corners))
            {
                using (var brus = new SolidBrush(ColorTable.ButtonSelectedBgOut))
                {
                    g.FillPath(brus, boundsPath);
                }

                #region Main Bg
                using (var path = new GraphicsPath())
                {
                    path.AddEllipse(new Rectangle(bounds.Left, bounds.Top, bounds.Width, bounds.Height * 2));
                    path.CloseFigure();
                    using (var gradient = new PathGradientBrush(path))
                    {
                        gradient.WrapMode = WrapMode.Clamp;
                        gradient.CenterPoint = new PointF(
                            Convert.ToSingle(bounds.Left + bounds.Width / 2),
                            Convert.ToSingle(bounds.Bottom));
                        gradient.CenterColor = ColorTable.ButtonSelectedBgCenter;
                        gradient.SurroundColors = new [] { ColorTable.ButtonSelectedBgOut };

                        var lastClip = g.Clip;
                        var newClip = new Region(boundsPath);
                        newClip.Intersect(lastClip);
                        g.SetClip(newClip.GetBounds(g));
                        g.FillPath(gradient, path);
                        g.Clip = lastClip;
                    }
                }
                #endregion

                //Border
                using (var p = new Pen(ColorTable.ButtonSelectedBorderOut))
                {
                    g.DrawPath(p, boundsPath);
                }

                //Inner border
                using (var path = RoundRectangle(innerR, 3, corners))
                {
                    using (var p = new Pen(ColorTable.ButtonSelectedBorderIn))
                    {
                        g.DrawPath(p, path);
                    }
                }

                //Glossy effect
                using (var path = RoundRectangle(glossyR, 3, (corners & Corners.NorthWest) | (corners & Corners.NorthEast)))
                {
                    using (var b = new LinearGradientBrush(
                        glossyR, ColorTable.ButtonSelectedGlossyNorth, ColorTable.ButtonSelectedGlossySouth, 90))
                    {
                        b.WrapMode = WrapMode.TileFlipXY;
                        g.FillPath(b, path);
                    }
                }
            }
        }
Exemple #34
0
 /// <summary>
 /// Creates rounded corners for the specified rectangle
 /// </summary>
 /// <param name="rectangle">the rectangle</param>
 /// <param name="radius">rardus of corners</param>
 /// <param name="corners">which corners?</param>
 /// <returns>graphics path</returns>
 public static GraphicsPath Create(Rectangle rectangle, int radius, Corners corners)
 {
     return Create(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, radius, corners);
 }
 /// <summary> 
 /// Sets a value that indicates which corner of the dependency object requires scrolling. 
 /// </summary>
 public static void SetRectBeyondEdge(DependencyObject obj, Corners value)
 {
     obj.SetValue(RectBeyondEdgeProperty, value);
 }
Exemple #36
0
        /// <summary>
        /// Creates a graphics path around the border with the
        /// specified origin, width and height.  Corners specifies
        /// rounded corners
        /// </summary>
        /// <param name="x">x origin</param>
        /// <param name="y">y origin</param>
        /// <param name="width">width</param>
        /// <param name="height">height</param>
        /// <param name="radius">radius of corners</param>
        /// <param name="corners">which corners to round</param>
        /// <returns></returns>
        public static GraphicsPath Create(int x, int y, int width, int height, int radius, Corners corners)
        {
            int xw = x + width;
            int yh = y + height;
            int xwr = xw - radius;
            int yhr = yh - radius;
            int xr = x + radius;
            int yr = y + radius;
            int r2 = radius * 2;
            int xwr2 = xw - r2;
            int yhr2 = yh - r2;

            GraphicsPath _graphicsPath = new GraphicsPath();

            _graphicsPath.StartFigure();

            //Upper left
            if ((Corners.UpperLeft & corners) == Corners.UpperLeft)
            {
                _graphicsPath.AddArc(x, y, r2, r2, 180, 90);
            }
            else
            {
                _graphicsPath.AddLine(x, yr, x, y);
                _graphicsPath.AddLine(x, y, xr, y);
            }

            //Upper Border
            _graphicsPath.AddLine(xr, y, xwr, y);

            //Upper Right Corner
            if ((Corners.UpperRight & corners) == Corners.UpperRight)
            {
                _graphicsPath.AddArc(xwr2, y, r2, r2, 270, 90);
            }
            else
            {
                _graphicsPath.AddLine(xwr, y, xw, y);
                _graphicsPath.AddLine(xw, y, xw, yr);
            }

            //Right border
            _graphicsPath.AddLine(xw, yr, xw, yhr);

            //Lower Right Corner
            if ((Corners.LowerRight & corners) == Corners.LowerRight)
            {
                _graphicsPath.AddArc(xwr2, yhr2, r2, r2, 0, 90);
            }
            else
            {
                _graphicsPath.AddLine(xw, yhr, xw, yh);
                _graphicsPath.AddLine(xw, yh, xwr, yh);
            }

            //Lower Border
            _graphicsPath.AddLine(xwr, yh, xr, yh);

            //Lower Left Corner
            if ((Corners.LowerLeft & corners) == Corners.LowerLeft)
            {
                _graphicsPath.AddArc(x, yhr2, r2, r2, 90, 90);
            }
            else
            {
                _graphicsPath.AddLine(xr, yh, x, yh);
                _graphicsPath.AddLine(x, yh, x, yhr);
            }

            //Left border
            _graphicsPath.AddLine(x, yhr, x, yr);

            _graphicsPath.CloseFigure();
            return _graphicsPath;
        }
Exemple #37
0
 public void InsetCornerOfTile(int x, int y, int z, float inset, Corners corner)
 {
     MapTile t = TileAt(x,y,z);
     if(t != null) {
         t.InsetCorner(inset, corner);
         RemakeMesh();
     }
 }
Exemple #38
0
 /// <summary>
 /// Get corner shadow gradient brush for a rectangle
 /// </summary>
 /// <param name="corner">Corner as Corners</param>
 /// <returns>Brush</returns>
 private static Brush GetCornerShadowGradientBrush(Corners corner)
 {
     RadialGradientBrush gradBrush = new RadialGradientBrush();
     gradBrush.GradientStops = new GradientStopCollection();
     gradBrush.GradientStops.Add(Graphics.GetGradientStop(Color.FromArgb(191, 0, 0, 0), 0));
     gradBrush.GradientStops.Add(Graphics.GetGradientStop(Color.FromArgb(0, 0, 0, 0), 1));
     TransformGroup tg = new TransformGroup();
     ScaleTransform st = new ScaleTransform() { ScaleX = 2, ScaleY = 2, CenterX = 0.5, CenterY = 0.5 };
     TranslateTransform tt = null;
     switch (corner)
     {
         case Corners.TopLeft:
             tt = new TranslateTransform() { X = 0.5, Y = 0.5 };
             break;
         case Corners.TopRight:
             tt = new TranslateTransform() { X = -0.5, Y = 0.5 };
             break;
         case Corners.BottomLeft:
             tt = new TranslateTransform() { X = 0.5, Y = -0.5 };
             break;
         case Corners.BottomRight:
             tt = new TranslateTransform() { X = -0.5, Y = -0.5 };
             break;
     }
     tg.Children.Add(st);
     tg.Children.Add(tt);
     gradBrush.RelativeTransform = tg;
     return gradBrush;
 }
        /// <summary>
        /// Draws a regular button in the Checked and Selected state
        /// </summary>
        /// <param name="e"></param>
        /// <param name="button"></param>
		public void DrawButtonCheckedSelected(Graphics g, Rectangle bounds, Corners corners, Ribbon ribbon)
		{
			if(ribbon.OrbStyle==RibbonOrbStyle.Office_2013) corners=Corners.None;

			Rectangle outerR=Rectangle.FromLTRB(bounds.Left, bounds.Top, bounds.Right-1, bounds.Bottom-1);

			using(GraphicsPath boundsPath=RoundRectangle(outerR, 3, corners))
			{
				Rectangle innerR=Rectangle.FromLTRB(bounds.Left+1, bounds.Top+1, bounds.Right-2, bounds.Bottom-2);
				Rectangle glossyR=Rectangle.FromLTRB(bounds.Left+1, bounds.Top+1, bounds.Right-2, bounds.Top+Convert.ToInt32((double)bounds.Height*.36));

				using(SolidBrush brus=new SolidBrush(ColorTable.ButtonCheckedSelectedBgOut))
				{
					g.FillPath(brus, boundsPath);
				}

				#region Main Bg
				using(GraphicsPath path=new GraphicsPath())
				{
					path.AddEllipse(new Rectangle(bounds.Left, bounds.Top, bounds.Width, bounds.Height*2));
					path.CloseFigure();
					using(PathGradientBrush gradient=new PathGradientBrush(path))
					{
						gradient.WrapMode=WrapMode.Clamp;
						gradient.CenterPoint=new PointF(
								Convert.ToSingle(bounds.Left+bounds.Width/2),
								Convert.ToSingle(bounds.Bottom));
						gradient.CenterColor=ColorTable.ButtonCheckedSelectedBgCenter;
						gradient.SurroundColors=new Color[] { ColorTable.ButtonCheckedSelectedBgOut };

						Blend blend=new Blend(3);
						blend.Factors=new float[] { 0f, 0.8f, 0f };
						blend.Positions=new float[] { 0f, 0.30f, 1f };


						Region lastClip=g.Clip;
						Region newClip=new Region(boundsPath);
						newClip.Intersect(lastClip);
						g.SetClip(newClip.GetBounds(g));
						g.FillPath(gradient, path);
						g.Clip=lastClip;
					}
				}
				#endregion

				//Glossy effect
				using(GraphicsPath path=RoundRectangle(glossyR, 3, (corners&Corners.NorthWest)|(corners&Corners.NorthEast)))
				{
					using(LinearGradientBrush b=new LinearGradientBrush(glossyR, ColorTable.ButtonCheckedSelectedGlossyNorth, ColorTable.ButtonCheckedSelectedGlossySouth, 90))
					{
						b.WrapMode=WrapMode.TileFlipXY;
						g.FillPath(b, path);
					}
				}

				//Border
				using(Pen p=new Pen(ColorTable.ButtonCheckedSelectedBorderOut))
				{
					g.DrawPath(p, boundsPath);
				}

				//Inner border
				using(GraphicsPath path=RoundRectangle(innerR, 3, corners))
				{
					using(Pen p=new Pen(ColorTable.ButtonCheckedSelectedBorderIn))
					{
						g.DrawPath(p, path);
					}
				}
			}
		}
 public static void RoundedRectangle (Context cr,
                                      Gdk.Rectangle area,
                                      int radius,
                                      Corners corners)
 {
     // Top Line
     cr.MoveTo (area.X + radius + m_Offset, area.Y + m_Offset);
     cr.LineTo (area.X + area.Width - radius - m_Offset,
                area.Y + m_Offset);
     
     // Top Right Corner
     if ((corners & Corners.TopRight) > 0) {
         cr.CurveTo (area.X + area.Width - radius - m_Offset,
                     area.Y + m_Offset,
                     area.X + area.Width,
                     area.Y,
                     area.X + area.Width - m_Offset,
                     area.Y + radius + m_Offset);
     }
     else {
         cr.LineTo (area.X + area.Width - m_Offset,
                    area.Y + m_Offset);
         cr.LineTo (area.X + area.Width - m_Offset,
                    area.Y + m_Offset + radius);
     }
     
     // Right Line
     cr.LineTo (area.X + area.Width - m_Offset,
                area.Y + area.Height - radius - m_Offset);
     
     // Bottom Right Corner
     if ((corners & Corners.BottomRight) > 0) {
         cr.CurveTo (area.X + area.Width - m_Offset,
                     area.Y + area.Height - m_Offset - radius,
                     area.X + area.Width,
                     area.Y + area.Height,
                     area.X + area.Width - m_Offset - radius,
                     area.Y + area.Height - m_Offset);
     }
     else {
         cr.LineTo (area.X + area.Width - m_Offset,
                    area.Y + area.Height - m_Offset);
         cr.LineTo (area.X + area.Width - m_Offset - radius,
                    area.Y + area.Height - m_Offset);
     }
     
     // Bottom Line
     cr.LineTo (area.X + m_Offset + radius,
                area.Y + area.Height - m_Offset);
     
     // Bottom Left Corner
     if ((corners & Corners.BottomLeft) > 0) {
         cr.CurveTo (area.X + m_Offset + radius,
                     area.Y + area.Height - m_Offset,
                     area.X,
                     area.Y + area.Height,
                     area.X + m_Offset,
                     area.Y + area.Height - m_Offset - radius);
     }
     else {
         cr.LineTo (area.X + m_Offset,
                    area.Y + area.Height - m_Offset);
         cr.LineTo (area.X + m_Offset,
                    area.Y + area.Height - m_Offset - radius);
     }
     
     // Left Line
     cr.LineTo (area.X + m_Offset,
                area.Y + m_Offset + radius);
     
     // Top Left Corner
     if ((corners & Corners.TopLeft) > 0) {
         cr.CurveTo (area.X + m_Offset,
                     area.Y + m_Offset + radius,
                     area.X,
                     area.Y,
                     area.X + m_Offset + radius,
                     area.Y + m_Offset);
     }
     else {
         cr.LineTo (area.X + m_Offset, area.Y + m_Offset);
         cr.LineTo (area.X + m_Offset + radius, area.Y + m_Offset);
     }
 }
Exemple #41
0
        public new void Transform(float Dx, float Dy, float Dlg, float Dlv, Color BackColor, Corners Corner, Graphics G)
        {
            RePain(Dlg, Dlv, BackColor, BorderWidth, 1, G);
            Transformation(Dx, Dy, Dlg, Dlv, Corner);

            RePain(Dlg, Dlv, false, 1, G);
        }
 public Primitives.Path Create( Types.Rectangle rect, double radius, Corners corners )
 {
     return Create( rect.X, rect.Y, rect.Width, rect.Height, radius, corners );
 }
Exemple #43
0
        /// <summary>
        /// Draw a rounds the rectangle.
        /// </summary>
        /// <param name="r">The bound.</param>
        /// <param name="radius">The radius.</param>
        /// <param name="corners">The corners.</param>
        /// <remarks>Source: http://dotnetrix.co.uk/button.htm </remarks>
        /// <returns></returns>
        public static GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            //Make sure the Path fits inside the rectangle
            r.Width -= 1;
            r.Height -= 1;

            //Scale the radius if it's too large to fit.
            if (radius > (r.Width))
                radius = r.Width;
            if (radius > (r.Height))
                radius = r.Height;

            var path = new GraphicsPath();
            path.StartFigure();
            if (radius <= 0)
                path.AddRectangle(r);
            else
            {
                if ((corners & Corners.TopLeft) == Corners.TopLeft)
                    path.AddArc(r.Left, r.Top, radius, radius, 180F, 90F);
                else
                    path.AddLine(r.Left, r.Top, r.Left, r.Top);

                if ((corners & Corners.TopRight) == Corners.TopRight)
                    path.AddArc(r.Right - radius, r.Top, radius, radius, 270F, 90F);
                else
                    path.AddLine(r.Right, r.Top, r.Right, r.Top);

                if ((corners & Corners.BottomRight) == Corners.BottomRight)
                    path.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, 0, 90F);
                else
                    path.AddLine(r.Right, r.Bottom, r.Right, r.Bottom);

                if ((corners & Corners.BottomLeft) == Corners.BottomLeft)
                    path.AddArc(r.Left, r.Bottom - radius, radius, radius, 90F, 90F);
                else
                    path.AddLine(r.Left, r.Bottom, r.Left, r.Bottom);
            }

            path.CloseFigure();

            return path;
        }
 /// <summary>
 /// Adds a corner to the corner point list
 /// </summary>
 /// <param name="p">the new corner</param>
 public void addCorner(AGraphMLCorner p)
 {
     Corners.Add(p);
 }
Exemple #45
0
        public virtual void CalculatePaths(RectangleF container)
        {
            DisposePaths();
            m_path = new GraphicsPath();

            RectangleF rect        = container;
            bool       bHorizontal = (m_orientation == SegmentOrientation.Horizontal);

            if (bHorizontal)
            {
                rect.Inflate(-Padding, 0);
            }
            else
            {
                rect.Inflate(0, -Padding);
            }

            PointF topLeft     = new PointF(rect.Left, rect.Top);
            PointF topRight    = new PointF(rect.Right, rect.Top);
            PointF bottomLeft  = new PointF(rect.Left, rect.Bottom);
            PointF bottomRight = new PointF(rect.Right, rect.Bottom);

            float xOffset = bHorizontal ? TipLength : 0;
            float yOffset = bHorizontal ? 0 : TipLength;

            PointF topLeftOffset     = new PointF(topLeft.X + xOffset, topLeft.Y + yOffset);
            PointF topRightOffset    = new PointF(topRight.X - xOffset, topRight.Y + yOffset);
            PointF bottomLeftOffset  = new PointF(bottomLeft.X + xOffset, bottomLeft.Y - yOffset);
            PointF bottomRightOffset = new PointF(bottomRight.X - xOffset, bottomRight.Y - yOffset);

            PointF topCenter    = new PointF(rect.Left + (rect.Width / 2f), rect.Y + (yOffset / 2f));
            PointF leftCenter   = new PointF(rect.Left + (xOffset / 2f), rect.Y + (rect.Height / 2f));
            PointF bottomCenter = new PointF(topCenter.X, rect.Bottom - (yOffset / 2f));
            PointF rightCenter  = new PointF(rect.Right - (xOffset / 2f), leftCenter.Y);

            List <PointF> points = new List <PointF>();

            points.Add(leftCenter);
            if (Corners.IsFlagSet(SegmentCorners.TopLeft))
            {
                points.Add(topLeft);
            }
            else
            {
                points.Add(topLeftOffset);
                points.Add(topCenter);
            }

            if (Corners.IsFlagSet(SegmentCorners.TopRight))
            {
                points.Add(topRight);
            }
            else
            {
                points.Add(topRightOffset);
            }

            if (Corners.IsFlagSet(SegmentCorners.BottomRight))
            {
                points.Add(bottomRight);
            }
            else
            {
                points.Add(rightCenter);
                points.Add(bottomRightOffset);
            }

            if (Corners.IsFlagSet(SegmentCorners.BottomLeft))
            {
                points.Add(bottomLeft);
            }
            else
            {
                points.Add(bottomCenter);
                points.Add(bottomLeftOffset);
            }

            if (Corners.IsFlagSet(SegmentCorners.TopLeft))
            {
                points.Add(topLeft);
            }

            m_path.AddLines(points.ToArray());
            m_path.CloseFigure();

            //these areas need to be redrawn now
            m_redrawRegion.Union(m_path);
        }
Exemple #46
0
 /// <summary>
 /// Creates rounded corners for the specified rectangle
 /// </summary>
 /// <param name="rectangle">the rectangle</param>
 /// <param name="radius">rardus of corners</param>
 /// <param name="corners">which corners?</param>
 /// <returns>graphics path</returns>
 public static GraphicsPath Create(Rectangle rectangle, int radius, Corners corners)
 {
     return(Create(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, radius, corners));
 }
Exemple #47
0
 public void Transform(float Dx, float Dy, float Dlg, float Dlv, Color BackColor, Corners Corner, Graphics G)
 {
     RePain(Dlg, Dlv, BackColor, BorderWidth, 1, G);
     switch (Corner)
     {
         case Corners.TopLeft:
             _Xn += Dx;
             _Yn += Dy;
             break;
         case Corners.BottomRight:
             _Xk += Dx;
             _Yk += Dy;
             break;
         case Corners.TopRight:
             _Xk += Dx;
             _Yn += Dy;
             break;
         case Corners.BottomLeft:
             _Xn += Dx;
             _Yk += Dy;
             break;
         case Corners.Top:
             if (_Yn < _Yk)
                 _Yn += Dy;
             else
                 _Yk += Dy;
             break;
         case Corners.Bottom:
             _Yk += Dy;
             break;
     }
     DoXY();
     RePain(Dlg, Dlv, BorderCol, 1, 1, G);
 }
Exemple #48
0
        /// <summary>
        /// Creates a graphics path around the border with the
        /// specified origin, width and height.  Corners specifies
        /// rounded corners
        /// </summary>
        /// <param name="x">x origin</param>
        /// <param name="y">y origin</param>
        /// <param name="width">width</param>
        /// <param name="height">height</param>
        /// <param name="radius">radius of corners</param>
        /// <param name="corners">which corners to round</param>
        /// <returns></returns>
        public static GraphicsPath Create(int x, int y, int width, int height, int radius, Corners corners)
        {
            int xw   = x + width;
            int yh   = y + height;
            int xwr  = xw - radius;
            int yhr  = yh - radius;
            int xr   = x + radius;
            int yr   = y + radius;
            int r2   = radius * 2;
            int xwr2 = xw - r2;
            int yhr2 = yh - r2;

            GraphicsPath _graphicsPath = new GraphicsPath();

            _graphicsPath.StartFigure();

            //Upper left
            if ((Corners.UpperLeft & corners) == Corners.UpperLeft)
            {
                _graphicsPath.AddArc(x, y, r2, r2, 180, 90);
            }
            else
            {
                _graphicsPath.AddLine(x, yr, x, y);
                _graphicsPath.AddLine(x, y, xr, y);
            }

            //Upper Border
            _graphicsPath.AddLine(xr, y, xwr, y);

            //Upper Right Corner
            if ((Corners.UpperRight & corners) == Corners.UpperRight)
            {
                _graphicsPath.AddArc(xwr2, y, r2, r2, 270, 90);
            }
            else
            {
                _graphicsPath.AddLine(xwr, y, xw, y);
                _graphicsPath.AddLine(xw, y, xw, yr);
            }

            //Right border
            _graphicsPath.AddLine(xw, yr, xw, yhr);

            //Lower Right Corner
            if ((Corners.LowerRight & corners) == Corners.LowerRight)
            {
                _graphicsPath.AddArc(xwr2, yhr2, r2, r2, 0, 90);
            }
            else
            {
                _graphicsPath.AddLine(xw, yhr, xw, yh);
                _graphicsPath.AddLine(xw, yh, xwr, yh);
            }

            //Lower Border
            _graphicsPath.AddLine(xwr, yh, xr, yh);

            //Lower Left Corner
            if ((Corners.LowerLeft & corners) == Corners.LowerLeft)
            {
                _graphicsPath.AddArc(x, yhr2, r2, r2, 90, 90);
            }
            else
            {
                _graphicsPath.AddLine(xr, yh, x, yh);
                _graphicsPath.AddLine(x, yh, x, yhr);
            }

            //Left border
            _graphicsPath.AddLine(x, yhr, x, yr);

            _graphicsPath.CloseFigure();
            return(_graphicsPath);
        }
        private System.Drawing.Drawing2D.GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            //Make sure the Path fits inside the rectangle
            r.Width -= 1;
            r.Height -= 1;

            //Scale the radius if it's too large to fit.
            if (radius > (r.Width))
                radius = r.Width;
            if (radius > (r.Height))
                radius = r.Height;

            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();

            if (radius <= 0)
                path.AddRectangle(r);
            else
                if ((corners & Corners.TopLeft) == Corners.TopLeft)
                    path.AddArc(r.Left, r.Top, radius, radius, 180, 90);
                else
                    path.AddLine(r.Left, r.Top, r.Left, r.Top);

            if ((corners & Corners.TopRight) == Corners.TopRight)
                path.AddArc(r.Right - radius, r.Top, radius, radius, 270, 90);
            else
                path.AddLine(r.Right, r.Top, r.Right, r.Top);

            if ((corners & Corners.BottomRight) == Corners.BottomRight)
                path.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, 0, 90);
            else
                path.AddLine(r.Right, r.Bottom, r.Right, r.Bottom);

            if ((corners & Corners.BottomLeft) == Corners.BottomLeft)
                path.AddArc(r.Left, r.Bottom - radius, radius, radius, 90, 90);
            else
                path.AddLine(r.Left, r.Bottom, r.Left, r.Bottom);

            path.CloseFigure();

            return path;
        }
Exemple #50
0
 public void Transformation(float Dx, float Dy, float Dlg, float Dlv, Corners Corner)
 {
     switch (Corner)
     {
         case Corners.TopLeft:
             _Rec.X += Dx;
             _Rec.Width -= Dx;
             _Rec.Y += Dy;
             _Rec.Height -= Dy;
             break;
         case Corners.BottomRight:
             _Rec.Width += Dx;
             _Rec.Height += Dy;
             break;
         case Corners.TopRight:
             _Rec.Width += Dx;
             _Rec.Y += Dy;
             _Rec.Height -= Dy;
             break;
         case Corners.BottomLeft:
             _Rec.X += Dx;
             _Rec.Width -= Dx;
             _Rec.Height += Dy;
             break;
         case Corners.Top:
             _Rec.Y += Dy;
             _Rec.Height -= Dy;
             break;
         case Corners.Bottom:
             _Rec.Height += Dy;
             break;
         case Corners.Left:
             _Rec.X += Dx;
             _Rec.Width -= Dx;
             break;
         case Corners.Right:
             _Rec.Width += Dx;
             break;
     }
     DoXY();
 }
Exemple #51
0
        /// <summary>
        /// Draw a rounds the rectangle.
        /// </summary>
        /// <param name="r">The bound.</param>
        /// <param name="radius">The radius.</param>
        /// <param name="corners">The corners.</param>
        /// <remarks>Source: http://dotnetrix.co.uk/button.htm </remarks>
        /// <returns></returns>
        public static GraphicsPath RoundRectangle(Rectangle r, int radius, Corners corners)
        {
            //Make sure the Path fits inside the rectangle
            r.Width  -= 1;
            r.Height -= 1;

            //Scale the radius if it's too large to fit.
            if (radius > (r.Width))
            {
                radius = r.Width;
            }
            if (radius > (r.Height))
            {
                radius = r.Height;
            }

            var path = new GraphicsPath();

            path.StartFigure();
            if (radius <= 0)
            {
                path.AddRectangle(r);
            }
            else
            {
                if ((corners & Corners.TopLeft) == Corners.TopLeft)
                {
                    path.AddArc(r.Left, r.Top, radius, radius, 180F, 90F);
                }
                else
                {
                    path.AddLine(r.Left, r.Top, r.Left, r.Top);
                }

                if ((corners & Corners.TopRight) == Corners.TopRight)
                {
                    path.AddArc(r.Right - radius, r.Top, radius, radius, 270F, 90F);
                }
                else
                {
                    path.AddLine(r.Right, r.Top, r.Right, r.Top);
                }

                if ((corners & Corners.BottomRight) == Corners.BottomRight)
                {
                    path.AddArc(r.Right - radius, r.Bottom - radius, radius, radius, 0, 90F);
                }
                else
                {
                    path.AddLine(r.Right, r.Bottom, r.Right, r.Bottom);
                }

                if ((corners & Corners.BottomLeft) == Corners.BottomLeft)
                {
                    path.AddArc(r.Left, r.Bottom - radius, radius, radius, 90F, 90F);
                }
                else
                {
                    path.AddLine(r.Left, r.Bottom, r.Left, r.Bottom);
                }
            }

            path.CloseFigure();

            return(path);
        }
Exemple #52
0
 public void InsetCorner(float inset, Corners corner)
 {
     if(cornerInsets == null || cornerInsets.Length == 0) {
         cornerInsets = new float[]{0,0,0,0};
     }
     if(corner == Corners.Left ) {
         cornerInsets[(int)Corners.Left ] = inset;
     }
     if(corner == Corners.Front) {
         cornerInsets[(int)Corners.Front] = inset;
     }
     if(corner == Corners.Right) {
         cornerInsets[(int)Corners.Right] = inset;
     }
     if(corner == Corners.Back ) {
         cornerInsets[(int)Corners.Back ] = inset;
     }
 }