use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.
the class AlterRGB method buildOperation.
@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
String key = FilterTypeEnum.ALTERRGB.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 red = new UnmarshalledParameter();
String redApplyFactor = parameterMap.get(key + "-red-apply-factor");
red.setApplyFactor(redApplyFactor == null ? false : Boolean.valueOf(redApplyFactor));
red.setName("red");
red.setType(ParameterTypeEnum.INT.toString());
red.setValue(parameterMap.get(key + "-red-amount"));
UnmarshalledParameter green = new UnmarshalledParameter();
String greenApplyFactor = parameterMap.get(key + "-green-apply-factor");
green.setApplyFactor(greenApplyFactor == null ? false : Boolean.valueOf(greenApplyFactor));
green.setName("green");
green.setType(ParameterTypeEnum.INT.toString());
green.setValue(parameterMap.get(key + "-green-amount"));
UnmarshalledParameter blue = new UnmarshalledParameter();
String blueApplyFactor = parameterMap.get(key + "-blue-apply-factor");
blue.setApplyFactor(blueApplyFactor == null ? false : Boolean.valueOf(blueApplyFactor));
blue.setName("blue");
blue.setType(ParameterTypeEnum.INT.toString());
blue.setValue(parameterMap.get(key + "-blue-amount"));
operation.setParameters(new UnmarshalledParameter[] { red, green, blue });
return operation;
}
use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.
the class Resize method buildOperation.
@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
String key = FilterTypeEnum.RESIZE.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 targetWidth = new UnmarshalledParameter();
String targetWidthApplyFactor = parameterMap.get(key + "-width-apply-factor");
targetWidth.setApplyFactor(targetWidthApplyFactor == null ? false : Boolean.valueOf(targetWidthApplyFactor));
targetWidth.setName("target-width");
targetWidth.setType(ParameterTypeEnum.INT.toString());
targetWidth.setValue(parameterMap.get(key + "-width-amount"));
UnmarshalledParameter targetHeight = new UnmarshalledParameter();
String targetHeightApplyFactor = parameterMap.get(key + "-height-apply-factor");
targetHeight.setApplyFactor(targetHeightApplyFactor == null ? false : Boolean.valueOf(targetHeightApplyFactor));
targetHeight.setName("target-height");
targetHeight.setType(ParameterTypeEnum.INT.toString());
targetHeight.setValue(parameterMap.get(key + "-height-amount"));
UnmarshalledParameter highQuality = new UnmarshalledParameter();
highQuality.setName("high-quality");
highQuality.setType(ParameterTypeEnum.BOOLEAN.toString());
highQuality.setValue(parameterMap.get(key + "-high-quality") == null ? "false" : parameterMap.get(key + "-high-quality"));
UnmarshalledParameter maintainAspectRatio = new UnmarshalledParameter();
maintainAspectRatio.setName("maintain-aspect-ratio");
maintainAspectRatio.setType(ParameterTypeEnum.BOOLEAN.toString());
maintainAspectRatio.setValue(parameterMap.get(key + "-maintain-aspect-ratio") == null ? "false" : parameterMap.get(key + "-maintain-aspect-ratio"));
UnmarshalledParameter reduceOnly = new UnmarshalledParameter();
reduceOnly.setName("reduce-only");
reduceOnly.setType(ParameterTypeEnum.BOOLEAN.toString());
reduceOnly.setValue(parameterMap.get(key + "-reduce-only") == null ? "false" : parameterMap.get(key + "-reduce-only"));
operation.setParameters(new UnmarshalledParameter[] { targetWidth, targetHeight, highQuality, maintainAspectRatio, reduceOnly });
return operation;
}
use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.
the class AlterHSB method buildOperation.
@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
String key = FilterTypeEnum.ALTERHSB.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 hue = new UnmarshalledParameter();
String hueApplyFactor = parameterMap.get(key + "-hue-apply-factor");
hue.setApplyFactor(hueApplyFactor == null ? false : Boolean.valueOf(hueApplyFactor));
hue.setName("hue");
hue.setType(ParameterTypeEnum.FLOAT.toString());
hue.setValue(parameterMap.get(key + "-hue-amount"));
UnmarshalledParameter saturation = new UnmarshalledParameter();
String saturationApplyFactor = parameterMap.get(key + "-saturation-apply-factor");
saturation.setApplyFactor(saturationApplyFactor == null ? false : Boolean.valueOf(saturationApplyFactor));
saturation.setName("saturation");
saturation.setType(ParameterTypeEnum.FLOAT.toString());
saturation.setValue(parameterMap.get(key + "-saturation-amount"));
UnmarshalledParameter brightness = new UnmarshalledParameter();
String brightnessApplyFactor = parameterMap.get(key + "-brightness-apply-factor");
brightness.setApplyFactor(brightnessApplyFactor == null ? false : Boolean.valueOf(brightnessApplyFactor));
brightness.setName("brightness");
brightness.setType(ParameterTypeEnum.FLOAT.toString());
brightness.setValue(parameterMap.get(key + "-brightness-amount"));
operation.setParameters(new UnmarshalledParameter[] { hue, saturation, brightness });
return operation;
}
use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.
the class Crop method buildOperation.
@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
String key = FilterTypeEnum.CROP.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 rectangle = new UnmarshalledParameter();
String rectangleApplyFactor = parameterMap.get(key + "-apply-factor");
rectangle.setApplyFactor(rectangleApplyFactor == null ? false : Boolean.valueOf(rectangleApplyFactor));
rectangle.setName("rectangle");
rectangle.setType(ParameterTypeEnum.RECTANGLE.toString());
StringBuffer sb = new StringBuffer();
sb.append(parameterMap.get(key + "-x-amount"));
sb.append(",");
sb.append(parameterMap.get(key + "-y-amount"));
sb.append(",");
sb.append(parameterMap.get(key + "-width-amount"));
sb.append(",");
sb.append(parameterMap.get(key + "-height-amount"));
rectangle.setValue(sb.toString());
operation.setParameters(new UnmarshalledParameter[] { rectangle });
return operation;
}
use of org.broadleafcommerce.openadmin.server.service.artifact.image.effects.chain.UnmarshalledParameter in project BroadleafCommerce by BroadleafCommerce.
the class GaussianBlur method buildOperation.
@Override
public Operation buildOperation(Map<String, String> parameterMap, InputStream artifactStream, String mimeType) {
String key = FilterTypeEnum.GAUSSIANBLUR.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 kernelSize = new UnmarshalledParameter();
String kernelSizeApplyFactor = parameterMap.get(key + "-kernel-size-apply-factor");
kernelSize.setApplyFactor(kernelSizeApplyFactor == null ? false : Boolean.valueOf(kernelSizeApplyFactor));
kernelSize.setName("kernel-size");
kernelSize.setType(ParameterTypeEnum.INT.toString());
kernelSize.setValue(parameterMap.get(key + "-kernel-size-amount"));
UnmarshalledParameter numOfPasses = new UnmarshalledParameter();
String numOfPassesApplyFactor = parameterMap.get(key + "-num-passes-apply-factor");
numOfPasses.setApplyFactor(numOfPassesApplyFactor == null ? false : Boolean.valueOf(numOfPassesApplyFactor));
numOfPasses.setName("num-passes");
numOfPasses.setType(ParameterTypeEnum.INT.toString());
numOfPasses.setValue(parameterMap.get(key + "-num-passes-amount"));
operation.setParameters(new UnmarshalledParameter[] { kernelSize, numOfPasses });
return operation;
}
Aggregations