Example #1
0
        /// <summary>
        /// Retourne un RoundedRectangle qui correspond à l'intersection des RoundedRectangle a et b et dont les
        /// coins <i>rc</i> sont arrondis d'un rayon de <i>radius</i>
        /// </summary>
        /// <param name="a">RoundedRectangle</param>
        /// <param name="b">RoundedRectangle</param>
        /// <param name="rc">Coins à arrondir</param>
        /// <param name="radius">Rayon de courbure des arrondis</param>
        /// <returns>RoundedRectangle de l'union</returns>
        public static RoundedRectangle Union(RoundedRectangle a, RoundedRectangle b, RoundedCorner rc, float radius)
        {
            int left = Math.Min(a.Left, b.Left);
            int right = Math.Max(a.Right, b.Right);
            int top = Math.Min(a.Top, b.Top);
            int bottom = Math.Max(a.Bottom, b.Bottom);

            return new RoundedRectangle(
                left, right - left, top, bottom - top, rc, radius);
        }
Example #2
0
 /// <summary>
 /// Retourne <i>true</i> si ce RoundedRectangle possède une intersection avec rrect, <i>false</i> sinon
 /// </summary>
 /// <param name="rrect">RoundedRectangle</param>
 /// <returns><i>true</i> si intersection, <i>false</i> sinon</returns>
 public bool IntersectWith(RoundedRectangle rrect)
 {
     return ((rrect.Left < this.Right && this.Left < rrect.Right) &&
             (rrect.Top < this.Bottom && this.Top < rrect.Bottom));
     //if (((rect.X < (this.X + this.Width)) && (this.X < (rect.X + rect.Width))) && (rect.Y < (this.Y + this.Height)))
     //{
     //    return (this.Y < (rect.Y + rect.Height));
     //}
     //return false;
 }
Example #3
0
        /// <summary>
        /// Retourne un RoundRectangle correspondant à l'intersection des RoundRectangles a et b
        /// </summary>
        /// <param name="a">RoundedRectangle</param>
        /// <param name="b">RoundedRectangle</param>
        /// <param name="rc">Coins à arrondir</param>
        /// <param name="radius">Rayon de coubure des arrondis</param>
        /// <returns></returns>
        /// <remarks>Si aucune intersection n'est trouvée entre les RoundRectangles, un RoundedRectangle est retourné</remarks>
        public static RoundedRectangle Intersect(RoundedRectangle a, RoundedRectangle b, RoundedCorner rc, float radius)
        {
            int left = Math.Max(a.Left, b.Left);
            int right = Math.Min(a.Right, b.Right);
            int top = Math.Max(a.Top, b.Top);
            int bottom = Math.Min(a.Bottom, b.Bottom);

            if (left <= right && top <= bottom)
            {
                return new RoundedRectangle(
                    left, right - left, top, bottom - top, rc, radius);
            }
            return Empty;
        }
Example #4
0
 /// <summary>
 /// Replace ce RoundedRectangle par l'intersection de celui-ci de rrect
 /// </summary>
 /// <param name="rrect">RoundedRectangle</param>
 public void Intersect(RoundedRectangle rrect)
 {
     RoundedRectangle r = Intersect(rrect, this, this.roundedCorners, this.radius);
     this.x = r.x;
     this.y = r.y;
     this.width = r.width;
     this.height = r.height;
 }
Example #5
0
 /// <summary>
 /// Crée et retourne une copie RoundedRectangle agrandi de la taille spécifié.
 /// </summary>
 /// <param name="rrect">RoundedRectangle</param>
 /// <param name="width">Largeur</param>
 /// <param name="height">Hauteur</param>
 /// <returns>Une copie du RoundedRectangle agrandie</returns>
 public static RoundedRectangle Inflate(RoundedRectangle rrect, int width, int height)
 {
     RoundedRectangle r = rrect;
     r.Inflate(width, height);
     return r;
 }