From 29d132c16796783ca6e199bd7372f2fb45079f4b Mon Sep 17 00:00:00 2001 From: Chopper <156493704+choppeh@users.noreply.github.com> Date: Thu, 21 Nov 2024 01:15:53 -0300 Subject: [PATCH] Cleanup --- .../tachiyomi/extension/en/snowmtl/Snowmtl.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/en/snowmtl/src/eu/kanade/tachiyomi/extension/en/snowmtl/Snowmtl.kt b/src/en/snowmtl/src/eu/kanade/tachiyomi/extension/en/snowmtl/Snowmtl.kt index c9a087859..77b594fc0 100644 --- a/src/en/snowmtl/src/eu/kanade/tachiyomi/extension/en/snowmtl/Snowmtl.kt +++ b/src/en/snowmtl/src/eu/kanade/tachiyomi/extension/en/snowmtl/Snowmtl.kt @@ -301,6 +301,13 @@ class Snowmtl : ParsedHttpSource() { else -> it.y1.toFloat() } + // Invert color in black dialog box + paint.apply { + val pixelColor = bitmap.getPixel(it.centerX.toInt(), it.centerY.toInt()) + val inverseColor = (Color.WHITE - pixelColor) or Color.BLACK + color = inverseColor + } + lines.forEachIndexed { index, line -> // Centers the text on the X axis and positions it inside the dialog box val x = (it.centerX - (line.length * paint.getCharWidth() / 2)).absoluteValue + marginLeft @@ -308,12 +315,6 @@ class Snowmtl : ParsedHttpSource() { // Positions the text inside the dialog box on the Y axis val y = (initialY + paint.getCharHeight() * index * spaceBetween).absoluteValue + marginTop - // Invert color in black dialog box - val pixelColor = bitmap.getPixel(it.centerX.toInt(), it.centerY.toInt()) - val inverseColor = (Color.WHITE - pixelColor) or Color.BLACK - - paint.color = inverseColor - canvas.drawText(line, 0, line.length, x, y, paint) } }