mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-06 15:52:03 +00:00
优化画板绘制颜色精准度
This commit is contained in:
@@ -68,6 +68,10 @@ public class Config {
|
|||||||
protected boolean resource_pack$protection$crash_tools$method_3;
|
protected boolean resource_pack$protection$crash_tools$method_3;
|
||||||
protected boolean resource_pack$protection$crash_tools$method_4;
|
protected boolean resource_pack$protection$crash_tools$method_4;
|
||||||
protected boolean resource_pack$protection$crash_tools$method_5;
|
protected boolean resource_pack$protection$crash_tools$method_5;
|
||||||
|
protected boolean resource_pack$protection$crash_tools$method_6;
|
||||||
|
protected boolean resource_pack$protection$crash_tools$method_7;
|
||||||
|
protected boolean resource_pack$protection$crash_tools$method_8;
|
||||||
|
protected boolean resource_pack$protection$crash_tools$method_9;
|
||||||
|
|
||||||
protected boolean resource_pack$validation$enable;
|
protected boolean resource_pack$validation$enable;
|
||||||
protected boolean resource_pack$validation$fix_atlas;
|
protected boolean resource_pack$validation$fix_atlas;
|
||||||
@@ -323,6 +327,10 @@ public class Config {
|
|||||||
resource_pack$protection$crash_tools$method_3 = config.getBoolean("resource-pack.protection.crash-tools.method-3", false);
|
resource_pack$protection$crash_tools$method_3 = config.getBoolean("resource-pack.protection.crash-tools.method-3", false);
|
||||||
resource_pack$protection$crash_tools$method_4 = config.getBoolean("resource-pack.protection.crash-tools.method-4", false);
|
resource_pack$protection$crash_tools$method_4 = config.getBoolean("resource-pack.protection.crash-tools.method-4", false);
|
||||||
resource_pack$protection$crash_tools$method_5 = config.getBoolean("resource-pack.protection.crash-tools.method-5", false);
|
resource_pack$protection$crash_tools$method_5 = config.getBoolean("resource-pack.protection.crash-tools.method-5", false);
|
||||||
|
resource_pack$protection$crash_tools$method_6 = config.getBoolean("resource-pack.protection.crash-tools.method-6", false);
|
||||||
|
resource_pack$protection$crash_tools$method_7 = config.getBoolean("resource-pack.protection.crash-tools.method-7", false);
|
||||||
|
resource_pack$protection$crash_tools$method_8 = config.getBoolean("resource-pack.protection.crash-tools.method-8", false);
|
||||||
|
resource_pack$protection$crash_tools$method_9 = config.getBoolean("resource-pack.protection.crash-tools.method-9", false);
|
||||||
resource_pack$protection$obfuscation$enable = VersionHelper.PREMIUM && config.getBoolean("resource-pack.protection.obfuscation.enable", false);
|
resource_pack$protection$obfuscation$enable = VersionHelper.PREMIUM && config.getBoolean("resource-pack.protection.obfuscation.enable", false);
|
||||||
resource_pack$protection$obfuscation$seed = config.getLong("resource-pack.protection.obfuscation.seed", 0L);
|
resource_pack$protection$obfuscation$seed = config.getLong("resource-pack.protection.obfuscation.seed", 0L);
|
||||||
resource_pack$protection$fake_directory = config.getBoolean("resource-pack.protection.fake-directory", false);
|
resource_pack$protection$fake_directory = config.getBoolean("resource-pack.protection.fake-directory", false);
|
||||||
@@ -758,6 +766,22 @@ public class Config {
|
|||||||
return instance.resource_pack$protection$crash_tools$method_5;
|
return instance.resource_pack$protection$crash_tools$method_5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean crashTool6() {
|
||||||
|
return instance.resource_pack$protection$crash_tools$method_6;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean crashTool7() {
|
||||||
|
return instance.resource_pack$protection$crash_tools$method_7;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean crashTool8() {
|
||||||
|
return instance.resource_pack$protection$crash_tools$method_8;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean crashTool9() {
|
||||||
|
return instance.resource_pack$protection$crash_tools$method_9;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean enableObfuscation() {
|
public static boolean enableObfuscation() {
|
||||||
return instance.resource_pack$protection$obfuscation$enable;
|
return instance.resource_pack$protection$obfuscation$enable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ public class PngOptimizer {
|
|||||||
src.getColorModel().hasAlpha() ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB
|
src.getColorModel().hasAlpha() ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 32 bit 位深 -> 8 bit 位深
|
||||||
if (type == BufferedImage.TYPE_4BYTE_ABGR || type == BufferedImage.TYPE_4BYTE_ABGR_PRE) {
|
if (type == BufferedImage.TYPE_4BYTE_ABGR || type == BufferedImage.TYPE_4BYTE_ABGR_PRE) {
|
||||||
for (int y = 0; y < src.getHeight(); y++) {
|
for (int y = 0; y < src.getHeight(); y++) {
|
||||||
for (int x = 0; x < src.getWidth(); x++) {
|
for (int x = 0; x < src.getWidth(); x++) {
|
||||||
@@ -117,6 +118,10 @@ public class PngOptimizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Graphics2D g2d = eightBitImage.createGraphics();
|
Graphics2D g2d = eightBitImage.createGraphics();
|
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
|
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
|
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
|
||||||
g2d.drawImage(src, 0, 0, null);
|
g2d.drawImage(src, 0, 0, null);
|
||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
return eightBitImage;
|
return eightBitImage;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ zstd_version=1.5.7-4
|
|||||||
commons_io_version=2.20.0
|
commons_io_version=2.20.0
|
||||||
commons_lang3_version=3.19.0
|
commons_lang3_version=3.19.0
|
||||||
sparrow_nbt_version=0.10.6
|
sparrow_nbt_version=0.10.6
|
||||||
sparrow_util_version=0.55.2
|
sparrow_util_version=0.55.6
|
||||||
fastutil_version=8.5.18
|
fastutil_version=8.5.18
|
||||||
netty_version=4.1.127.Final
|
netty_version=4.1.127.Final
|
||||||
joml_version=1.10.8
|
joml_version=1.10.8
|
||||||
|
|||||||
Reference in New Issue
Block a user