• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TransformFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getDistortedImage

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
/**
 * Applies distortion by adding water ripple effect.
 *
 * @param baseImage the base image
 * @return the distorted image
 */
public BufferedImage getDistortedImage(BufferedImage baseImage)
{
	NoiseProducer noiseProducer = getConfig().getNoiseImpl();
	BufferedImage distortedImage = new BufferedImage(baseImage.getWidth(),
			baseImage.getHeight(), BufferedImage.TYPE_INT_ARGB);

	Graphics2D graphics = (Graphics2D) distortedImage.getGraphics();

	RippleFilter rippleFilter = new RippleFilter();
	rippleFilter.setWaveType(RippleFilter.SINE);
	rippleFilter.setXAmplitude(2.6f);
	rippleFilter.setYAmplitude(1.7f);
	rippleFilter.setXWavelength(15);
	rippleFilter.setYWavelength(5);
	rippleFilter.setEdgeAction(TransformFilter.NEAREST_NEIGHBOUR);

	WaterFilter waterFilter = new WaterFilter();
	waterFilter.setAmplitude(1.5f);
	waterFilter.setPhase(10);
	waterFilter.setWavelength(2);

	BufferedImage effectImage = waterFilter.filter(baseImage, null);
	effectImage = rippleFilter.filter(effectImage, null);

	graphics.drawImage(effectImage, 0, 0, null, null);

	graphics.dispose();

	noiseProducer.makeNoise(distortedImage, .1f, .1f, .25f, .25f);
	noiseProducer.makeNoise(distortedImage, .1f, .25f, .5f, .9f);
	return distortedImage;
}
 
开发者ID:ycaihua,项目名称:kaptcha,代码行数:39,代码来源:WaterRipple.java


示例2: doTransform

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
    if(filter == null) {
        filter = new Sphere3DFilter();
    }

    filter.setAlpha(alpha.getValueAsPercentage());
    filter.setBeta(beta.getValueAsPercentage());
    filter.setGamma(gamma.getValueAsPercentage());

    filter.setCenterX(center.getRelativeX());
    filter.setCenterY(center.getRelativeY());
    filter.setInterpolation(interpolation.getValue());
    filter.setEdgeAction(TransformFilter.TRANSPARENT);

    dest = filter.filter(src, dest);
    return dest;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:19,代码来源:Sphere3D.java


示例3: doTransform

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
@Override
    public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
        if (filter == null) {
            filter = new MirrorFilter();
        }

        filter.setType(type.getValue());
        filter.setCenterX(center.getRelativeX());
        filter.setCenterY(center.getRelativeY());

        filter.setEdgeAction(edgeAction.getValue());
//        filter.setInterpolation(interpolation.getValue());

        filter.setInterpolation(TransformFilter.NEAREST_NEIGHBOUR);

        dest = filter.filter(src, dest);
        return dest;
    }
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:19,代码来源:Mirror.java


示例4: doTransform

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
    if(filter == null) {
        filter = new SliceFilter();
    }

    filter.setOffset(offset.getValue());
    filter.setShiftHorizontal(shiftH.getValueAsPercentage());
    filter.setShiftVertical(shiftV.getValueAsPercentage());
    filter.setSize(size.getValue());
    filter.setEdgeAction(edgeAction.getValue());
    filter.setInterpolation(TransformFilter.NEAREST_NEIGHBOUR); // no difference

    dest = filter.filter(src, dest);
    return dest;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:17,代码来源:Slice.java


示例5: testTransformFilter

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
private static void testTransformFilter(BufferedImage image, FilterWrapper filterWrapper) {
    filterWrapper.setInterpolation(TransformFilter.NEAREST_NEIGHBOUR);
    double timeNN = testFilter("NEAREST_NEIGHBOUR", filterWrapper, image);
    System.out.println();

    filterWrapper.setInterpolation(TransformFilter.NEAREST_NEIGHBOUR_OLD);
    double timeNNOld = testFilter("NEAREST_NEIGHBOUR_OLD", filterWrapper, image);
    double percentOfOld = timeNN * 100.0/ timeNNOld;
    System.out.println(String.format("(%.2f %%)", percentOfOld));

    filterWrapper.setInterpolation(TransformFilter.BILINEAR);
    double timeBL = testFilter("BILINEAR", filterWrapper, image);
    System.out.println();

    filterWrapper.setInterpolation(TransformFilter.BILINEAR_OLD);
    double timeBLOLD = testFilter("BILINEAR_OLD", filterWrapper, image);
    percentOfOld = timeBL * 100.0/ timeBLOLD;
    System.out.println(String.format("(%.2f %%)", percentOfOld));
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:20,代码来源:PerformanceTests.java


示例6: getDistortedImage

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
BufferedImage getDistortedImage(BufferedImage baseImage) {
	RippleFilter rippleFilter = new RippleFilter();
	rippleFilter.setWaveType(RippleFilter.SINE);
	rippleFilter.setXAmplitude(2f + r.nextFloat());
	rippleFilter.setYAmplitude(4f + r.nextFloat() * 3);
	rippleFilter.setXWavelength(4);
	rippleFilter.setYWavelength((9f + r.nextFloat() * 5) * (r.nextInt(2) == 0 ? -1 : 1));
	rippleFilter.setEdgeAction(TransformFilter.ZERO);

	BufferedImage effectImage = rippleFilter.filter(baseImage, null);

	BufferedImage distortedImage = new BufferedImage(baseImage.getWidth(),
					baseImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
	Graphics graphics = distortedImage.getGraphics();
	graphics.drawImage(effectImage, 0, 0, null, null);
	graphics.dispose();

	return distortedImage;
}
 
开发者ID:myshzzx,项目名称:mlib,代码行数:20,代码来源:Captcha.java


示例7: doTransform

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
@Override
public BufferedImage doTransform(BufferedImage src, BufferedImage dest) {
    if (filter == null) {
        filter = new OffsetFilter();
    }

    filter.setRelativeX(center.getRelativeX());
    filter.setRelativeY(center.getRelativeY());
    filter.setUseRelative(true);
    filter.setInterpolation(TransformFilter.NEAREST_NEIGHBOUR);

    dest = filter.filter(src, dest);
    return dest;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:15,代码来源:JHOffset.java


示例8: FilterWrapper

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
private FilterWrapper(BufferedImageOp filter, String description) {
    this.filter = filter;
    this.description = description;
    if(filter instanceof TransformFilter) {
        ((TransformFilter)filter).setEdgeAction(TransformFilter.WRAP_AROUND);
    }
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:8,代码来源:PerformanceTests.java


示例9: getDistortedImage

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
/**
 * Applies distortion by adding shadow to the text and also two noises.
 *
 * @param baseImage the base image
 * @return the distorted image
 */
public BufferedImage getDistortedImage(BufferedImage baseImage)
{
	NoiseProducer noiseProducer = getConfig().getNoiseImpl();
	BufferedImage distortedImage = new BufferedImage(baseImage.getWidth(),
			baseImage.getHeight(), BufferedImage.TYPE_INT_ARGB);

	Graphics2D graph = (Graphics2D) distortedImage.getGraphics();

	ShadowFilter shadowFilter = new ShadowFilter();
	shadowFilter.setRadius(10);
	shadowFilter.setDistance(5);
	shadowFilter.setOpacity(1);

	Random rand = new Random();

	RippleFilter rippleFilter = new RippleFilter();
	rippleFilter.setWaveType(RippleFilter.SINE);
	rippleFilter.setXAmplitude(7.6f);
	rippleFilter.setYAmplitude(rand.nextFloat() + 1.0f);
	rippleFilter.setXWavelength(rand.nextInt(7) + 8);
	rippleFilter.setYWavelength(rand.nextInt(3) + 2);
	rippleFilter.setEdgeAction(TransformFilter.BILINEAR);

	BufferedImage effectImage = rippleFilter.filter(baseImage, null);
	effectImage = shadowFilter.filter(effectImage, null);

	graph.drawImage(effectImage, 0, 0, null, null);
	graph.dispose();

	// draw lines over the image and/or text
	noiseProducer.makeNoise(distortedImage, .1f, .1f, .25f, .25f);
	noiseProducer.makeNoise(distortedImage, .1f, .25f, .5f, .9f);

	return distortedImage;
}
 
开发者ID:ycaihua,项目名称:kaptcha,代码行数:42,代码来源:ShadowGimpy.java


示例10: gimp

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
/**
    * Apply a RippleFilter to the image.
    * 
    * @param image The image to be distorted
    */
@Override
   public void gimp(BufferedImage image) {
       RippleFilter filter = new RippleFilter();
       filter.setWaveType(RippleFilter.SINGLEFRAME);
       filter.setXAmplitude(2.6f);
       filter.setYAmplitude(1.7f);
       filter.setXWavelength(15);
       filter.setYWavelength(5);
       
       filter.setEdgeAction(TransformFilter.RANDOMPIXELORDER);

       applyFilter(image, filter);
   }
 
开发者ID:rookiefly,项目名称:simplecaptcha,代码行数:19,代码来源:RippleGimpyRenderer.java


示例11: setInterpolation

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
public void setInterpolation(int interpolation) {
    ((TransformFilter)filter).setInterpolation(interpolation);
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:4,代码来源:PerformanceTests.java


示例12: isTransformFilter

import com.jhlabs.image.TransformFilter; //导入依赖的package包/类
boolean isTransformFilter() {
    return filter instanceof TransformFilter;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:4,代码来源:PerformanceTests.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FcrepoOperationFailedException类代码示例发布时间:2022-05-22
下一篇:
Java EventType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap