• R/O
  • HTTP
  • SSH
  • HTTPS

CharacterManaJ: Commit

キャラクターなんとかJの本体


Commit MetaInfo

Revision959f681fd61610e90f48f844b95eae425127f066 (tree)
Time2019-01-31 10:50:47
Authorseraphy <seraphy@user...>
Commiterseraphy

Log Message

PSD出力時のイメージ構成時にレンダリングヒントを使うか設定に従うように修正。

Change Summary

Incremental Difference

--- a/src/main/java/charactermanaj/graphics/io/ImageSaveHelper.java
+++ b/src/main/java/charactermanaj/graphics/io/ImageSaveHelper.java
@@ -613,7 +613,7 @@ public class ImageSaveHelper {
613613 ZipOutputStream zos = new ZipOutputStream(outFile);
614614 try {
615615 zos.setEncoding(zipNameEncoding);
616-
616+
617617 if (layerImages != null) {
618618 for (LayerImage layerImage : layerImages) {
619619 String partsName = layerImage.getPartsName();
@@ -668,6 +668,7 @@ public class ImageSaveHelper {
668668 }
669669
670670 AppConfig appConfig = AppConfig.getInstance();
671+ PSDCreator.setUseRenderingHints(appConfig.isEnableRenderingHints()); // レンダリングヒントの使用
671672 PSDCreator.setUseRLECompression(appConfig.isUseRLECompressionForPSD()); // RLE圧縮の有無
672673
673674 // PSDデータ作成
--- a/src/main/java/charactermanaj/graphics/io/PSDCreator.java
+++ b/src/main/java/charactermanaj/graphics/io/PSDCreator.java
@@ -1,6 +1,7 @@
11 package charactermanaj.graphics.io;
22
33 import java.awt.Graphics2D;
4+import java.awt.RenderingHints;
45 import java.awt.image.BufferedImage;
56 import java.awt.image.DataBufferInt;
67 import java.awt.image.WritableRaster;
@@ -117,6 +118,19 @@ public final class PSDCreator {
117118 }
118119
119120 /**
121+ * レンダリングヒントを使うか?
122+ */
123+ private static boolean useRenderingHints = true;
124+
125+ public static boolean isUseRenderingHints() {
126+ return useRenderingHints;
127+ }
128+
129+ public static void setUseRenderingHints(boolean useRenderingHints) {
130+ PSDCreator.useRenderingHints = useRenderingHints;
131+ }
132+
133+ /**
120134 * レイヤーを指定してPSDデータを作成する
121135 * @param layerDatas レイヤーのコレクション、順番に重ねられる
122136 * @return PSDデータ
@@ -388,6 +402,18 @@ public final class PSDCreator {
388402
389403 Graphics2D g = cimg.createGraphics();
390404 try {
405+ if (isUseRenderingHints()) {
406+ // リンダリングヒントを使う
407+ g.setRenderingHint(
408+ RenderingHints.KEY_ALPHA_INTERPOLATION,
409+ RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
410+ g.setRenderingHint(
411+ RenderingHints.KEY_COLOR_RENDERING,
412+ RenderingHints.VALUE_COLOR_RENDER_QUALITY);
413+ g.setRenderingHint(
414+ RenderingHints.KEY_RENDERING,
415+ RenderingHints.VALUE_RENDER_QUALITY);
416+ }
391417 for (LayerData layerData : layerDatas) {
392418 BufferedImage img = layerData.getImage();
393419 int w = img.getWidth();
Show on old repository browser