PPTX to Thumbnail: Rotated shapes do not show fill pattern (Java)

The latest Aspose Slides Java 19.12 does not show fill patterns in rotated shapes. I only know that it worked with Aspose Slides 15.11 and I don’t know when it stopped working.

Reproducable like this:

  1. Add a shape of type Triangle to a slide.
  2. Define fill pattern: vertical
  3. Rotate triangle by 90 degrees.
  4. Generate thumbnail.
    Expected result: Triangle should be filled with the vertical lines pattern as in the PPTX file (pattern not rotated).
    Actual result: Triangle is filled with the foreColor only.

Here my sample code that produces this behavior:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.imageio.ImageIO;

import com.aspose.slides.FillType;
import com.aspose.slides.IAutoShape;
import com.aspose.slides.IColorFormat;
import com.aspose.slides.IShapeFrame;
import com.aspose.slides.ISlide;
import com.aspose.slides.NullableBool;
import com.aspose.slides.PatternStyle;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
import com.aspose.slides.ShapeFrame;
import com.aspose.slides.ShapeType;

public class Main {

    public static void main(String[] args) {
        final Presentation presentation = new Presentation();
        final ISlide slide = presentation.getSlides().get_Item(0);

        addTriangle(slide, 60);

        final IAutoShape rotated90 = addTriangle(slide, 220);
        rotate(rotated90, 90);

        final IAutoShape rotated270 = addTriangle(slide, 380);
        rotate(rotated270, 270);


        final File pngFile = new File("MissingFillPatternInThumbnail.png");
        try (final FileOutputStream outputStream = new FileOutputStream(pngFile)) {
            System.out.println("Writing file " + pngFile.getAbsolutePath());
            ImageIO.write(slide.getThumbnail(1, 1), "png", outputStream);
        } catch (final IOException e) {
            e.printStackTrace();
        }

        final File pptxFile = new File("MissingFillPatternInThumbnail.pptx");
        System.out.println("Writing file " + pptxFile.getAbsolutePath());
        try (final FileOutputStream outputStream = new FileOutputStream(pptxFile)) {
            presentation.save(outputStream, SaveFormat.Pptx);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private static IAutoShape addTriangle(final ISlide slide, final float y) {
        final IAutoShape shape = slide.getShapes().addAutoShape(ShapeType.Triangle, 310, y, 100, 100);
        final IColorFormat foreColor = slide.getPresentation().getMasterTheme().getColorScheme().getAccent1();
        final IColorFormat backColor = slide.getPresentation().getMasterTheme().getColorScheme().getLight1();
        shape.getFillFormat().setFillType(FillType.Pattern);
        shape.getFillFormat().getPatternFormat().setPatternStyle(PatternStyle.Vertical);
        shape.getFillFormat().getPatternFormat().getForeColor().copyFrom(foreColor);
        shape.getFillFormat().getPatternFormat().getBackColor().copyFrom(backColor);
        return shape;
    }

    private static void rotate(final IAutoShape shape, final float rotationAngle) {
        final IShapeFrame frame = shape.getFrame();
        final float x = frame.getX() - (frame.getHeight() - frame.getWidth()) / 2;
        final float y = frame.getY() - (frame.getWidth() - frame.getHeight()) / 2;
        shape.setFrame(new ShapeFrame(x, y, frame.getHeight(), frame.getWidth(), NullableBool.False, NullableBool.False, rotationAngle));
    }
}

MissingFillPatternInThumbnail.png (25.2 KB)

@pstoehrer,

I have worked with sample code shared and have also observed the sample image. An issue with ID SLIDESJAVA-38008 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-38008) have been fixed in this update.