示例#1
0
 public override void DrawRectangle(Rectangle area, Brush brush, Thickness thickness, double radius,
     Rectangle bounds)
 {
     SetClipArea(bounds);
     if (area != Rectangle.Empty)
     {
         if (radius > 0)
         {
             FillRectangle(area, brush, radius, bounds);
         }
         else
         {
             var areaXNA = area.ToXNA();
             FillRect(new RectangleXNA(areaXNA.X,
                 areaXNA.Top, areaXNA.Width, thickness.Top), brush);
             FillRect(new RectangleXNA(areaXNA.X,
                 areaXNA.Top + thickness.Top, thickness.Left, areaXNA.Height - thickness.Top - thickness.Bottom),
                 brush);
             FillRect(new RectangleXNA(areaXNA.Right - thickness.Right,
                 areaXNA.Top + thickness.Top, thickness.Right, areaXNA.Height - thickness.Top - thickness.Bottom),
                 brush);
             FillRect(new RectangleXNA(areaXNA.X,
                 areaXNA.Bottom - thickness.Bottom, areaXNA.Width, thickness.Bottom), brush);
         }
     }
     ResetClipArea();
 }
示例#2
0
 /// <summary>
 /// Draws a rounded rectangle within the specified area.
 /// </summary>
 public abstract void DrawRectangle(Rectangle area, Brush brush, Thickness border, double cornerRadius, Rectangle bounds);
示例#3
0
文件: Size.cs 项目: Pyratron/PyraUI
 /// <summary>
 /// Add the specified thickness to the size.
 /// </summary>
 public Size Add(Thickness thickness)
     =>
         new Size(Math.Max(0, Width + thickness.Left + thickness.Right),
             Math.Max(0, Height + thickness.Top + thickness.Bottom));
示例#4
0
 /// <summary>
 /// Draws a rectangle within the specified area.
 /// </summary>
 public void DrawRectangle(Rectangle area, Brush brush, Thickness border, Rectangle bounds) => DrawRectangle(area, brush, border, 0, bounds);
示例#5
0
文件: Size.cs 项目: Pyratron/PyraUI
 /// <summary>
 /// Extend the rectangle to include the specified thickness.
 /// </summary>
 public Rectangle Extend(Thickness thickness)
     =>
         new Rectangle(0, 0, thickness.Right + thickness.Left + Width,
             thickness.Bottom + thickness.Top + Height);
示例#6
0
文件: Size.cs 项目: Pyratron/PyraUI
 /// <summary>
 /// Remove the specified thickness from the size.
 /// </summary>
 public Size Remove(Thickness thickness)
     =>
         new Size(Math.Max(0, Width - thickness.Left - thickness.Right),
             Math.Max(0, Height - thickness.Top - thickness.Bottom));
示例#7
0
 /// <summary>
 /// Remove the specified thickness from the rectangle to make it smaller.
 /// </summary>
 public Rectangle Remove(Thickness thickness)
     =>
         new Rectangle(X -thickness.Left, Y - thickness.Right, Width -thickness.Width,
             Height - thickness.Height);
示例#8
0
 /// <summary>
 /// Add the specified thickness from the outsides of the rectangle in order to move the rectangle further outward. (SUBTRACTING from the X and Y values)
 /// </summary>
 public Rectangle AddBorder(Thickness borderThickness)
     =>
         new Rectangle(X - borderThickness.Left, Y - borderThickness.Right, Width + borderThickness.Width,
             Height + borderThickness.Height);
示例#9
0
 /// <summary>
 /// Remove the specified thickness from the outsides of the rectangle in order to move the rectangle further inward. (ADDING to the X and Y values)
 /// </summary>
 public Rectangle RemoveBorder(Thickness borderThickness)
     =>
         new Rectangle(X + borderThickness.Left, Y + borderThickness.Right, Width - borderThickness.Width,
             Height - borderThickness.Height);
示例#10
0
 public bool Equals(Thickness other)
     => Left == other.Left && Top == other.Top && Right == other.Right && Bottom == other.Bottom;
示例#11
0
 /// <summary>
 /// Add the left and top of the rectangle to the left and top of the thickness.
 /// </summary>
 public Thickness Offset(Thickness rectangle) => new Thickness(rectangle.Left + Left, rectangle.Top + Top, Right, Bottom);