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


Java FastBlurFilter类代码示例

本文整理汇总了Java中org.jdesktop.swingx.image.FastBlurFilter的典型用法代码示例。如果您正苦于以下问题:Java FastBlurFilter类的具体用法?Java FastBlurFilter怎么用?Java FastBlurFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: filter

import org.jdesktop.swingx.image.FastBlurFilter; //导入依赖的package包/类
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
    if(blurMethod == FAST_BLUR) {
        dst = new FastBlurFilter((int) radius).filter(src, null);
    } else if (blurMethod == BOX3_BLUR) {
        if ((src.getWidth() == 1) || (src.getHeight() == 1)) {
            // otherwise we get ArrayIndexOutOfBoundsException in BoxBlurFilter
            return src;
        }
        dst = new BoxBlurFilter(radius, radius, 3).filter(src, null);
    } else if(blurMethod == GAUSSIAN_BLUR) {
        dst = new GaussianFilter(radius).filter(src, null);
    } else {
        throw new IllegalStateException("blurMethod = " + blurMethod);
    }

    lowerThreshold3 = 255 * 3 * (threshold - softness * 0.5f);
    upperThreshold3 = 255 * 3 * (threshold + softness * 0.5f);
    return super.filter(dst, dst);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:21,代码来源:StampFilter.java

示例2: doTransform

import org.jdesktop.swingx.image.FastBlurFilter; //导入依赖的package包/类
@Override
    public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
        int srcWidth = src.getWidth();
        int srcHeight = src.getHeight();

        dest = ImageUtils.createCompatibleDest(src);
        Graphics2D g2 = dest.createGraphics();
        g2.setColor(BLACK);
        g2.fillRect(0, 0, srcWidth, srcHeight);
        g2.setColor(WHITE);
        g2.setStroke(new BasicStroke(lineWidth.getValueAsFloat()));
        g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON);

        int numPoints = nrPoints.getValue();
        Point[] points = new Point[numPoints];
        double r = radius.getValueAsPercentage() * srcHeight;
        double startAngle = 2 * Math.PI / numPoints * rotate.getValueAsPercentage();
        double cx = srcWidth * center.getRelativeX();
        double cy = srcHeight * center.getRelativeY();

        for (int i = 0; i < points.length; i++) {
            double theta = startAngle + 2 * Math.PI * i / numPoints;
            points[i] = new Point((int) (cx + r * Math.cos(theta)), (int) (cy + r * Math.sin(theta)));
        }
        for (int i = 0; i < points.length; i++) {
            for (int j = 0; j < points.length; j++) {
                if(i > j) { // draw only in one direction
                    g2.drawLine(points[i].x, points[i].y, points[j].x, points[j].y);
                }
            }
        }

        if (glow.isChecked()) {
            BufferedImage copy = ImageUtils.copyImage(dest);
            // TODO FastBlurFilter takes an int as constructor argument - not good for animation
            // BoxBlurFilter on the other hand might be OK
            FastBlurFilter fastBlur = new FastBlurFilter(lineWidth.getValue());
            fastBlur.filter(copy, copy);
            g2.setComposite(new AddComposite(1.0f));
            g2.drawImage(copy, 0, 0, null);

//            GlowFilter glowFilter = new GlowFilter();
//            glowFilter.setRadius(lineWidth.getValue());
//            glowFilter.filter(dest, dest);
        }
        g2.dispose();

        return dest;
    }
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:50,代码来源:MysticRose.java


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