Class ObjectFitCalculator
- java.lang.Object
-
- com.itextpdf.layout.renderer.objectfit.ObjectFitCalculator
-
public final class ObjectFitCalculator extends java.lang.Object
Utility class which supports theObjectFit
property.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ObjectFitCalculator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectFitApplyingResult
calculateRenderedImageSize(ObjectFit objectFit, double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
Calculates size of image to be render when certainObjectFit
mode is applied.private static ObjectFitApplyingResult
processContain(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
private static ObjectFitApplyingResult
processCover(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
private static ObjectFitApplyingResult
processFill(double imageContainerWidth, double imageContainerHeight)
private static ObjectFitApplyingResult
processNone(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
private static ObjectFitApplyingResult
processScaleDown(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
private static ObjectFitApplyingResult
processToFitSide(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight, boolean clipToFit)
-
-
-
Method Detail
-
calculateRenderedImageSize
public static ObjectFitApplyingResult calculateRenderedImageSize(ObjectFit objectFit, double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
Calculates size of image to be render when certainObjectFit
mode is applied. The width or the height of the image might be greater than the same property of the image in a document. In this case parts of the image will not be shown.- Parameters:
objectFit
- is an object-fit modeabsoluteImageWidth
- is a width of the original imageabsoluteImageHeight
- is a height of the original imageimageContainerWidth
- is a width of the image to drawimageContainerHeight
- is a width of the image to draw- Returns:
- results of object-fit mode applying as an
ObjectFitApplyingResult
object
-
processFill
private static ObjectFitApplyingResult processFill(double imageContainerWidth, double imageContainerHeight)
-
processContain
private static ObjectFitApplyingResult processContain(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
-
processCover
private static ObjectFitApplyingResult processCover(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
-
processScaleDown
private static ObjectFitApplyingResult processScaleDown(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
-
processNone
private static ObjectFitApplyingResult processNone(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight)
-
processToFitSide
private static ObjectFitApplyingResult processToFitSide(double absoluteImageWidth, double absoluteImageHeight, double imageContainerWidth, double imageContainerHeight, boolean clipToFit)
-
-