Exemple #1
0
 public readonly void CopyTo(ref BGR24 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
 }
Exemple #2
0
            public static RGBP128F LerpToRGBP128F(BGR24 left, BGR24 right, float rx)
            {
                // calculate quantized weights
                var wl = (1f - rx) / 255f;
                var wr = rx / 255f;

                var r = new System.Numerics.Vector4(left.R, left.G, left.B, 255f) * wl;

                r += new System.Numerics.Vector4(right.R, right.G, right.B, 255f) * wr;

                return(new RGBP128F(r));
            }
            public void ApplyCompositionTo(ref BGR24 dst)
            {
                if (this.A == 0)
                {
                    return;
                }
                var opacity = 16384 * 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 BGR24(_R, _G, _B);
            }
Exemple #4
0
            public static RGBP128F LerpToRGBP128F(BGR24 tl, BGR24 tr, BGR24 bl, BGR24 br, float rx, float by)
            {
                // calculate quantized weights
                var lx   = 1f - rx;
                var ty   = 1f - by;
                var wwww = new System.Numerics.Vector4(lx * ty, rx * ty, lx * by, rx * by) / 255f;

                var r = new System.Numerics.Vector4(tl.R, tl.G, tl.B, 255f) * wwww.X;

                r += new System.Numerics.Vector4(tr.R, tr.G, tr.B, 255f) * wwww.Y;
                r += new System.Numerics.Vector4(bl.R, bl.G, bl.B, 255f) * wwww.Z;
                r += new System.Numerics.Vector4(br.R, br.G, br.B, 255f) * wwww.W;

                return(new RGBP128F(r));
            }
Exemple #5
0
 public Luminance32F(BGR24 color)
 {
     L = _FromRGB(color.R, color.G, color.B) * Reciprocal255;
 }