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