Search in sources :

Example 6 with UnmarshalledParameter

use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.

the class Rotate method buildOperation.

@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
    String key = FilterTypeEnum.ROTATE.toString().toLowerCase();
    if (!containsMyFilterParams(key, parameterMap)) {
        return null;
    }
    Operation operation = new Operation();
    operation.setName(key);
    String factor = parameterMap.get(key + "-factor");
    operation.setFactor(factor == null ? null : Double.valueOf(factor));
    UnmarshalledParameter rotate = new UnmarshalledParameter();
    String rotateApplyFactor = parameterMap.get(key + "-rotate-apply-factor");
    rotate.setApplyFactor(rotateApplyFactor == null ? false : Boolean.valueOf(rotateApplyFactor));
    rotate.setName("rotate");
    rotate.setType(ParameterTypeEnum.DOUBLE.toString());
    rotate.setValue(parameterMap.get(key + "-rotate-amount"));
    operation.setParameters(new UnmarshalledParameter[] { rotate });
    return operation;
}
Also used : UnmarshalledParameter(org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter) Operation(org.broadleafcommerce.openadmin.server.service.artifact.image.Operation)

Example 7 with UnmarshalledParameter

use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.

the class UnsharpMask method buildOperation.

@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
    String key = FilterTypeEnum.UNSHARPMASK.toString().toLowerCase();
    if (!containsMyFilterParams(key, parameterMap)) {
        return null;
    }
    Operation operation = new Operation();
    operation.setName(key);
    String factor = parameterMap.get(key + "-factor");
    operation.setFactor(factor == null ? null : Double.valueOf(factor));
    UnmarshalledParameter amount = new UnmarshalledParameter();
    String amountApplyFactor = parameterMap.get(key + "-value-apply-factor");
    amount.setApplyFactor(amountApplyFactor == null ? false : Boolean.valueOf(amountApplyFactor));
    amount.setName("value");
    amount.setType(ParameterTypeEnum.FLOAT.toString());
    amount.setValue(parameterMap.get(key + "-value-amount"));
    UnmarshalledParameter radius = new UnmarshalledParameter();
    String radiusApplyFactor = parameterMap.get(key + "-radius-apply-factor");
    radius.setApplyFactor(radiusApplyFactor == null ? false : Boolean.valueOf(radiusApplyFactor));
    radius.setName("radius");
    radius.setType(ParameterTypeEnum.INT.toString());
    radius.setValue(parameterMap.get(key + "-radius-amount"));
    operation.setParameters(new UnmarshalledParameter[] { amount, radius });
    return operation;
}
Also used : UnmarshalledParameter(org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter) Operation(org.broadleafcommerce.openadmin.server.service.artifact.image.Operation)

Aggregations

Operation (org.broadleafcommerce.openadmin.server.service.artifact.image.Operation)7 UnmarshalledParameter (org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter)7