Search in sources :

Example 6 with FocalPoint

use of com.enonic.xp.image.FocalPoint in project xp by enonic.

the class ImageScales method wide.

public ImageScaleFunction wide(FocalPoint focalPoint, Object... args) {
    Preconditions.checkArgument(args.length <= 2, "Too many arguments %s", args.length);
    final int width = CommandArgumentParser.getIntArg(args, 0, 0);
    final int height = CommandArgumentParser.getIntArg(args, 1, 0);
    final double offset = focalPoint.yOffset();
    Preconditions.checkArgument(width > 0 && width <= maxSideLength, "width value must be between 0 and %s : %s", maxSideLength, width);
    Preconditions.checkArgument(height > 0 && height <= maxSideLength, "height value must be between 0 and %s : %s", maxSideLength, height);
    return adaptScaleCalculator(ScaleCalculator.wide(width, height, offset));
}
Also used : FocalPoint(com.enonic.xp.image.FocalPoint)

Example 7 with FocalPoint

use of com.enonic.xp.image.FocalPoint in project xp by enonic.

the class ImageScales method width.

public ImageScaleFunction width(FocalPoint focalPoint, Object... args) {
    Preconditions.checkArgument(args.length <= 1, "Too many arguments %s", args.length);
    final int size = CommandArgumentParser.getIntArg(args, 0, 100);
    Preconditions.checkArgument(size > 0 && size <= maxSideLength, "size value must be between 0 and %s : %s", maxSideLength, size);
    return adaptScaleCalculator(ScaleCalculator.width(size));
}
Also used : FocalPoint(com.enonic.xp.image.FocalPoint)

Aggregations

FocalPoint (com.enonic.xp.image.FocalPoint)7 Property (com.enonic.xp.data.Property)1 PropertySet (com.enonic.xp.data.PropertySet)1 PropertyTree (com.enonic.xp.data.PropertyTree)1 ValueType (com.enonic.xp.data.ValueType)1