public void CreateNewOutline(Rect rectOutline)
        {
            Rect rect = this.m_Selected.rect;

            if (rect.Contains(rectOutline.min) && rect.Contains(rectOutline.max))
            {
                this.RecordUndo();
                SpriteOutline spriteOutline = new SpriteOutline();
                Vector2       b             = new Vector2(0.5f * rect.width + rect.x, 0.5f * rect.height + rect.y);
                Rect          rect2         = new Rect(rectOutline);
                rect2.min = this.SnapPoint(rectOutline.min);
                rect2.max = this.SnapPoint(rectOutline.max);
                spriteOutline.Add(SpriteOutlineModule.CapPointToRect(new Vector2(rect2.xMin, rect2.yMin), rect) - b);
                spriteOutline.Add(SpriteOutlineModule.CapPointToRect(new Vector2(rect2.xMin, rect2.yMax), rect) - b);
                spriteOutline.Add(SpriteOutlineModule.CapPointToRect(new Vector2(rect2.xMax, rect2.yMax), rect) - b);
                spriteOutline.Add(SpriteOutlineModule.CapPointToRect(new Vector2(rect2.xMax, rect2.yMin), rect) - b);
                this.selectedShapeOutline.Add(spriteOutline);
                this.spriteEditorWindow.SetDataModified();
                this.shapeEditorDirty = true;
            }
        }
        protected static List <SpriteOutline> GenerateSpriteRectOutline(Rect rect, ITexture2D texture, float detail, byte alphaTolerance)
        {
            List <SpriteOutline> list = new List <SpriteOutline>();

            if (texture != null)
            {
                int num  = 0;
                int num2 = 0;
                UnityEditor.TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as UnityEditor.TextureImporter;
                textureImporter.GetWidthAndHeight(ref num, ref num2);
                int     width  = texture.width;
                int     height = texture.height;
                Vector2 vector = new Vector2((float)width / (float)num, (float)height / (float)num2);
                Rect    rect2  = rect;
                rect2.xMin *= vector.x;
                rect2.xMax *= vector.x;
                rect2.yMin *= vector.y;
                rect2.yMax *= vector.y;
                Vector2[][] array;
                UnityEditor.Sprites.SpriteUtility.GenerateOutline(texture, rect2, detail, alphaTolerance, true, out array);
                Rect r = default(Rect);
                r.size   = rect.size;
                r.center = Vector2.zero;
                for (int i = 0; i < array.Length; i++)
                {
                    SpriteOutline spriteOutline = new SpriteOutline();
                    Vector2[]     array2        = array[i];
                    for (int j = 0; j < array2.Length; j++)
                    {
                        Vector2 vector2 = array2[j];
                        spriteOutline.Add(SpriteOutlineModule.CapPointToRect(new Vector2(vector2.x / vector.x, vector2.y / vector.y), r));
                    }
                    list.Add(spriteOutline);
                }
            }
            return(list);
        }
 public void InsertPointAt(int outlineIndex, int pointIndex, Vector3 position)
 {
     this.selectedShapeOutline[outlineIndex].Insert(pointIndex, this.ConvertTextureSpaceToSpriteRectSpace(SpriteOutlineModule.CapPointToRect(position, this.m_Selected.rect)));
     this.spriteEditorWindow.SetDataModified();
 }