Exemple #1
0
            public BGRA32(BGRP32 value)
            {
                uint rcpA = value.A == 0 ? 0u : (65536u * 255u) / (uint)value.A;

                R = (Byte)((value.PreR * rcpA + 255u) >> 16);
                G = (Byte)((value.PreG * rcpA + 255u) >> 16);
                B = (Byte)((value.PreB * rcpA + 255u) >> 16);
                A = value.A;
            }
            public BGR24 AlphaBlendWith(BGRP32 src, int opacity)
            {
                var x = 16384 - opacity; // x before alpha

                opacity = opacity * src.A / 255;

                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
 public RGBA128F(BGRP32 color)
 {
     this      = default;
     this.RGBA = new XYZA(color.PreR, color.PreG, color.PreB, color.A) / 255f;
     ApplyUnpremul(ref this.RGBA);
 }
Exemple #4
0
 public Luminance32F(BGRP32 color)
 {
     L = _FromRGB(color.R, color.G, color.B) * Reciprocal255;
 }