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(); }
public void OnMouseUp(RagePixelState state) { if (Event.current.button == 0) { Utility.SaveImageData(state.sprite, false); Event.current.Use(); } }
public void OnMouseUp(RagePixelState state) { if (Event.current.button != 0) { return; } m_LastMousePixel = null; Utility.SaveImageData(state.sprite, false); Event.current.Use(); }
public void Apply(Sprite sprite) { Utility.SaveImageData(sprite, false); _mSnapshot = null; }