java.lang.Object
one.jpro.platform.image.manager.transformer.ImageTransformerWH
All Implemented Interfaces:
JsonConvertible, ImageTransformer

public class ImageTransformerWH extends Object implements ImageTransformer
Implements the ImageTransformer interface to provide functionalities for transforming images based on specified width and height.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ImageTransformerWH(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 Type
    Method
    Description
    org.json.JSONObject
    Converts the object to a JSON representation.
    Transforms the provided original BufferedImage to match the target width and height.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public BufferedImage transform(BufferedImage original)
      Transforms the provided original BufferedImage to match the target width and height.
      Specified by:
      transform in interface ImageTransformer
      Parameters:
      original - The BufferedImage to be transformed.
      Returns:
      The transformed BufferedImage.
    • toJSON

      public org.json.JSONObject toJSON()
      Description copied from interface: JsonConvertible
      Converts the object to a JSON representation.
      Specified by:
      toJSON in interface JsonConvertible
      Returns:
      A JSONObject representing the object.