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

Java ImageDeformationByFilters类代码示例

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

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



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

示例1: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
@SuppressWarnings("deprecation")
protected void buildInitialFactories() {
       int minWordLength = 7;
       int maxWordLength = 7;
       int fontSize = 36;
       int imageWidth = 300;
       int imageHeight = 90;
       WordGenerator wordGenerator = new RandomWordGenerator("0123456789ABCDEFGHIJKLTYREWSZabcdefghjkmnpqrstuvwxyz");
       TextPaster randomPaster = new DecoratedRandomTextPaster(
       		minWordLength,
               maxWordLength, 
               new RandomListColorGenerator(new Color[]{
               		new Color(23, 170, 27), new Color(220, 34, 11),
               		new Color(23, 67, 172)}), new TextDecorator[]{});
       BackgroundGenerator background = new UniColorBackgroundGenerator(imageWidth, imageHeight, Color.GREEN);
       FontGenerator font = new RandomFontGenerator(fontSize, fontSize,
               new Font[]{new Font("Calibri", Font.BOLD, fontSize),
                       new Font("Times New Roman", Font.PLAIN, fontSize),
                       new Font("Arial", Font.BOLD, fontSize)});
       ImageDeformation postDef = new ImageDeformationByFilters(new ImageFilter[]{});
       ImageDeformation backDef = new ImageDeformationByFilters(new ImageFilter[]{});
       ImageDeformation textDef = new ImageDeformationByFilters(new ImageFilter[]{});
       WordToImage word2image = new DeformedComposedWordToImage(font,
               background, randomPaster, backDef, textDef, postDef);
       addFactory(new GimpyFactory(wordGenerator, word2image));
   }
 
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:27,代码来源:CFSJCaptchaEngine.java


示例2: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
protected void buildInitialFactories() {
	int minWordLength = 6;
	int maxWordLength = 6;
	int fontSize = 50;
	int imageWidth = 250;
	int imageHeight = 100;

	WordGenerator wordGenerator = new RandomWordGenerator("0123456789abcdefghijklmnopqrstuvwxyz");

	RandomRangeColorGenerator cgen = new RandomRangeColorGenerator(new int[] { 0, 150 }, new int[] { 0, 150 },
			new int[] { 0, 150 });
	LineTextDecorator lineTextDecorator = new LineTextDecorator(1, cgen);// 曲线干扰
	BaffleTextDecorator baffleTextDecorator = new BaffleTextDecorator(2, cgen);// 气泡干扰
	TextDecorator[] textDecorators = new TextDecorator[2];
	textDecorators[0] = lineTextDecorator;
	textDecorators[1] = baffleTextDecorator;
	
	TextPaster randomPaster = new DecoratedRandomTextPaster(minWordLength, maxWordLength,
			new RandomListColorGenerator(
					new Color[] { new Color(23, 170, 27), new Color(220, 34, 11), new Color(23, 67, 172) }),
			textDecorators);
	BackgroundGenerator background = new UniColorBackgroundGenerator(imageWidth, imageHeight, Color.white);
	FontGenerator font = new RandomFontGenerator(fontSize, fontSize,
			new Font[] { new Font("nyala", Font.BOLD, fontSize), new Font("Bell MT", Font.PLAIN, fontSize),
					new Font("Credit valley", Font.BOLD, fontSize) });
	
	ImageDeformation postDef = new ImageDeformationByFilters(new ImageFilter[] {});
	ImageDeformation backDef = new ImageDeformationByFilters(new ImageFilter[] {});
	ImageDeformation textDef = new ImageDeformationByFilters(new ImageFilter[] {});

	WordToImage word2image = new DeformedComposedWordToImage(font, background, randomPaster, backDef, textDef,
			postDef);
	addFactory(new GimpyFactory(wordGenerator, word2image));
}
 
开发者ID:iunet,项目名称:iunet-blog,代码行数:35,代码来源:CaptchaEngineUtil.java


示例3: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
protected void buildInitialFactories() {  
	        int minWordLength = 4;  
	        int maxWordLength = 5;  
	        /*int fontSize = 50;  
	        int imageWidth = 250;  
	        int imageHeight = 100;*/
	        int fontSize = 30;
	        int imageWidth = 120;  
	        int imageHeight = 50;
	        WordGenerator dictionnaryWords = new ComposeDictionaryWordGenerator(new FileDictionary("toddlist"));  
	        
	        // word2image components  
	        TextPaster randomPaster = new DecoratedRandomTextPaster(minWordLength,  
	                maxWordLength, new RandomListColorGenerator(new Color[] {  
	                        new Color(23, 170, 27), new Color(220, 34, 11),  
	                        new Color(23, 67, 172) }), new TextDecorator[] {});  
	       BackgroundGenerator background = new UniColorBackgroundGenerator(
	                imageWidth, imageHeight, Color.white);
//	        ColorGenerator colorGenerator=new RandomListColorGenerator(new Color[]{new Color(235, 234, 235),new Color(255, 255, 255)});
//	        BackgroundGenerator background=new FunkyBackgroundGenerator(imageWidth, imageHeight,colorGenerator);
	        FontGenerator font = new RandomFontGenerator(fontSize, fontSize,  
	                new Font[] { new Font("nyala", Font.BOLD, fontSize),  
	                        new Font("Bell MT", Font.PLAIN, fontSize),  
	                        new Font("Credit valley", Font.BOLD, fontSize) });  
	        ImageDeformation postDef = new ImageDeformationByFilters(  
	                new ImageFilter[] {});  
	        ImageDeformation backDef = new ImageDeformationByFilters(  
	                new ImageFilter[] {});  
	        ImageDeformation textDef = new ImageDeformationByFilters(  
	                new ImageFilter[] {});  
	  
	        WordToImage word2image = new DeformedComposedWordToImage(font,  
	                background, randomPaster, backDef, textDef, postDef);  
	        addFactory(new GimpyFactory(dictionnaryWords, word2image));  
	    }
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:36,代码来源:CaptchaEngineEx.java


示例4: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
@Override
protected void buildInitialFactories() {
	int minWordLength = 4;
	int maxWordLength = 5;
	int fontSize = 40;
	int imageWidth = 250;
	int imageHeight = 60;
	WordGenerator dictionnaryWords = new ComposeDictionaryWordGenerator(
			new FileDictionary("toddlist"));

	// word2image components
	TextPaster randomPaster = new DecoratedRandomTextPaster(minWordLength,
			maxWordLength, new RandomListColorGenerator(new Color[] {
					new Color(23, 170, 27), new Color(220, 34, 11),
					new Color(23, 67, 172) }), new TextDecorator[] {});
	BackgroundGenerator background = new UniColorBackgroundGenerator(
			imageWidth, imageHeight, Color.white);
	FontGenerator font = new RandomFontGenerator(fontSize, fontSize,
			new Font[] { new Font("nyala", Font.BOLD, fontSize),
					new Font("Bell MT", Font.PLAIN, fontSize),
					new Font("Credit valley", Font.BOLD, fontSize) });
	ImageDeformation postDef = new ImageDeformationByFilters(
			new ImageFilter[] {});
	ImageDeformation backDef = new ImageDeformationByFilters(
			new ImageFilter[] {});
	ImageDeformation textDef = new ImageDeformationByFilters(
			new ImageFilter[] {});

	WordToImage word2image = new DeformedComposedWordToImage(font,
			background, randomPaster, backDef, textDef, postDef);
	addFactory(new GimpyFactory(dictionnaryWords, word2image));
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:33,代码来源:GMailEngine.java


示例5: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
@Override
protected void buildInitialFactories() {

    // 图片和字体大小设置
    int minWordLength = 4;
    int maxWordLength = 5;
    int fontSize = 20;
    int imageWidth = 100;
    int imageHeight = 36;

    WordGenerator dictionnaryWords = new ComposeDictionaryWordGenerator(
            new FileDictionary("toddlist"));

    // word2image components
    TextPaster randomPaster = new DecoratedRandomTextPaster(minWordLength,
            maxWordLength, new RandomListColorGenerator(new Color[]{
            new Color(23, 170, 27), new Color(220, 34, 11),
            new Color(23, 67, 172)}), new TextDecorator[]{});
    BackgroundGenerator background = new UniColorBackgroundGenerator(
            imageWidth, imageHeight, Color.white);
    FontGenerator font = new RandomFontGenerator(fontSize, fontSize,
            new Font[]{new Font("nyala", Font.BOLD, fontSize),
                    new Font("Bell MT", Font.PLAIN, fontSize),
                    new Font("Credit valley", Font.BOLD, fontSize)});

    ImageDeformation postDef = new ImageDeformationByFilters(
            new ImageFilter[]{});
    ImageDeformation backDef = new ImageDeformationByFilters(
            new ImageFilter[]{});
    ImageDeformation textDef = new ImageDeformationByFilters(
            new ImageFilter[]{});

    WordToImage word2image = new DeformedComposedWordToImage(font,
            background, randomPaster, backDef, textDef, postDef);

    addFactory(new GimpyFactory(dictionnaryWords, word2image));
}
 
开发者ID:zhanggh,项目名称:mtools,代码行数:38,代码来源:GMailEngine.java


示例6: buildInitialFactories

import com.octo.captcha.component.image.deformation.ImageDeformationByFilters; //导入依赖的package包/类
/**
 * this method should be implemented as folow : <ul> <li>First construct all the factories you want to initialize
 * the gimpy with</li> <li>then call the this.addFactoriy method for each factory</li> </ul>
 */
protected void buildInitialFactories() {
    //build filters
    com.jhlabs.image.SphereFilter sphere = new com.jhlabs.image.SphereFilter();
    com.jhlabs.image.RippleFilter ripple = new com.jhlabs.image.RippleFilter();
    com.jhlabs.image.TwirlFilter twirl = new com.jhlabs.image.TwirlFilter();
    com.jhlabs.image.WaterFilter water = new com.jhlabs.image.WaterFilter();

    ripple.setWaveType(com.jhlabs.image.RippleFilter.NOISE);
    ripple.setXAmplitude(10);
    ripple.setYAmplitude(10);
    ripple.setXWavelength(10);
    ripple.setYWavelength(10);
    ripple.setEdgeAction(com.jhlabs.image.TransformFilter.CLAMP);

    water.setAmplitude(10);
    water.setAntialias(true);
    water.setWavelength(20);

    twirl.setAngle(4);

    sphere.setRefractionIndex(2);

    ImageDeformation rippleDef = new ImageDeformationByFilters(
            new ImageFilter[]{ripple});
    ImageDeformation sphereDef = new ImageDeformationByFilters(
            new ImageFilter[]{sphere});
    ImageDeformation waterDef = new ImageDeformationByFilters(
            new ImageFilter[]{water});
    ImageDeformation twirlDef = new ImageDeformationByFilters(
            new ImageFilter[]{twirl});

    //add background from files
    BackgroundGenerator generator = new FileReaderRandomBackgroundGenerator(
            new Integer(250), new Integer(250),
            "./fisheyebackgrounds");
    addFactory(
            new FishEyeFactory(generator, sphereDef, new Integer(10),
                    new Integer(5)));
    addFactory(
            new FishEyeFactory(generator, rippleDef, new Integer(10),
                    new Integer(5)));
    addFactory(
            new FishEyeFactory(generator, waterDef, new Integer(10),
                    new Integer(5)));
    addFactory(
            new FishEyeFactory(generator, twirlDef, new Integer(10),
                    new Integer(5)));

}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:54,代码来源:SimpleFishEyeEngine.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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