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

        data[i] = new RGB24 {
            R = Invert(color.R), G = Invert(color.G), B = Invert(color.B)
        };
    }
예제 #2
0
            /// <inheritdoc/>
            public void ApplyCompositionTo(ref RGB24 dst, int opacity)
            {
                var x  = 16384 - opacity;
                var _R = (dst.R * x + this.R * opacity) / 16384;
                var _G = (dst.G * x + this.G * opacity) / 16384;
                var _B = (dst.B * x + this.B * opacity) / 16384;

                dst = new RGB24(_R, _G, _B);
            }
예제 #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 RGB24 {
            R = f, G = f, B = f
        };
    }
예제 #4
0
 public readonly void CopyTo(ref RGB24 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
 }
예제 #5
0
            /// <inheritdoc/>
            public void ApplyCompositionTo(ref RGB24 dst, int opacity)
            {
                if (this.A == 0)
                {
                    return;
                }
                opacity = opacity * this.A / 255;
                var x  = 16384 - opacity;
                var _R = (dst.R * x + this.R * opacity) / 16384;
                var _G = (dst.G * x + this.G * opacity) / 16384;
                var _B = (dst.B * x + this.B * opacity) / 16384;

                dst = new RGB24(_R, _G, _B);
            }
예제 #6
0
    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 RGB24 {
            R = b, G = b, B = b
        };
    }
예제 #7
0
        private static void StretchPixels <TPixel>(PixelArea <TPixel> area, int fromX, int fromY)
            where TPixel : struct, IPixel <TPixel>
        {
            if (IsInvalidStretchStartingPosition(area, fromX, fromY))
            {
                return;
            }

            for (int y = 0; y < fromY; y++)
            {
                ref RGB24 ptrBase = ref GetRowStart(area, y);

                for (int x = fromX; x < area.Width; x++)
                {
                    // Copy the left neighbour pixel to the current one
                    Unsafe.Add(ref ptrBase, x) = Unsafe.Add(ref ptrBase, x - 1);
                }
            }
예제 #8
0
    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);

        results[i] = new RGB24 {
            R = R, G = G, B = B
        };
    }
예제 #9
0
                public readonly void ApplyTo(ref RGB24 target)
                {
                    int r = target.R;
                    int g = target.G;
                    int b = target.B;

                    r *= MulR;
                    g *= MulG;
                    b *= MulB;

                    r >>= 16;
                    g >>= 16;
                    b >>= 16;

                    r += AddR;
                    g += AddG;
                    b += AddB;

                    target.R = (Byte)r;
                    target.G = (Byte)g;
                    target.B = (Byte)b;
                }
예제 #10
0
 public Luminance32F(RGB24 color)
 {
     L = _FromRGB(color.R, color.G, color.B) * Reciprocal255;
 }
예제 #11
0
 public YUV24(RGB24 rgb)
 {
     this = default;
     _FromRGB(rgb.R, rgb.G, rgb.B, ref this);
 }
예제 #12
0
 public RGBA128F(RGB24 color) : this()
 {
     RGBA = new XYZA(color.R, color.G, color.B, 255) / 255f;
 }