Skip to content

Commit 99fc13f

Browse files
committed
zima 0.6.0
1 parent b7fe971 commit 99fc13f

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'pl.asie.zima'
9-
version '0.5.1'
9+
version '0.6.0'
1010

1111
repositories {
1212
mavenCentral()

docs/changelog/0.6.0.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
Improvements:
22

33
* Added experimental coarse (character-level) dithering support.
4-
* Minor performance optimizations.
4+
* Added option to change the stat cycles for statful elements.
5+
* By default, it is now a cycle speed of 0, as opposed to 1!
6+
* Minor performance optimizations.

src/main/java/pl/asie/zima/image/ImageConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static class ElementRuleResult {
204204
public Pair<Result, BufferedImage> convert(BufferedImage inputImage, ImageConverterRuleset ruleset,
205205
int x, int y, int width, int height, int playerX, int playerY, int maxStatCount, boolean blinkingDisabled,
206206
int maxBoardSize, float coarseDitherStrength, DitherMatrix coarseDitherMatrixEnum,
207-
IntPredicate charCheck, IntPredicate colorCheck,
207+
IntPredicate charCheck, IntPredicate colorCheck, int defStatCycle,
208208
TextVisualRenderer previewRenderer,
209209
ProgressCallback progressCallback, boolean fast) {
210210
if (!platform.isSupportsBlinking()) {
@@ -403,7 +403,7 @@ public Pair<Result, BufferedImage> convert(BufferedImage inputImage, ImageConver
403403

404404
stat.setX(x + coords.getX());
405405
stat.setY(y + coords.getY());
406-
stat.setCycle(1); // maybe we can reduce this to save CPU cycles?
406+
stat.setCycle(defStatCycle); // maybe we can reduce this to save CPU cycles?
407407
stat.setP1(result.getCharacter());
408408

409409
if (boardSerializationSize < (realMaxBoardSize - 128)) {

src/main/java/pl/asie/zima/image/gui/ZimaConversionProfile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class ZimaConversionProfile {
4545
public static final Property<Integer> BOARD_Y = Property.create("output.boardY", 1);
4646
public static final Property<Integer> PLAYER_X = Property.create("output.playerX", 60);
4747
public static final Property<Integer> PLAYER_Y = Property.create("output.playerY", 25);
48+
public static final Property<Integer> STAT_CYCLE = Property.create("output.statCycle", 0);
4849
public static final Property<Integer> MAX_STAT_COUNT = Property.create("converter.maxStatCount", 150);
4950
public static final Property<Integer> MAX_BOARD_SIZE = Property.create("converter.maxBoardSize", 20002);
5051
public static final Property<Float> TRIX_CONTRAST_REDUCTION = Property.create("converter.trix.contrastReduction", 0.0035f, MSE_CALCULATOR);
@@ -205,6 +206,7 @@ public Pair<ImageConverter.Result, BufferedImage> convert(BufferedImage input, P
205206
properties.get(COARSE_DITHER_MATRIX),
206207
properties.has(ALLOWED_CHARACTERS) ? properties.get(ALLOWED_CHARACTERS)::contains : null,
207208
properties.has(ALLOWED_COLORS) ? properties.get(ALLOWED_COLORS)::contains : null,
209+
properties.get(STAT_CYCLE),
208210
this.renderer, progressCallback, fast);
209211
}
210212
}

src/main/java/pl/asie/zima/image/gui/ZimaFrontendSwing.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ Platform.MEGAZEUX, new ImageConverterRuleset(List.of())
155155
// "Advanced" tab
156156
private JCheckBox fastPreviewEdit;
157157
private JCheckBox allowFacesEdit;
158+
private JSpinner statCycleEdit;
158159

159160
private final byte[] defaultCharset;
160161
private final int[] defaultPalette;
@@ -255,6 +256,7 @@ public ZimaFrontendSwing(byte[] defaultCharset, int[] defaultPalette, String zim
255256
this.saveBrdItem.setEnabled(newPlatform.isUsesBoard());
256257
this.maxBoardSizeEdit.setEnabled(newPlatform.getMaxBoardSize() > 0);
257258
this.maxStatCountEdit.setEnabled(newPlatform.getMaxStatCount() > 0);
259+
this.statCycleEdit.setEnabled(newPlatform.getMaxStatCount() > 0);
258260
});
259261

260262
appendTabRow(this.optionsBoardPanel, gbc, "Board X", this.boardXEdit = new JSpinner(boardCoordsModel(1, false)));
@@ -453,6 +455,10 @@ public ZimaFrontendSwing(byte[] defaultCharset, int[] defaultPalette, String zim
453455
this.contrastReductionReset = new JButton("Reset"));
454456
bindPropertyFloat(this.profile.getProperties(), ZimaConversionProfile.TRIX_CONTRAST_REDUCTION, this.contrastReductionEdit, (f) -> (int) Math.sqrt(f * 10000000.0f), (i) -> (i * i) / 10000000.0f);
455457
this.contrastReductionReset.addActionListener((e) -> { this.profile.getProperties().reset(ZimaConversionProfile.TRIX_CONTRAST_REDUCTION); });
458+
459+
appendTabRow(this.optionsAdvancedPanel, gbc, "Statful element cycles", this.statCycleEdit = new JSpinner(new SpinnerNumberModel(0, 0, 420, 1)));
460+
bindPropertyInt(this.profile.getProperties(), ZimaConversionProfile.STAT_CYCLE, this.statCycleEdit);
461+
this.profile.getProperties().addChangeListener(ZimaConversionProfile.PLATFORM, (k, v) -> this.statCycleEdit.setModel(new SpinnerNumberModel(((Number) this.statCycleEdit.getValue()).intValue(), 0, 420, 1)));
456462
}
457463

458464
for (JPanel panel : List.of(this.optionsBoardPanel, this.optionsImagePanel, this.optionsCharsetPanel, this.optionsPalettePanel, this.optionsElementsPanel, this.optionsAdvancedPanel)) {

0 commit comments

Comments
 (0)