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


Java WordToImage类代码示例

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


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

示例1: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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.wordtoimage.WordToImage; //导入依赖的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

示例3: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例4: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例5: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例6: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例7: wordToImage

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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.WordToImage; //导入依赖的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: GimpyFactory

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的package包/类
public GimpyFactory(WordGenerator generator, WordToImage word2image) {
    if (word2image == null) {
        throw new CaptchaException("Invalid configuration" +
                " for a GimpyFactory : WordToImage can't be null");
    }
    if (generator == null) {
        throw new CaptchaException("Invalid configuration" +
                " for a GimpyFactory : WordGenerator can't be null");
    }
    wordToImage = word2image;
    wordGenerator = generator;

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

示例10: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例11: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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

示例12: initialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的package包/类
@Override
public void initialFactories() {
	WordGenerator dictionnaryWords = new RandomWordGenerator(words);
	// wordtoimage components
	TextPaster randomPaster = new GlyphsPaster(4, 4, new RandomListColorGenerator(

	new Color[] { //
			new Color(23, 170, 27),//
					new Color(220, 34, 11), //
					new Color(23, 67, 172) //
			}),

	new GlyphsVisitors[] {//
			new TranslateGlyphsVerticalRandomVisitor(1),//

					new OverlapGlyphsUsingShapeVisitor(3), //
					new TranslateAllToRandomPointVisitor() //
			});
	/*
	 * new TextVisitor[]{ new OverlapGlyphsTextVisitor(6) }, null
	 */

	// int width = this.getWidth();
	// int height = this.getHeight();
	BackgroundGenerator back = new UniColorBackgroundGenerator(width, height, Color.white);

	FontGenerator shearedFont = new RandomFontGenerator(50, 50, //
			new Font[] { new Font("nyala", Font.BOLD, 50), //
					new Font("Bell MT", Font.PLAIN, 50), //
					new Font("Credit valley", Font.BOLD, 50) //
			}, false);

	PinchFilter pinch = new PinchFilter();

	pinch.setAmount(-.5f);
	pinch.setRadius(30);
	pinch.setAngle((float) (Math.PI / 16));
	pinch.setCentreX(0.5f);
	pinch.setCentreY(-0.01f);
	pinch.setEdgeAction(ImageFunction2D.CLAMP);

	PinchFilter pinch2 = new PinchFilter();
	pinch2.setAmount(-.6f);
	pinch2.setRadius(70);
	pinch2.setAngle((float) (Math.PI / 16));
	pinch2.setCentreX(0.3f);
	pinch2.setCentreY(1.01f);
	pinch2.setEdgeAction(ImageFunction2D.CLAMP);

	PinchFilter pinch3 = new PinchFilter();
	pinch3.setAmount(-.6f);
	pinch3.setRadius(70);
	pinch3.setAngle((float) (Math.PI / 16));
	pinch3.setCentreX(0.8f);
	pinch3.setCentreY(-0.01f);
	pinch3.setEdgeAction(ImageFunction2D.CLAMP);

	List<ImageDeformation> textDef = new ArrayList<ImageDeformation>();
	textDef.add(new ImageDeformationByBufferedImageOp(pinch));
	textDef.add(new ImageDeformationByBufferedImageOp(pinch2));
	textDef.add(new ImageDeformationByBufferedImageOp(pinch3));

	// word2image 1
	WordToImage word2image = new DeformedComposedWordToImage(false, shearedFont, back, randomPaster, new ArrayList<ImageDeformation>(), new ArrayList<ImageDeformation>(), textDef

	);

	this.addFactory(new GimpyFactory(dictionnaryWords, word2image, false));
}
 
开发者ID:tanhaichao,项目名称:leopard,代码行数:70,代码来源:CaptchaEngineImpl.java

示例13: getWordToImage

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的package包/类
public WordToImage getWordToImage() {
    return wordToImage;
}
 
开发者ID:pengqiuyuan,项目名称:g2,代码行数:4,代码来源:GimpyFactory.java

示例14: buildInitialFactories

import com.octo.captcha.component.image.wordtoimage.WordToImage; //导入依赖的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


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