mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
adjust blur divisor
This commit is contained in:
@@ -139,6 +139,30 @@ public class Config {
|
|||||||
return configData;
|
return configData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBlurDivisor() {
|
||||||
|
int val = 1;
|
||||||
|
try {
|
||||||
|
switch(settingsData.videomode) {
|
||||||
|
case "720p":
|
||||||
|
case "768p":
|
||||||
|
val = 8;
|
||||||
|
break;
|
||||||
|
case "900p":
|
||||||
|
case "1080p":
|
||||||
|
val = 16;
|
||||||
|
break;
|
||||||
|
case "1440p":
|
||||||
|
case "2160p":
|
||||||
|
val = 32;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
public String getPrefix() {
|
public String getPrefix() {
|
||||||
return prefix;
|
return prefix;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
|||||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
|
||||||
import com.badlogic.gdx.math.Matrix4;
|
import com.badlogic.gdx.math.Matrix4;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
import forge.adventure.util.Config;
|
||||||
import forge.util.BlurUtils;
|
import forge.util.BlurUtils;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
@@ -63,7 +64,7 @@ public class WorldSaveHeader implements java.io.Serializable, Disposable {
|
|||||||
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
Pixmap pixmap = Pixmap.createFromFrameBuffer(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
if (Forge.lastPreview != null)
|
if (Forge.lastPreview != null)
|
||||||
Forge.lastPreview.dispose();
|
Forge.lastPreview.dispose();
|
||||||
Pixmap blurred = BlurUtils.blur(pixmap, 4, 2, false, true);
|
Pixmap blurred = BlurUtils.blur(pixmap, 4, 2, false, Config.instance().getBlurDivisor());
|
||||||
Forge.lastPreview = new Texture(blurred);
|
Forge.lastPreview = new Texture(blurred);
|
||||||
Pixmap scaled = new Pixmap(WorldSaveHeader.previewImageWidth, (int) (WorldSaveHeader.previewImageWidth / (Scene.getIntendedWidth() / (float) Scene.getIntendedHeight())), Pixmap.Format.RGBA8888);
|
Pixmap scaled = new Pixmap(WorldSaveHeader.previewImageWidth, (int) (WorldSaveHeader.previewImageWidth / (Scene.getIntendedWidth() / (float) Scene.getIntendedHeight())), Pixmap.Format.RGBA8888);
|
||||||
scaled.drawPixmap(pixmap,
|
scaled.drawPixmap(pixmap,
|
||||||
|
|||||||
@@ -270,12 +270,12 @@ public class BlurUtils {
|
|||||||
pixmap.getWidth(), pixmap.getHeight(), radius, iterations,
|
pixmap.getWidth(), pixmap.getHeight(), radius, iterations,
|
||||||
disposePixmap);
|
disposePixmap);
|
||||||
}
|
}
|
||||||
public static Pixmap blur(Pixmap pixmap, int radius, int iterations, boolean disposePixmap, boolean crop) {
|
public static Pixmap blur(Pixmap pixmap, int radius, int iterations, boolean disposePixmap, int div) {
|
||||||
int x = (int)(pixmap.getWidth()*0.35f);
|
int x = (int)(pixmap.getWidth()*0.35f);
|
||||||
int y = (int)(pixmap.getHeight()*0.35f);
|
int y = (int)(pixmap.getHeight()*0.35f);
|
||||||
int width = pixmap.getWidth()-x;
|
int width = pixmap.getWidth()-x;
|
||||||
int height = pixmap.getHeight()-y;
|
int height = pixmap.getHeight()-y;
|
||||||
return blur(pixmap, x/2, y/2, width, height, 0, 0, width/4, height/4, radius, iterations, disposePixmap);
|
return blur(pixmap, x/2, y/2, width, height, 0, 0, width/div, height/div, radius, iterations, disposePixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user