SaveImageData() public static method

public static SaveImageData ( Sprite sprite, bool reimport ) : void
sprite UnityEngine.Sprite
reimport bool
return void
Exemplo n.º 1
0
        public void OnMouseUp(RagePixelState state)
        {
            Sprite sprite = state.Sprite;

            Color[] pixels         = Utility.GetPixels(sprite);
            int     originalWidth  = (int)sprite.textureRect.width;
            int     originalHeight = (int)sprite.textureRect.height;

            Texture2D texture = sprite.texture;

            int width  = _size.x;
            int height = _size.y;

            texture.Resize(width, height, texture.format, texture.mipmapCount > 0);
            texture.SetPixels32(Utility.GetDefaultPixels(texture.width, texture.height));

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    if (x < originalWidth && y < originalHeight)
                    {
                        texture.SetPixel(x, y, pixels [y * originalWidth + x]);
                    }
                }
            }

            texture.Apply();
            Utility.SaveImageData(sprite, true);
            ShiftTransformAfterResize(state.Transform, sprite, originalWidth, originalHeight, width, height);
            SceneView.RepaintAll();
        }
Exemplo n.º 2
0
 public void OnMouseUp(RagePixelState state)
 {
     if (Event.current.button == 0)
     {
         Utility.SaveImageData(state.sprite, false);
         Event.current.Use();
     }
 }
Exemplo n.º 3
0
        public void OnMouseUp(RagePixelState state)
        {
            if (Event.current.button != 0)
            {
                return;
            }

            m_LastMousePixel = null;
            Utility.SaveImageData(state.sprite, false);
            Event.current.Use();
        }
Exemplo n.º 4
0
 public void Apply(Sprite sprite)
 {
     Utility.SaveImageData(sprite, false);
     _mSnapshot = null;
 }