Fixed multiple issues with the layout
This commit is contained in:
@@ -38,18 +38,20 @@ public class ImageGenerator {
|
||||
final JSONObject cardsObject = (JSONObject) parser.parse(reader);
|
||||
for (Map.Entry<String, JSONObject> cardEntry : (Set<Map.Entry<String, JSONObject>>) cardsObject.entrySet()) {
|
||||
final String cardId = cardEntry.getKey();
|
||||
BufferedImage bufferedImage = new BufferedImage(jsonImageRecipe.getWidth(), jsonImageRecipe.getHeight(), BufferedImage.TYPE_INT_RGB);
|
||||
jsonImageRecipe.renderImage(properties, cardEntry.getValue(), bufferedImage);
|
||||
if (cardId.equals("40_3") || cardId.equals("40_17")) {
|
||||
BufferedImage bufferedImage = new BufferedImage(jsonImageRecipe.getWidth(), jsonImageRecipe.getHeight(), BufferedImage.TYPE_INT_RGB);
|
||||
jsonImageRecipe.renderImage(properties, cardEntry.getValue(), bufferedImage);
|
||||
|
||||
JPEGImageWriteParam jpegParams = new JPEGImageWriteParam(null);
|
||||
jpegParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
jpegParams.setCompressionQuality(1f);
|
||||
JPEGImageWriteParam jpegParams = new JPEGImageWriteParam(null);
|
||||
jpegParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||
jpegParams.setCompressionQuality(1f);
|
||||
|
||||
final ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next();
|
||||
final File resultFile = new File(output, cardId + ".jpg");
|
||||
try (FileImageOutputStream outputStream = new FileImageOutputStream(resultFile)) {
|
||||
writer.setOutput(outputStream);
|
||||
writer.write(null, new IIOImage(bufferedImage, null, null), jpegParams);
|
||||
final ImageWriter writer = ImageIO.getImageWritersByFormatName("jpg").next();
|
||||
final File resultFile = new File(output, cardId + ".jpg");
|
||||
try (FileImageOutputStream outputStream = new FileImageOutputStream(resultFile)) {
|
||||
writer.setOutput(outputStream);
|
||||
writer.write(null, new IIOImage(bufferedImage, null, null), jpegParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
|
||||
@@ -525,14 +525,18 @@ public class JSONImageRecipe implements ImageRecipe {
|
||||
}
|
||||
};
|
||||
Graphics2D graphics = (Graphics2D) image.getGraphics();
|
||||
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
for (LayerRecipe layer : layers) {
|
||||
layer.renderLayer(context, graphics);
|
||||
try {
|
||||
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
for (LayerRecipe layer : layers) {
|
||||
layer.renderLayer(context, graphics);
|
||||
}
|
||||
} finally {
|
||||
graphics.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@
|
||||
},
|
||||
"child": "LOTRSymbols.ttf"
|
||||
},
|
||||
"size": 40,
|
||||
"size": 38,
|
||||
"style": 0
|
||||
}
|
||||
},
|
||||
@@ -1007,7 +1007,7 @@
|
||||
"box": {
|
||||
"type": "box",
|
||||
"x": 162,
|
||||
"y": 690,
|
||||
"y": 692,
|
||||
"width": 536,
|
||||
"height": 265
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user