![JAR search and dependency download from the Maven repository](/logo.png)
com.coreoz.ppt.PptImageReplacementMode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ppt-templates Show documentation
Show all versions of ppt-templates Show documentation
PPT Template is a small templating library to generate PowerPoint presentations.
package com.coreoz.ppt;
import lombok.AllArgsConstructor;
/**
* Define how a new image should be resized to replace an existing image in a PPT.
* Resized images will always be placed in the top left corner
* of the original image placeholder frame.
*/
@AllArgsConstructor
public enum PptImageReplacementMode {
/**
* The new image will be resized the best fit the existing image frame,
* then the new image will be cropped from its center to fit exactly the original image frame.
*/
RESIZE_CROP(ImagesUtils::resizeCrop),
/**
* The new image will be resized the best fit the existing image frame,
* but no cropping will be applied: that means that the new image
* will very likely overstep the original image frame.
*/
RESIZE_ONLY(ImagesUtils::resizeOnly),
;
private final ResizeFunction resizeFunction;
byte[] resize(byte[] imageData, String targetFormat, int width, int height) {
return resizeFunction.resizeImage(imageData, targetFormat, width, height);
}
@FunctionalInterface
private static interface ResizeFunction {
byte[] resizeImage(byte[] imageData, String targetFormat, int width, int height);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy