Пример #1
0
            public BGR24 AlphaBlendWith(BGRA32 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));
            }
Пример #2
0
            public Luminance8(BGRA32 color)
            {
                uint accum = 0;

                accum += RLuminanceWeight16 * (uint)color.R;
                accum += GLuminanceWeight16 * (uint)color.G;
                accum += BLuminanceWeight16 * (uint)color.B;

                accum >>= 16;

                L = (Byte)accum;
            }
Пример #3
0
            public Luminance16(BGRA32 color)
            {
                uint accum = 0;

                accum += RLuminanceWeight16 * (uint)color.R;
                accum += GLuminanceWeight16 * (uint)color.G;
                accum += BLuminanceWeight16 * (uint)color.B;

                accum >>= 8;

                L = (UInt16)accum;
            }
Пример #4
0
                public readonly void CopyTo(ref BGRA32 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;
                }
Пример #5
0
            public static RGBP128F LerpToRGBP128F(BGRA32 tl, BGRA32 tr, BGRA32 bl, BGRA32 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;

                // calculate final alpha
                var aaaa = new System.Numerics.Vector4(tl.A, tr.A, bl.A, br.A);
                var a    = System.Numerics.Vector4.Dot(aaaa, wwww);

                if (a == 0)
                {
                    return(default);
Пример #6
0
 public BGRA5551(BGRA32 color) : this(_PackRGBA(color.R, color.G, color.B, color.A >= _ALPHA_THRESHOLD))
 {
 }
Пример #7
0
 public BGR565(BGRA32 color) : this(_PackRGB(color.R, color.G, color.B))
 {
 }
Пример #8
0
 public Alpha8(BGRA32 color)
 {
     A = color.A;
 }
Пример #9
0
 public Luminance32F(BGRA32 color)
 {
     L = _FromRGBA(color.R, color.G, color.B, color.A) * Reciprocal65025;
 }