From 6b3059ad468b744e78ab8cfb20b9c4e3e310594b Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 28 Sep 2024 21:19:19 +0200 Subject: [PATCH] fix pixelated images --- changelog.md | 12 ++++-------- .../services/modrinth/FullModrinthProject.kt | 5 ++++- .../dediamondpro/resourcify/util/ElementaUtils.kt | 8 ++++++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/changelog.md b/changelog.md index cf4a350..02296a1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,15 +1,11 @@ -## Resourcify 1.4.2 +## Resourcify 1.4.3 Please make sure to report any bugs and/or visual anomalies on [Resourcify's GitHub](https://github.com/DeDiamondPro/Resourcify/issues) or in the [Discord](https://discord.gg/XtAuqsJWby). ### Changes -This update is mostly to update dependencies and fix some small issues - -- (1.21.x NeoForge) Fixed a crash when opening Resourcify's config -- (Fabric) Shade UniversalCraft instead of including it as a jar to resolve Essential asking for a dependency update (this would usually go away after a relaunch, but for some users it didn't, this update will resolve that) -- Dependency updates: - - Updated UniversalCraft to 363 - - (1.8.9 and 1.12.2 forge) Updated bundled kotlin to 2.0.20 +- Fix buttons getting re-created too many times, causing the fancy menu widget locator to change +- Fix modrinth gallery images using low-res images +- Use linear scaling for images instead of nearest neighbour scaling, fixes modrinth banners and logos looking pixelated due to modrinth switching to lower-resolution images for them. ---------------------------------------------------------------------------------------------------- diff --git a/src/main/kotlin/dev/dediamondpro/resourcify/services/modrinth/FullModrinthProject.kt b/src/main/kotlin/dev/dediamondpro/resourcify/services/modrinth/FullModrinthProject.kt index 8ea78a7..3f016b6 100644 --- a/src/main/kotlin/dev/dediamondpro/resourcify/services/modrinth/FullModrinthProject.kt +++ b/src/main/kotlin/dev/dediamondpro/resourcify/services/modrinth/FullModrinthProject.kt @@ -122,6 +122,9 @@ data class FullModrinthProject( data class DonationUrl(val platform: String, val url: String) data class GalleryImage( - override val url: String, override val title: String?, override val description: String?, val ordering: Long + @SerializedName("raw_url") override val url: String, + override val title: String?, + override val description: String?, + val ordering: Long ) : IGalleryImage } \ No newline at end of file diff --git a/src/main/kotlin/dev/dediamondpro/resourcify/util/ElementaUtils.kt b/src/main/kotlin/dev/dediamondpro/resourcify/util/ElementaUtils.kt index d89aa54..b105a1b 100644 --- a/src/main/kotlin/dev/dediamondpro/resourcify/util/ElementaUtils.kt +++ b/src/main/kotlin/dev/dediamondpro/resourcify/util/ElementaUtils.kt @@ -1,6 +1,6 @@ /* * This file is part of Resourcify - * Copyright (C) 2023 DeDiamondPro + * Copyright (C) 2023-2024 DeDiamondPro * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,9 @@ fun UIImage.Companion.ofURL( height: Float? = null, fit: ImageURLUtils.Fit = ImageURLUtils.Fit.INSIDE, scaleFactor: Float = UResolution.scaleFactor.toFloat(), - useCache: Boolean = true + useCache: Boolean = true, + minFilter: UIImage.TextureScalingMode = UIImage.TextureScalingMode.LINEAR, + magFilter: UIImage.TextureScalingMode = UIImage.TextureScalingMode.LINEAR, ): UIImage { val url = source.toURL() val image = UIImage( @@ -56,6 +58,8 @@ fun UIImage.Companion.ofURL( if (!loadingImage) image.imageHeight = 0.5625f if (width != null) image.imageWidth = width * scaleFactor if (height != null) image.imageHeight = height * scaleFactor + image.textureMinFilter = minFilter + image.textureMagFilter = magFilter return image }