public void Erase(IBrushDrawable drawable, int brushX, int brushY) { for (int by = 0; by < Size; by++) { for (int bx = 0; bx < Size; bx++) { int fx = brushX + bx; int fy = brushY + by; if (drawable.IsDrawable(fx, fy)) { int index = fx + (fy * drawable.Width); int brushIndex = (int)(bx + by * Size); drawable.Colors[index].a = Mathf.Clamp01(drawable.Colors[index].a - Alphas[brushIndex]); } } } }
public void Draw(IBrushDrawable drawable, int brushX, int brushY, UnityEngine.Color color) { for (int by = 0; by < Size; by++) { for (int bx = 0; bx < Size; bx++) { int fx = brushX + bx; int fy = brushY + by; if (drawable.IsDrawable(fx, fy)) { int index = fx + (fy * drawable.Width); int brushIndex = (int)(bx + by * Size); UnityEngine.Color A = color; A.a *= Alphas[brushIndex]; drawable.Colors[index] = drawable.Colors[index].AlphaComposite(A); } } } }