internal static Color32 BlendOrMakeTransparent(this IQuantizingSession session, Color32 origColor) { // the color can be considered fully transparent if (origColor.A < session.AlphaThreshold) { // and even the quantizer returns a transparent color var c = session.GetQuantizedColor(origColor); if (c.A == 0) { return(c); } } // the color will not be transparent in the end: blending return(origColor.BlendWithBackground(session.BackColor)); }