lighterBackgroundApcaY function
Implementation
double lighterBackgroundApcaY(
double textApcaY,
double apca, {
bool debug = false,
}) {
textApcaY = inBoundsApcaY(textApcaY);
apca = apca / 100.0;
// Go backwards through apcaContrastOfApcaY with background > text
final sapc = apca == 0.0 ? 0.0 : apca + loBoWOffset;
// k1 = normBg
// k2 = normText
// k3 = scaleBoW
// x = sapc
// y = backgroundApcaY
// z = textApcaY
// Find Y:
// sapc = (backgroundApcaY ^ normBg - textApcaY ^ normText) * scaleBoW
// x = (y^k1 - z^k2) * k3
// x / k3 = y ^ k1 - z ^k2
// x / k3 + z ^ k2 = y ^ k1
// y ^ k1 = x / k3 + z ^ k2
// y = (z ^ k2 + x / k3) ^ (1/k1)
final firstTerm = math.pow(textApcaY, normText);
final secondTerm = sapc / scaleBoW;
final base = firstTerm + secondTerm;
if (base < 0) {
final complex = Complex(0, (secondTerm - firstTerm)).pow(1 / normBg);
monetDebug(debug, () => 'lighter background APCA Y is complex: $complex');
return complex.real;
}
final bgApcaY = math.pow(base, 1.0 / normBg).toDouble();
monetDebug(debug, () => 'lighterBackgroundApcaY bgApcaY: $bgApcaY');
return bgApcaY;
}