示例#1
0
    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));
    }
示例#2
0
    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);
    }
示例#3
0
    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;
                }
            }
        }
    }
示例#4
0
    public void AddPixel(int x, int y)
    {
        var color = D2D_SplitBuilder.AlphaTex.GetPixel(x, y);

        AddPixel(x, y, D2D_AlphaTex.ConvertAlpha(color.a));
    }