Catatan Rilis Aspose.PSD untuk Java 23.9

Kunci Ringkasan Kategori
PSDJAVA-527 Melaksanakan pembuatan mask untuk layer penyesuaian baru Fitur
PSDJAVA-528 Tambahkan dukungan untuk Blend Clipped Layers sebagai opsi penyelarasan Grup Fitur
PSDJAVA-529 File PSD dengan mode warna 16 bit tidak menerapkan masker untuk layer penyesuaian Bug
PSDJAVA-530 Render kurung yang tidak benar di layer teks Bug
PSDJAVA-531 Tidak dapat memperbarui gaya dalam layer teks Bug
PSDJAVA-532 Setelah mengekspor file PSD dengan CMYK, warna dalam PSD yang diekspor rusak Bug
PSDJAVA-533 File PSB tertentu melempar exception “The rectangle has no common processing area” Bug
PSDJAVA-534 Pemuatan gambar gagal. OverflowException: Operasi aritmatika menghasilkan overflow. Bug

Perubahan API Publik

API Ditambahkan:

  • M:com.aspose.psd.PixelDataFormat.getCmyk16
  • M:com.aspose.psd.PixelDataFormat.getCmyka16
  • M:com.aspose.psd.fileformats.psd.layers.Layer.getBlendClippedElements
  • M:com.aspose.psd.fileformats.psd.layers.Layer.setBlendClippedElements(boolean)

API Dihapus:

  • Tidak Ada

Contoh Penggunaan:

** PSDJAVA-527. Melaksanakan pembuatan mask untuk layer penyesuaian baru**

public static void main(String[] args) {
    String srcFile = "src/main/resources/zendeya_BW.psd";
    String dstFile = "src/main/resources/zendeya_BW_out.psd";

    try (PsdImage im = (PsdImage) Image.load(srcFile)) {
        im.addBlackWhiteAdjustmentLayer();

        im.save(dstFile);
    }

    try (PsdImage im = (PsdImage) Image.load(dstFile)) {
        Layer layer = im.getLayers()[1];

        assertAreEqual(5, layer.getChannelsCount());
        assertAreEqual((short) -2, layer.getChannelInformation()[4].getChannelID());
    }
}

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-528. Tambahkan dukungan untuk Blend Clipped Layers sebagai opsi penyelarasan Grup**

    String sourceFile = "src/main/resources/example_source.psd";
    String outputPsd = "src/main/resources/example_output.psd";
    String outputPng = "src/main/resources/example_output.png";

    try (PsdImage image = (PsdImage)Image.load(sourceFile)) {
        image.getLayers()[1].setBlendClippedElements(false);
        image.save(outputPsd);
        image.save(outputPng, new PngOptions());
    }

** PSDJAVA-529. File PSD dengan mode warna 16 bit tidak menerapkan masker untuk layer penyesuaian**

	String sourceFile = "src/main/resources/source.psd";
    String outputPng = "src/main/resources/current.png";

    try (PsdImage image = (PsdImage) Image.load(sourceFile)) {
        image.save(outputPng, new PngOptions());
    }

** PSDJAVA-530. Render kurung yang tidak benar di layer teks**

    String file = "src/main/resources/file1.psd";
    String output = "src/main/resources/output_1235.png";

    try (PsdImage psdImage = (PsdImage) Image.load(file)) {
        for (Layer layer : psdImage.getLayers()) {
            if (layer instanceof TextLayer) {
                TextLayer textLayer = (TextLayer) layer;
                textLayer.getTextData().updateLayerData();

                PsdOptions imageOptions = new PsdOptions(psdImage);
                psdImage.save(output, imageOptions);
            }
        }
    }

** PSDJAVA-531. Tidak dapat memperbarui gaya dalam layer teks**

    String sourceFile = "src/main/resources/Example_FontSize.psd";
    String outputFile = "src/main/resources/output_Example_FontSize.psd";

    PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
    psdLoadOptions.setLoadEffectsResource(true);

    try (PsdImage psdImage = (PsdImage) Image.load(sourceFile, psdLoadOptions)) {
        TextLayer l1 = (TextLayer) psdImage.getLayers()[4];
        TextLayer l2 = (TextLayer) psdImage.getLayers()[5];

        ITextPortion[] textItems1 = l1.getTextData().producePortions(new String[]{"text1", "text2"},
                l1.getTextData().getItems()[0].getStyle(), l1.getTextData().getItems()[0].getParagraph());

        l1.getTextData().removePortion(0);
        for (ITextPortion item : textItems1) {
            l1.getTextData().addPortion(item);
        }

        ITextPortion[] textItems2 = l2.getTextData().producePortions(new String[]{"text layer 1", "text layer 22"},
                l2.getTextData().getItems()[0].getStyle(), l2.getTextData().getItems()[0].getParagraph());

        for (ITextPortion item : textItems2) {
            l2.getTextData().addPortion(item);
        }

        l1.getTextData().updateLayerData();
        l2.getTextData().updateLayerData();

        psdImage.save(outputFile);
    }

** PSDJAVA-532. Setelah mengekspor file PSD dengan CMYK, warna dalam PSD yang diekspor rusak**

    String sourceFile = "src/main/resources/canyon.psd";
    String outputFilePng = "src/main/resources/output_canyon.png";

    MemoryStream outputStream = new MemoryStream();

    try (PsdImage psdImage = (PsdImage) Image.load(sourceFile)) {
        psdImage.save(outputStream.toOutputStream());
    }

    outputStream.setPosition(0);
    try (PsdImage psdImage = (PsdImage) Image.load(outputStream.toInputStream())) {
        psdImage.save(outputFilePng, new PngOptions());
    }

    outputStream.close();

** PSDJAVA-533. File PSB tertentu melempar exception “The rectangle has no common processing area”**

    String input = "src/main/resources/1619_src.psb";
    String output = "src/main/resources/1619_output.png";

    PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
    psdLoadOptions.setLoadEffectsResource(true);
    try (PsdImage img = (PsdImage) Image.load(input, psdLoadOptions)) {
        PngOptions pngOptions = new PngOptions();
        pngOptions.setCompressionLevel(9);
        pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
        img.save(output, pngOptions);
    }

** PSDJAVA-534. Pemuatan gambar gagal. OverflowException: Operasi aritmatika menghasilkan overflow.**

public static void main(String[] args) {
    String sourceFile = "src/main/resources/9baa6962-f409-41ee-88da-418ea87bb56f_test_2.psd";

    try (PsdImage im = (PsdImage)PsdImage.load(sourceFile))
    {
        Layer layer = im.getLayers()[28];
        GrdmResource grdmResource = (GrdmResource)layer.getResources()[0];

        assertAreEqual("自定", grdmResource.getGradientName());
    }

}

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);
    }
}