Exemple #1
0
    void Unity.Jobs.IJobParallelFor.Execute(int i)
    {
        var color = data[i];

        data[i] = new RGBA32 {
            R = Invert(color.R), G = Invert(color.G), B = Invert(color.B), A = color.A
        };
    }
            public BGR24 AlphaBlendWith(RGBA32 src, int opacity)
            {
                opacity = opacity * src.A / 255;
                var x = 16384 - opacity;

                var r = (this.R * x + src.R * opacity) / 16384;
                var g = (this.G * x + src.G * opacity) / 16384;
                var b = (this.B * x + src.B * opacity) / 16384;

                return(new BGR24(r, g, b));
            }
Exemple #3
0
    void Unity.Jobs.IJobParallelFor.Execute(int i)
    {
        var px = copy[i];
        var pr = copy[math.min(i + 1, Last)];
        var pb = copy[math.min(i + Width, Last)];

        byte f = (byte)math.max(math.abs((px.R + px.G + px.B) - (pr.R + pr.G + pr.B)), math.abs((px.R + px.G + px.B) - (pb.R + pb.G + pb.B)));

        results[i] = new RGBA32 {
            R = f, G = f, B = f, A = px.A
        };
    }
Exemple #4
0
                public readonly void CopyTo(ref RGBA32 pixel, int y)
                {
                    #if NETSTANDARD2_0
                    pixel.R = GetRed(y);
                    pixel.G = GetGreen(y);
                    pixel.B = GetBlue(y);
                    #else
                    pixel.R = (Byte)Math.Clamp(y + _V, 0, 255);
                    pixel.G = (Byte)Math.Clamp(y + _UV, 0, 255);
                    pixel.B = (Byte)Math.Clamp(y + _U, 0, 255);
                    #endif

                    pixel.A = 255;
                }
    void Unity.Jobs.IJobParallelFor.Execute(int i)
    {
        var   color   = data[i];
        float product = math.mul(new float3 {
            x = color.R, y = color.G, z = color.B
        }, new float3 {
            x = 0.3f, y = 0.59f, z = 0.11f
        });
        byte b = (byte)product;

        data[i] = new RGBA32 {
            R = b, G = b, B = b, A = color.A
        };
    }
    void Unity.Jobs.IJobParallelFor.Execute(int i)
    {
        const int kernelSize = 5;

        var px  = copy[i];                              //center
        var pxr = copy[math.min(i + 1, Last)];          //right neighbour
        var pxl = copy[math.clamp(i - 1, 0, Last)];     //left neighbour
        var pxt = copy[math.clamp(i - Width, 0, Last)]; //top neighbour
        var pxb = copy[math.min(i + Width, Last)];      //bottom neighbour

        byte R = (byte)((px.R + pxr.R + pxl.R + pxt.R + pxb.R) / kernelSize);
        byte G = (byte)((px.G + pxr.G + pxl.G + pxt.G + pxb.G) / kernelSize);
        byte B = (byte)((px.B + pxr.B + pxl.B + pxt.B + pxb.B) / kernelSize);
        byte A = (byte)((px.A + pxr.A + pxl.A + pxt.A + pxb.A) / kernelSize);

        results[i] = new RGBA32 {
            R = R, G = G, B = B, A = A
        };
    }
Exemple #7
0
 public Luminance32F(RGBA32 color)
 {
     L = _FromRGBA(color.R, color.G, color.B, color.A) * Reciprocal65025;
 }
Exemple #8
0
 public RGBA128F(RGBA32 color) : this()
 {
     RGBA = new XYZA(color.R, color.G, color.B, color.A) / 255f;
 }