SetPixelsClamped() public static method

public static SetPixelsClamped ( Texture2D texture, IntVector2 position, IntVector2 size, Color colors ) : void
texture UnityEngine.Texture2D
position Assets.RagePixel2.Editor.Utility.IntVector2
size Assets.RagePixel2.Editor.Utility.IntVector2
colors Color
return void
Beispiel #1
0
        public void OnMouseDown(RagePixelState state)
        {
            if (Event.current.button != 0)
            {
                return;
            }

            IntVector2 pixel    = state.ScreenToPixel(Event.current.mousePosition, false);
            IntVector2 minPixel = pixel - state.brush.m_BrushPivot;

            Utility.SetPixelsClamped(state.sprite.texture, minPixel, state.brush.m_Size, state.brush.m_Colors);
            state.sprite.texture.Apply();

            m_LastMousePixel = pixel;
            state.Repaint();
            Event.current.Use();
        }