Class ImageTransformerWH
java.lang.Object
one.jpro.platform.image.manager.transformer.ImageTransformerWH
- All Implemented Interfaces:
JsonConvertible,ImageTransformer
Implements the ImageTransformer interface to provide functionalities
for transforming images based on specified width and height.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionImageTransformerWH(int targetWidth, int targetHeight) Constructs an instance of ImageTransformerWH with specified target width and height.ImageTransformerWH(int targetWidth, int targetHeight, double ratio) Constructs an instance of ImageTransformerWH with a specified target width and height, and scales them by the provided ratio. -
Method Summary
Modifier and TypeMethodDescriptionorg.json.JSONObjecttoJSON()Converts the object to a JSON representation.transform(BufferedImage original) Transforms the provided original BufferedImage to match the target width and height.
-
Constructor Details
-
ImageTransformerWH
public ImageTransformerWH(int targetWidth, int targetHeight) Constructs an instance of ImageTransformerWH with specified target width and height.- Parameters:
targetWidth- The desired width of the transformed image.targetHeight- The desired height of the transformed image.
-
ImageTransformerWH
public ImageTransformerWH(int targetWidth, int targetHeight, double ratio) Constructs an instance of ImageTransformerWH with a specified target width and height, and scales them by the provided ratio.- Parameters:
targetWidth- The initial width value before scaling.targetHeight- The initial height value before scaling.ratio- The scaling factor for width and height.
-
-
Method Details
-
transform
Transforms the provided original BufferedImage to match the target width and height.- Specified by:
transformin interfaceImageTransformer- Parameters:
original- The BufferedImage to be transformed.- Returns:
- The transformed BufferedImage.
-
toJSON
public org.json.JSONObject toJSON()Description copied from interface:JsonConvertibleConverts the object to a JSON representation.- Specified by:
toJSONin interfaceJsonConvertible- Returns:
- A JSONObject representing the object.
-