lighterTextApcaY function
Implementation
double lighterTextApcaY(
double backgroundApcaY,
double apca, {
bool debug = false,
}) {
backgroundApcaY = inBoundsApcaY(backgroundApcaY);
apca = apca / 100.0;
if (apca > 0) {
apca = -apca;
}
// Go backwards through apcaContrastOfApcaY with background < text
final sapc = apca == 0.0 ? 0.0 : apca - loWoBOffset;
// k1 = revBg
// k2 = revText
// k3 = scaleWoB
// x = sapc
// y = backgroundApcaY
// z = textApcaY
// Find Z:
// sapc = (backgroundApcaY ^ revBg - textApcaY ^ revText) * scaleWoB
// x = (y^k1 - z^k2) * k3
// x / k3 = y^k1 - z^k2
// x / k3 + z^k2 = y^k1
// z^k2 = (y^k1 - x / k3)
// z = ((y^k1) - (x / k3)) ^ (1/k2)
final firstTerm = math.pow(backgroundApcaY, revBg);
final secondTerm = sapc / scaleWoB;
final base = firstTerm - secondTerm;
if (base < 0) {
Complex complexTerm2 = Complex(0, (secondTerm - firstTerm)).pow(1 / revBg);
monetDebug(debug, () => 'lighterTextApcaY complex: $complexTerm2');
return complexTerm2.real;
}
final textApcaY = math
.pow(math.pow(backgroundApcaY, revBg) - (sapc / scaleWoB), 1.0 / revText)
.toDouble();
monetDebug(debug, () => 'lighterTextApcaY textApcaY: $textApcaY');
return textApcaY;
}