コード例 #1
0
 public bool Equals(FourCorners <TValue> other)
 {
     if (this == other)
     {
         return(true);
     }
     if (other == null)
     {
         return(false);
     }
     return(BottomLeft.Equals(other.BottomLeft) && BottomRight.Equals(other.BottomRight) &&
            TopLeft.Equals(other.TopLeft) && TopRight.Equals(other.TopRight));
 }
コード例 #2
0
        /// <summary>
        /// Create a cropped bounding box.
        /// </summary>
        /// <returns>The crop info.</returns>
        /// <param name="crop">Crop.</param>
        /// <param name="adjustedScale">Adjusted scale.</param>
        public AGSCropInfo Crop(BoundingBoxType boundingBoxType, ICropSelfComponent crop, PointF adjustedScale)
        {
            if (crop == null)
            {
                return(new AGSCropInfo(this, null));
            }
            float scaleX                   = adjustedScale.X;
            float scaleY                   = adjustedScale.Y;
            float spriteWidth              = Width / scaleX;
            float spriteHeight             = Height / scaleY;
            var   args                     = new BeforeCropEventArgs(this, boundingBoxType);
            FourCorners <Vector2> cropArea = crop.GetCropArea(args, spriteWidth, spriteHeight, out float width, out float height);

            if (!crop.CropEnabled)
            {
                return(new AGSCropInfo(this, null));
            }
            if (width <= 0f || height <= 0f)
            {
                return(default);