private static float GetAlphaOrDefault(int x, int y) { if (x >= pixelsL && y >= pixelsB && x < pixelsR && y < pixelsT) { return(D2D_AlphaTex.ConvertAlpha(pixels[x + y * pixelsW])); } return(default(float)); }
private void FastPaintBoth(int i, int x, int y, float opacity) { var color = alphaTex.GetPixel(x, y); var alpha = FastPaint(i, x, y, opacity); color.a = D2D_AlphaTex.ConvertAlpha(alpha); alphaTex.SetPixel(x, y, color); }
private void DeserializeAlphaTex() { if (dirty == true || alphaTex == null) { dirty = false; if (alphaData != null) { alphaTex = new Texture2D(alphaWidth, alphaHeight, TextureFormat.Alpha8, false); alphaTex.hideFlags = HideFlags.DontSave; alphaTex.wrapMode = TextureWrapMode.Clamp; for (var y = 0; y < alphaHeight; y++) { for (var x = 0; x < alphaWidth; x++) { var color = default(Color); var alpha = alphaData[x + y * alphaWidth]; color.a = D2D_AlphaTex.ConvertAlpha(alpha); alphaTex.SetPixel(x, y, color); } } alphaTex.Apply(); } else { DestroyAlphaTex(); } } if (alphaTex != null) { if (Binary == true) { if (alphaTex.filterMode != FilterMode.Point) { alphaTex.filterMode = FilterMode.Point; } } else { if (alphaTex.filterMode != FilterMode.Bilinear) { alphaTex.filterMode = FilterMode.Bilinear; } } } }
public void AddPixel(int x, int y) { var color = D2D_SplitBuilder.AlphaTex.GetPixel(x, y); AddPixel(x, y, D2D_AlphaTex.ConvertAlpha(color.a)); }