当前位置: 首页>>代码示例>>Java>>正文


Java ValueMap.isEmpty方法代码示例

本文整理汇总了Java中org.apache.sling.api.resource.ValueMap.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMap.isEmpty方法的具体用法?Java ValueMap.isEmpty怎么用?Java ValueMap.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.sling.api.resource.ValueMap的用法示例。


在下文中一共展示了ValueMap.isEmpty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {
    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    int brightness = properties.get(KEY_BRIGHTNESS, properties.get(KEY_BRIGHTNESS_ALIAS, 0));
    float contrast = properties.get(KEY_CONTRAST, properties.get(KEY_CONTRAST_ALIAS, 1.0)).floatValue();

    layer.adjust(brightness, contrast);

    return layer;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:17,代码来源:AdjustImageTransformerImpl.java

示例2: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {

    if ((properties == null) || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    Dimension newSize = getResizeDimensions(properties, layer);
    Color color = getColor(properties);
    Layer resized = resize(layer, newSize);

    Layer result = build(newSize, resized, color);

    return result;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:19,代码来源:LetterPillarBoxImageTransformerImpl.java

示例3: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {

    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    float red = normalizeRGB(properties.get(KEY_RED, properties.get(KEY_RED_ALIAS, DEFAULT_SHIFT_VALUE))
            .floatValue());
    float green = normalizeRGB(properties.get(KEY_GREEN, properties.get(KEY_GREEN_ALIAS, DEFAULT_SHIFT_VALUE))
            .floatValue());
    float blue = normalizeRGB(properties.get(KEY_BLUE, properties.get(KEY_BLUE_ALIAS, DEFAULT_SHIFT_VALUE))
            .floatValue());

    int redShift = Math.round(red * MAX_COLOR_VALUE);
    int greenShift = Math.round(green * MAX_COLOR_VALUE);
    int blueShift = Math.round(blue * MAX_COLOR_VALUE);

    BufferedImage image = shift(layer.getImage(), redShift, greenShift, blueShift);

    Layer result = new Layer(image);
    return result;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:27,代码来源:RGBShiftImageTransformerImpl.java

示例4: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {

    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    float alpha = normalizeAlpha(properties.get(KEY_ALPHA, properties.get(KEY_ALPHA_ALIAS, 0.0)).floatValue());

    Color color = getColor(properties);
    Layer filter = new Layer(layer.getWidth(), layer.getHeight(), color);

    BufferedImage image = merge(layer.getImage(), filter.getImage(), alpha);
    Layer result = new Layer(image);
    return result;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:20,代码来源:MultiplyBlendImageTransformerImpl.java

示例5: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {
    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    final boolean smartBounding = properties.get(KEY_SMART_BOUNDING, true);
    final String[] bounds = StringUtils.split(properties.get(KEY_BOUNDS, ""), ",");

    if (bounds.length == NUM_BOUNDS_PARAMS) {
        int x = parseLength(bounds[PARAM_INDEX_X], layer.getWidth());
        int y = parseLength(bounds[PARAM_INDEX_Y], layer.getHeight());

        int width = parseLength(bounds[PARAM_INDEX_WIDTH], layer.getWidth());
        int height = parseLength(bounds[PARAM_INDEX_HEIGHT], layer.getHeight());

        Rectangle rectangle = new Rectangle();

        if (smartBounding) {
            rectangle = this.getSmartBounds(x, y, width, height, layer.getWidth(),
                    layer.getHeight());
        } else {
            rectangle.setBounds(x, y, width, height);
        }

        layer.crop(rectangle);

        if (smartBounding && layer.getWidth() != width || layer.getHeight() != height) {
            log.debug("SmartBounding resulted in an image of an incorrect size (based on crop params). "
                    + "resizing to: [ width: {}, height: {} ]", width, height);
            layer.resize(width, height);
        }
    }

    return layer;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:40,代码来源:CropImageTransformerImpl.java

示例6: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {

    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    String unsharpenMask = StringUtils.trim(properties.get(KEY_UNSHARP_MASK, String.class));

    try {
        if(!unsharpenMask.isEmpty()) {
            String[] param = unsharpenMask.split(",");

            // Support is provided for amount and radius only.
            if(param.length == NUM_SHARPEN_PARAMS) {
                float amount = Float.parseFloat(param[0]);
                float radius = Float.parseFloat(param[1]);
                layer.sharpen(amount, radius);
            } else {
                log.warn("Transform [ {} ] requires 2 parameters.", TYPE);
            }
        }
    } catch (NumberFormatException exception) {
        log.warn("Transform [ {} ] requires floating type values.", TYPE);
        log.error("Exception occured while parsing string to float", exception);
    }
    return layer;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:32,代码来源:SharpenImageTransformerImpl.java

示例7: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(final Layer layer, final ValueMap properties) {
    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);

        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    int degrees = properties.get(KEY_DEGREES, 0) % TOTAL_DEGREES;

    layer.rotate(degrees);

    return layer;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:17,代码来源:RotateImageTransformerImpl.java

示例8: transform

import org.apache.sling.api.resource.ValueMap; //导入方法依赖的package包/类
@Override
public final Layer transform(Layer layer, final ValueMap properties) {

    if (properties == null || properties.isEmpty()) {
        log.warn("Transform [ {} ] requires parameters.", TYPE);
        return layer;
    }

    log.debug("Transforming with [ {} ]", TYPE);

    Double scale = properties.get(KEY_SCALE, 1D);
    String round = StringUtils.trim(properties.get(KEY_ROUND, String.class));

    if (scale == null) {
        log.warn("Could not derive a Double value for key [ {} ] from value [ {} ]",
                KEY_SCALE, properties.get(KEY_SCALE, String.class));
        scale = 1D;
    }

    if (scale != 1D) {

        int currentWidth = layer.getWidth();
        int currentHeight = layer.getHeight();

        double newWidth = scale * currentWidth;
        double newHeight = scale * currentHeight;

        if (StringUtils.equals(ROUND_UP, round)) {
            newWidth = (int) Math.ceil(newWidth);
            newHeight = (int) Math.ceil(newHeight);
        } else if (StringUtils.equals(ROUND_DOWN, round)) {
            newWidth = (int) Math.floor(newWidth);
            newHeight = (int) Math.floor(newHeight);
        } else {
            // "round"
            newWidth = (int) Math.round(newWidth);
            newHeight = (int) Math.round(newHeight);
        }


        // Invoke the ResizeImageTransformer with the new values

        final ValueMap params = new ValueMapDecorator(new HashMap<String, Object>());
        params.put(ResizeImageTransformerImpl.KEY_WIDTH, (int)newWidth);
        params.put(ResizeImageTransformerImpl.KEY_HEIGHT, (int)newHeight);

        layer = resizeImageTransformer.transform(layer, params);
    }

    return layer;
}
 
开发者ID:Adobe-Consulting-Services,项目名称:acs-aem-commons,代码行数:52,代码来源:ScaleImageTransformerImpl.java


注:本文中的org.apache.sling.api.resource.ValueMap.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。