Class CropImageAction.Cropping
- java.lang.Object
-
- org.ametys.plugins.core.upload.image.CropImageAction.Cropping
-
- Enclosing class:
- CropImageAction
protected static class CropImageAction.Cropping extends Object
Represents a rectangular cropping of an image.
It stores only relative float values (which are between 0 and 1) as ratio of the width and height of the original image, which are unknown.
-
-
Field Summary
Fields Modifier and Type Field Description private float
_relativeHeight
private float
_relativeWidth
private float
_relativeX1
private float
_relativeY1
-
Constructor Summary
Constructors Modifier Constructor Description protected
Cropping(Parameters parameters)
Builds a new Cropping object fromParameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getHeight(int originalHeight)
Gets the height of the cropping rectangular regionprotected int
getWidth(int originalWidth)
Gets the width of the cropping rectangular regionprotected int
getX(int originalWidth)
Gets the X coordinate of the upper-left corner of the cropping rectangular regionprotected int
getY(int originalHeight)
Gets the Y coordinate of the upper-left corner of the cropping rectangular regionprotected boolean
isOriginal()
Returnstrue
if this cropping actually represents the original image
-
-
-
Field Detail
-
_relativeX1
private float _relativeX1
-
_relativeY1
private float _relativeY1
-
_relativeWidth
private float _relativeWidth
-
_relativeHeight
private float _relativeHeight
-
-
Constructor Detail
-
Cropping
protected Cropping(Parameters parameters)
Builds a new Cropping object fromParameters
- Parameters:
parameters
- The parameters
-
-
Method Detail
-
isOriginal
protected boolean isOriginal()
Returnstrue
if this cropping actually represents the original image- Returns:
true
if this cropping actually represents the original image
-
getX
protected int getX(int originalWidth)
Gets the X coordinate of the upper-left corner of the cropping rectangular region- Parameters:
originalWidth
- The width of the original image- Returns:
- the X coordinate of the upper-left corner of the cropping rectangular region
-
getY
protected int getY(int originalHeight)
Gets the Y coordinate of the upper-left corner of the cropping rectangular region- Parameters:
originalHeight
- The height of the original image- Returns:
- the Y coordinate of the upper-left corner of the cropping rectangular region
-
getWidth
protected int getWidth(int originalWidth)
Gets the width of the cropping rectangular region- Parameters:
originalWidth
- The width of the original image- Returns:
- the width of the cropping rectangular region
-
getHeight
protected int getHeight(int originalHeight)
Gets the height of the cropping rectangular region- Parameters:
originalHeight
- The height of the original image- Returns:
- the height of the cropping rectangular region
-
-