Class CmsBoxFit
- java.lang.Object
-
- org.opencms.ade.galleries.client.preview.util.CmsBoxFit
-
- All Implemented Interfaces:
I_CmsTransform
public class CmsBoxFit extends java.lang.Object implements I_CmsTransform
A coordinate system transform for translating between coordinates relative to a rectangle and the coordinates relative to a second rectangle with the first rectangle fit into the second one, either by just centering if possible or by centering and scaling it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsBoxFit.Mode
Scale mode.
-
Constructor Summary
Constructors Constructor Description CmsBoxFit(CmsBoxFit.Mode mode, double width, double height, double naturalWidth, double naturalHeight)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
toString()
org.opencms.ade.galleries.shared.CmsPoint
transformBack(org.opencms.ade.galleries.shared.CmsPoint point)
Applies the inverse of the transformation to a point.org.opencms.ade.galleries.shared.CmsPoint
transformForward(org.opencms.ade.galleries.shared.CmsPoint point)
Applies the transformation to a point.
-
-
-
Constructor Detail
-
CmsBoxFit
public CmsBoxFit(CmsBoxFit.Mode mode, double width, double height, double naturalWidth, double naturalHeight)
Creates a new instance.- Parameters:
mode
- the scale modewidth
- the width of the first rectangleheight
- the height of the first rectanglenaturalWidth
- the width of the second rectanglenaturalHeight
- the height of the second rectangle
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
transformBack
public org.opencms.ade.galleries.shared.CmsPoint transformBack(org.opencms.ade.galleries.shared.CmsPoint point)
Description copied from interface:I_CmsTransform
Applies the inverse of the transformation to a point.- Specified by:
transformBack
in interfaceI_CmsTransform
- Parameters:
point
- the point- Returns:
- the transformed point
- See Also:
I_CmsTransform.transformBack(org.opencms.ade.galleries.shared.CmsPoint)
-
transformForward
public org.opencms.ade.galleries.shared.CmsPoint transformForward(org.opencms.ade.galleries.shared.CmsPoint point)
Description copied from interface:I_CmsTransform
Applies the transformation to a point.- Specified by:
transformForward
in interfaceI_CmsTransform
- Parameters:
point
- the point- Returns:
- the transformed point
- See Also:
I_CmsTransform.transformForward(org.opencms.ade.galleries.shared.CmsPoint)
-
-