From 75d3aef889effb28cfe229f4cd22689ef85b3c7d Mon Sep 17 00:00:00 2001 From: toxicity Date: Fri, 16 Aug 2024 13:10:20 +0900 Subject: [PATCH] Bug fixes. --- dist/src/main/kotlin/kr/toxicity/hud/image/SplitType.kt | 2 +- dist/src/main/kotlin/kr/toxicity/hud/util/Images.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dist/src/main/kotlin/kr/toxicity/hud/image/SplitType.kt b/dist/src/main/kotlin/kr/toxicity/hud/image/SplitType.kt index 349d66fc..d3d05a56 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/image/SplitType.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/image/SplitType.kt @@ -90,7 +90,7 @@ enum class SplitType { override fun split(target: NamedLoadedImage, split: Int): List { val saveName = target.name.substringBefore('.') return (1..split).map { - val targetImage = target.image.circleCut(2 * PI * (split - it + 1).toDouble() / split.toDouble()) ?: throw RuntimeException() + val targetImage = target.image.circleCut(2 * PI * it.toDouble() / split.toDouble(), true) ?: throw RuntimeException() NamedLoadedImage( "${saveName}_$it.png", targetImage diff --git a/dist/src/main/kotlin/kr/toxicity/hud/util/Images.kt b/dist/src/main/kotlin/kr/toxicity/hud/util/Images.kt index e17315a7..be530846 100644 --- a/dist/src/main/kotlin/kr/toxicity/hud/util/Images.kt +++ b/dist/src/main/kotlin/kr/toxicity/hud/util/Images.kt @@ -138,12 +138,13 @@ fun BufferedImage.withOpacity(opacity: Double): BufferedImage { } } -fun LoadedImage.circleCut(degree: Double) = BufferedImage(image.width, image.height, BufferedImage.TYPE_INT_ARGB).also { +fun LoadedImage.circleCut(degree: Double, reversed: Boolean = false) = BufferedImage(image.width, image.height, BufferedImage.TYPE_INT_ARGB).also { val hw = image.width.toDouble() / 2 val hh = image.height.toDouble() / 2 for (w in 0.. 2 * PI) d -= 2 * PI if (d <= degree) it.setRGB(w, h, image.getRGB(w, h))