Aspose.PSD for Java 24.4 - 릴리스 노트
Contents
[
Hide
]
이 페이지에는 Aspose.PSD for Java 24.4에 대한 릴리스 노트가 포함되어 있습니다.
키 | 요약 | 카테고리 |
---|---|---|
PSDJAVA-610 | Aspose.PSD for Java에 라이센스 설정을 여러 번 시도하면 예외가 발생합니다. | 버그 |
PSDJAVA-611 | [AI 형식] XObjectForm 리소스 처리 추가 | 기능 |
PSDJAVA-612 | ShapeLayer에 대한 생성자 추가 | 기능 |
PSDJAVA-613 | Psd 파일을 RGB에서 CMYK로 변환하는 문제 수정 | 버그 |
PSDJAVA-614 | 특정 PSD 파일을 Aspose.PSD를 사용하여 내보낼 수 없음 | 버그 |
공개 API 변경사항
추가된 API:
- M:com.aspose.psd.fileformats.psd.PsdImage.addShapeLayer
제거된 API:
- 없음
사용 예시:
PSDJAVA-610. Aspose.PSD for Java에 라이센스 설정을 여러 번 시도하면 예외가 발생합니다.
License license = new License();
String liccorrectJava = "Aspose.PSD.Java.lic";
license.setLicense(liccorrectJava);
license.setLicense(liccorrectJava);
PSDJAVA-611. [AI 형식] XObjectForm 리소스 처리 추가
String sourceFile = "src/main/resources/example.ai";
String outputFilePath = "src/main/resources/example.png";
try (AiImage image = (AiImage) Image.load(sourceFile)) {
image.save(outputFilePath, new PngOptions());
}
PSDJAVA-612. ShapeLayer에 대한 생성자 추가
private static final int IMG_TO_PSD_RATIO = 256 * 65535;
public static void main(String[] args) {
String outputFile = "src/main/resources/AddShapeLayer_output.psd";
try (PsdImage newPsd = new PsdImage(600, 400)) {
ShapeLayer layer = newPsd.addShapeLayer();
PathShape newShape = generateNewShape(newPsd.getSize());
List<IPathShape> newShapes = new List<>();
newShapes.add(newShape);
layer.getPath().setItems(newShapes.toArray(new IPathShape[0]));
layer.update();
newPsd.save(outputFile);
}
try (PsdImage image = (PsdImage) Image.load(outputFile)) {
assertAreEqual(2, image.getLayers().length);
ShapeLayer shapeLayer = (ShapeLayer) image.getLayers()[1];
ColorFillSettings internalFill = (ColorFillSettings) shapeLayer.getFill();
IStrokeSettings strokeSettings = shapeLayer.getStroke();
ColorFillSettings strokeFill = (ColorFillSettings) strokeSettings.getFill();
assertAreEqual(1, shapeLayer.getPath().getItems().length); // 1 Shape
assertAreEqual(3, shapeLayer.getPath().getItems()[0].getItems().length); // 3 knots in a shape
assertAreEqual(-16127182, internalFill.getColor().toArgb()); // ff09eb32
assertAreEqual(7.41, strokeSettings.getSize());
assertAreEqual(false, strokeSettings.getEnabled());
assertAreEqual(StrokePosition.Center, strokeSettings.getLineAlignment());
assertAreEqual(LineCapType.ButtCap, strokeSettings.getLineCap());
assertAreEqual(LineJoinType.MiterJoin, strokeSettings.getLineJoin());
assertAreEqual(-16777216, strokeFill.getColor().toArgb()); // ff000000
}
}
static PathShape generateNewShape(Size imageSize) {
PathShape newShape = new PathShape();
PointF point1 = new PointF(20, 100);
PointF point2 = new PointF(200, 100);
PointF point3 = new PointF(300, 10);
BezierKnotRecord firstBezierKnotRecord = new BezierKnotRecord();
firstBezierKnotRecord.setLinked(true);
firstBezierKnotRecord.setPoints(new Point[]{
pointFToResourcePoint(point1, imageSize),
pointFToResourcePoint(point1, imageSize),
pointFToResourcePoint(point1, imageSize)
});
BezierKnotRecord secondBezierKnotRecord = new BezierKnotRecord();
secondBezierKnotRecord.setLinked(true);
secondBezierKnotRecord.setPoints(new Point[]{
pointFToResourcePoint(point2, imageSize),
pointFToResourcePoint(point2, imageSize),
pointFToResourcePoint(point2, imageSize)
});
BezierKnotRecord thirdBezierKnotRecord = new BezierKnotRecord();
thirdBezierKnotRecord.setLinked(true);
thirdBezierKnotRecord.setPoints(new Point[]{
pointFToResourcePoint(point3, imageSize),
pointFToResourcePoint(point3, imageSize),
pointFToResourcePoint(point3, imageSize)
});
BezierKnotRecord[] bezierKnots = new BezierKnotRecord[]{
firstBezierKnotRecord,
secondBezierKnotRecord,
thirdBezierKnotRecord
};
newShape.setItems(bezierKnots);
return newShape;
}
static Point pointFToResourcePoint(PointF point, Size imageSize) {
return new Point(
Math.round(point.getY() * (IMG_TO_PSD_RATIO / imageSize.getHeight())),
Math.round(point.getX() * (IMG_TO_PSD_RATIO / imageSize.getWidth())));
}
static void assertAreEqual(Object expected, Object actual) {
assertAreEqual(expected, actual, "Objects are not equal.");
}
static void assertAreEqual(Object expected, Object actual, String message) {
if (!expected.equals(actual)) {
throw new IllegalArgumentException(message);
}
}
PSDJAVA-613. Psd 파일의 RGB에서 CMYK로의 변환 문제 수정
public static void main(String[] args) {
// RGB에서 CMYK로 변환된 psd 파일이 실제로 4개의 채널을 가지고 있고 HasTransparencyData == false인지 확인합니다.
String sourceFile = "src/main/resources/frog_nosymb.psd";
String outputFile = "src/main/resources/frog_nosymb_output.psd";
try (PsdImage psdImage = (PsdImage) Image.load(sourceFile)) {
psdImage.setTransparencyData(false);
PsdOptions psdOptions = new PsdOptions(psdImage);
psdOptions.setColorMode(ColorModes.Cmyk);
psdOptions.setCompressionMethod(CompressionMethod.RLE);
psdOptions.setChannelsCount((short) 4);
psdImage.save(outputFile, psdOptions);
}
try (PsdImage psdImage = (PsdImage) Image.load(outputFile)) {
assertAreEqual(false, psdImage.hasTransparencyData());
assertAreEqual(4, psdImage.getLayers()[0].getChannelsCount());
}
}
static void assertAreEqual(Object expected, Object actual) {
assertAreEqual(expected, actual, "Objects are not equal.");
}
static void assertAreEqual(Object expected, Object actual, String message) {
if (!expected.equals(actual)) {
throw new IllegalArgumentException(message);
}
}
PSDJAVA-614. 특정 PSD 파일을 Aspose.PSD를 사용하여 내보낼 수 없음
String sourceFile = "src/main/resources/1966source.psd";
String outputPng = "src/main/resources/output.png";
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setLoadEffectsResource(true);
try (PsdImage psdImage = (PsdImage) Image.load(sourceFile, psdLoadOptions)) {
psdImage.save(outputPng, new PngOptions());
}