Class CropDimension


  • @ProviderType
    public final class CropDimension
    extends Dimension
    Crop dimension with left, top, width and height as integer.
    • Constructor Detail

      • CropDimension

        public CropDimension​(long left,
                             long top,
                             long width,
                             long height)
        Parameters:
        left - Left in pixels
        top - Top in pixels
        width - Width in pixels
        height - Height in pixels
      • CropDimension

        public CropDimension​(long left,
                             long top,
                             long width,
                             long height,
                             boolean autoCrop)
        Parameters:
        left - Left in pixels
        top - Top in pixels
        width - Width in pixels
        height - Height in pixels
        autoCrop - Mark this dimension as auto-cropped
    • Method Detail

      • getLeft

        public long getLeft()
        Returns:
        Left in pixels
      • getTop

        public long getTop()
        Returns:
        Top in pixels
      • getRight

        public long getRight()
        Returns:
        Right in pixels
      • getBottom

        public long getBottom()
        Returns:
        Bottom in pixels
      • isAutoCrop

        public boolean isAutoCrop()
        Returns:
        true if is dimenions is marked as auto-cropped
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Dimension
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Dimension
      • getCropString

        @NotNull
        public @NotNull java.lang.String getCropString()
        Returns:
        Crop string with left,top,right,bottom.
      • getCropStringWidthHeight

        @NotNull
        public @NotNull java.lang.String getCropStringWidthHeight()
        Returns:
        Crop string with left,top,width,height.
      • getRectangle

        @NotNull
        public @NotNull java.awt.geom.Rectangle2D getRectangle()
        Returns:
        Rectangle
      • fromCropString

        @NotNull
        public static @NotNull CropDimension fromCropString​(@NotNull
                                                            @NotNull java.lang.String cropString)
        Get crop dimension from crop string. Please note: Crop string contains not width/height as 3rd/4th parameter but right, bottom.
        Parameters:
        cropString - Cropping string from AEM inplace editor
        Returns:
        Crop dimension instance
        Throws:
        java.lang.IllegalArgumentException - if crop string syntax is invalid