public class CropSourceOptions.CropSourceOptionsSerializer extends Object implements TransformationSourceOptions.TransformationSourceOptionsSerializer
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_CROP_GRAVITY
This optional
String parameter determines the 'zero' position
from which offsets are measured and also determines the direction of
offsets. |
static String |
PARAM_CROP_HEIGHT
|
static String |
PARAM_CROP_WIDTH
|
static String |
PARAM_CROP_X_OFFSET
This optional
Integer parameter specifies the horizontal position
of the start point of the area to be cropped. |
static String |
PARAM_CROP_Y_OFFSET
This optional
Integer parameter specifies the vertical position
of the start point of the area to be cropped. |
static String |
PARAM_IS_PERCENT_CROP
This optional
Boolean flag parameter specifies how the
PARAM_CROP_HEIGHT and PARAM_CROP_WIDTH parameters are interpreted. |
Constructor and Description |
---|
CropSourceOptionsSerializer() |
Modifier and Type | Method and Description |
---|---|
TransformationSourceOptions |
deserialize(SerializedTransformationOptionsAccessor serializedOptions)
Gets the parameters from the serialized options accessor and builds a source options object.
|
void |
serialize(TransformationSourceOptions sourceOptions,
Map<String,Serializable> parameters)
Serializes the given transformation source options into the given parameter map.
|
public static final String PARAM_CROP_WIDTH
Integer
or Float
parameter specifies the
width of the image after cropping. This may be expressed as pixels or it
may represent a percentage of the original image width, depending on the
value of the PARAM_IS_PERCENT_CROP parameter. public static final String PARAM_CROP_HEIGHT
Integer
or Float
parameter specifies the
height of the image after cropping. This may be expressed as pixels or it
may represent a percentage of the original image width, depending on the
value of the PARAM_IS_PERCENT_CROP parameter. public static final String PARAM_CROP_X_OFFSET
Integer
parameter specifies the horizontal position
of the start point of the area to be cropped. By default this parameter
sets the distance, in pixels, from the left-hand edge of the image to the
start position of the crop area. By default a positive value will shift
the start-position to the right, while a negative value will shift the
start position to the left. Setting the PARAM_CROP_GRAVITY parameter may
change this, however.public static final String PARAM_CROP_Y_OFFSET
Integer
parameter specifies the vertical position
of the start point of the area to be cropped. By default this parameter
sets the distance, in pixels, from the top edge of the image to the start
position of the crop area. By default a positive value will shift the
start-position downwards, while a negative value will shift the start
position upwards. Setting the PARAM_CROP_GRAVITY parameter may change
this, however.public static final String PARAM_CROP_GRAVITY
String
parameter determines the 'zero' position
from which offsets are measured and also determines the direction of
offsets. The allowed values of gravity are the four cardinal points
(North, East, etc.), the four ordinal points (NorhtWest, SouthEast, etc)
and Center. By default NorthWest gravity is used.
If an ordinal gravity is set then the point from which offsets originate will be the appropriate corner. For example, NorthWest gravity would originate at teh top-left corner while SouthWest origin would originate at the bottom-left corner. Cardinal gravity sets the origin at the center of the appropriate edge. Center origin sets the origin at the center of the image.
Gravity also affects the direction of offsets and how the offset position relates to the cropped image. For example, NorthWest gravity sets positive horizontal offset direction to right, positive vertical direction to down and sets the cropped image origin to the top-left corner. Northerly gavities set the positive vertical direction to down. Southerly gavities set teh positive vertical direction to up. Easterly gavities set teh positive horizontal positive direction to left. Westerly gavities set teh positive horizontal positive direction to right.
Some gravity values do not specify a horizontal or a vertical direction explicitly. For example North does not specify a horizontal direction, while Center does not specify either horizontal or vertical direction. In thse cases the positive horizontal offset direction is always right and the positive vertical offset direction is always down.
The gravity also affects how the cropped image relates to the offset position. For example, NorthWest gravity causes the top-left corner of the cropped area to be the offset position, while NorthEast gravity would set the top-right corner of the cropped are to the offset position. When a direction is not explicitly specified then the center of the cropped area is placed at the offset position. For example, with North gravity the horizontal position is unspecified so the cropped area would be horizontally centered on the offset position, but the top edge of the cropped area would be at the offset position. For Center gravity the cropped area will be centered over the offset position both horizontally and vertically.
public static final String PARAM_IS_PERCENT_CROP
Boolean
flag parameter specifies how the
PARAM_CROP_HEIGHT and PARAM_CROP_WIDTH parameters are interpreted. If
this parameter is set to true
then the cropped image height and
width are represented as a percentage of the original image height and
width. If this parameter is set to false
then the rendition
height and width are represented as pixels. This parameter defaults to
false
.public TransformationSourceOptions deserialize(SerializedTransformationOptionsAccessor serializedOptions)
TransformationSourceOptions.TransformationSourceOptionsSerializer
deserialize
in interface TransformationSourceOptions.TransformationSourceOptionsSerializer
serializedOptions
- SerializedTransformationOptionsAccessorpublic void serialize(TransformationSourceOptions sourceOptions, Map<String,Serializable> parameters)
TransformationSourceOptions.TransformationSourceOptionsSerializer
serialize
in interface TransformationSourceOptions.TransformationSourceOptionsSerializer
sourceOptions
- TransformationSourceOptionsCopyright © 2005–2017 Alfresco Software. All rights reserved.