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

Java ComposedWordToImage类代码示例

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

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



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

示例1: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
protected void buildInitialFactories() {
    
    com.octo.captcha.component.word.wordgenerator.WordGenerator wordGenerator =
            new com.octo.captcha.component.word.wordgenerator.RandomWordGenerator(
            "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");

    TextPaster textPaster = new NonLinearTextPaster(new Integer(5),
            new Integer(7), new RandomListColorGenerator(new Color[] {Color.BLACK, Color.YELLOW,
            Color.WHITE}), Boolean.TRUE);

    BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator(
            new Integer(200), new Integer(100), Color.CYAN, Color.GRAY);

    FontGenerator fontGenerator = new DeformedRandomFontGenerator(
            new Integer(25), new Integer(30));

    WordToImage wordToImage = new ComposedWordToImage(fontGenerator,
            backgroundGenerator, textPaster);

    this.addFactory(new com.octo.captcha.image.gimpy.GimpyFactory(wordGenerator, wordToImage));
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:22,代码来源:NonLinearTextGimpyEngine.java


示例2: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
protected void buildInitialFactories() {
	WordGenerator wgen = new RandomWordGenerator( AVAILABLE_SYMBOLS );
	RandomRangeColorGenerator cgen = new RandomRangeColorGenerator(
											new int[] {0, 100},
											new int[] {0, 100},
											new int[] {0, 100});
	TextPaster textPaster = new RandomTextPaster( new Integer(5), new Integer(7), cgen, new Boolean(true) );
	
	BackgroundGenerator backgroundGenerator = new FunkyBackgroundGenerator(new Integer(150), new Integer(40));
	
	Font[] fontsList = new Font[] {
		new Font("Arial", 0, 10),
		new Font("Tahoma", 0, 10),
		new Font("Verdana", 0, 10),
	};
	
	FontGenerator fontGenerator = new RandomFontGenerator(new Integer(20), new Integer(25), fontsList);
	
	WordToImage wordToImage = new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster);
	this.addFactory(new GimpyFactory(wgen, wordToImage));
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:22,代码来源:XCureImageCaptchaEngine.java


示例3: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
protected void buildInitialFactories() {
	// 随机生成的字符
	WordGenerator wgen = new RandomWordGenerator("abcdefghijklmnopqrstuvwxyz123456789");
	RandomRangeColorGenerator cgen = new RandomRangeColorGenerator(new int[] { 0, 100 }, new int[] { 0, 100 }, new int[] { 0,
			100 });
	// 文字显示的个数
	TextPaster textPaster = new RandomTextPaster(new Integer(4), new Integer(4), cgen, true);
	// 图片的大小
	// BackgroundGenerator backgroundGenerator = new
	// FunkyBackgroundGenerator(new Integer(80), new Integer(25));
	BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator(new Integer(80), new Integer(25), Color.gray,
			Color.white);
	// 字体格式
	Font[] fontsList = new Font[] { new Font("Arial", 0, 10), new Font("Tahoma", 0, 10), new Font("Verdana", 0, 10), };
	// 文字的大小
	FontGenerator fontGenerator = new RandomFontGenerator(new Integer(15), new Integer(16), fontsList);

	WordToImage wordToImage = new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster);

	this.addFactory(new GimpyFactory(wgen, wordToImage));
}
 
开发者ID:8090boy,项目名称:gomall.la,代码行数:22,代码来源:MyImageCaptchaEngine.java


示例4: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
/**
 * 验证码图片生成
 */
@Override
protected void buildInitialFactories() {
	FontGenerator fontGenerator = new RandomFontGenerator(MIN_FONT_SIZE, MAX_FONT_SIZE, FONTS);
	BackgroundGenerator backgroundGenerator = new GradientBackgroundGenerator(IMAGE_WIDTH, IMAGE_HEIGHT,
			new RandomListColorGenerator(BGCOLORS), new RandomListColorGenerator(BGCOLORS));
	TextPaster textPaster = new DecoratedRandomTextPaster(MIN_WORD_LENGTH, MAX_WORD_LENGTH,
			new RandomListColorGenerator(COLORS), new TextDecorator[] {});
	addFactory(new GimpyFactory(new RandomWordGenerator(CHAR_STRING),
			new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)));
}
 
开发者ID:wenjian-li,项目名称:spring_mybatis_shiro,代码行数:14,代码来源:CaptchaTool.java


示例5: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
/**
 * 验证码图片生成
 */
@Override
protected void buildInitialFactories() {
	FontGenerator fontGenerator = new RandomFontGenerator(MIN_FONT_SIZE, MAX_FONT_SIZE, FONTS);
	BackgroundGenerator backgroundGenerator = new FileReaderRandomBackgroundGenerator(IMAGE_WIDTH, IMAGE_HEIGHT, new ClassPathResource(BACKGROUND_IMAGE_PATH).getPath());
	TextPaster textPaster = new DecoratedRandomTextPaster(MIN_WORD_LENGTH, MAX_WORD_LENGTH, new RandomListColorGenerator(COLORS), new TextDecorator[] {});
	addFactory(new GimpyFactory(new RandomWordGenerator(CHAR_STRING), new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)));
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:11,代码来源:CaptchaEngine.java


示例6: createCaptchaEngine

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
@Override
public CaptchaEngine createCaptchaEngine(CaptchaModel captcha) {
    return new ListImageCaptchaEngine() {
        @Override
        protected void buildInitialFactories() {
            FontGenerator fontGenerator = new RandomFontGenerator(captcha.getFontMin(), captcha.getFontMax(), getFonts());
            BackgroundGenerator backgroundGenerator = createBackgroundGenerator(captcha.getWidth(), captcha.getHeight(), captcha.getBackground());
            TextPaster textPaster = new RandomTextPaster(captcha.getLength(), captcha.getLength(),
                    new RandomRangeColorGenerator(new int[]{0, 100}, new int[]{0, 100}, new int[]{0, 100}), true);
            addFactory(new GimpyFactory(new RandomWordGenerator(captcha.getChars()),
                    new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster)));
        }
    };
}
 
开发者ID:heisedebaise,项目名称:ranch,代码行数:15,代码来源:EngineFactoryImpl.java


示例7: wordToImage

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
@Bean
public WordToImage wordToImage() {
	ColorGenerator fontColorGenerator = new RandomRangeColorGenerator(new int[] { 128, 255 },
			new int[] { 128, 255 }, new int[] { 128, 255 });
	ColorGenerator backgroundColorGenerator = new RandomRangeColorGenerator(new int[] { 0, 127 },
			new int[] { 0, 127 }, new int[] { 0, 127 });
	return new ComposedWordToImage(new RandomFontGenerator(12, 20, new Font[] { new Font("Arial", 0, 1) }),
			new UniColorBackgroundGenerator(90, 34, backgroundColorGenerator),
			new SimpleTextPaster(4, 4, fontColorGenerator));
}
 
开发者ID:xiangxik,项目名称:java-platform,代码行数:11,代码来源:CaptchaConfiguration.java


示例8: main

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
    TextPaster paster = new SimpleTextPaster(new Integer(8),
            new Integer(8), Color.white);
    BackgroundGenerator back = new FileReaderRandomBackgroundGenerator(
            new Integer(200), new Integer(100),
            "/gimpybackgrounds");
    FontGenerator font = new TwistedAndShearedRandomFontGenerator(
            new Integer(30), null);
    WordGenerator words = new DummyWordGenerator("JCAPTCHA");
    WordToImage word2image = new ComposedWordToImage(font, back, paster);
    ImageCaptchaFactory factory = new GimpyFactory(words, word2image);
    ImageCaptcha pix = factory.getImageCaptcha();
    ImageToFile.serialize(pix.getImageChallenge(), new File(args[0]));
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:15,代码来源:LogoGenerator.java


示例9: buildInitialFactories

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

	RandomListColorGenerator randomListColorGenerator = new RandomListColorGenerator(RANDOM_COLOR);

	BackgroundGenerator backgroundGenerator = new FileReaderRandomBackgroundGenerator(IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_PATH);

	WordGenerator wordGenerator = new RandomWordGenerator(RANDOM_WORD);

	FontGenerator fontGenerator = new RandomFontGenerator(MIN_FONT_SIZE, MAX_FONT_SIZE, RANDOM_FONT);

	TextDecorator[] textDecorator = new TextDecorator[] {};

	TextPaster textPaster = new DecoratedRandomTextPaster(MIN_WORD_LENGTH, MAX_WORD_LENGTH, randomListColorGenerator, textDecorator);

	WordToImage wordToImage = new ComposedWordToImage(fontGenerator, backgroundGenerator, textPaster);

	addFactory(new GimpyFactory(wordGenerator, wordToImage));
}
 
开发者ID:wangko27,项目名称:SelfSoftShop,代码行数:20,代码来源:CaptchaEngine.java


示例10: wordtoimage

import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage; //导入依赖的package包/类
@Bean
public ComposedWordToImage wordtoimage() {
    return new ComposedWordToImage(fontGenRandom(), backGenUni(), simpleWhitePaster());
}
 
开发者ID:omerg,项目名称:spring-mvc-base,代码行数:5,代码来源:CaptchaConfiguration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Address类代码示例发布时间:2022-05-22
下一篇:
Java OFTableFeaturePropExperimenter类代码示例发布时间: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