com.octo.captcha.component.image.textpaster
Class NonLinearRandomAngleTextPaster
java.lang.Object
com.octo.captcha.component.image.textpaster.AbstractTextPaster
com.octo.captcha.component.image.textpaster.NonLinearRandomAngleTextPaster
- All Implemented Interfaces:
- TextPaster
public class NonLinearRandomAngleTextPaster
- extends AbstractTextPaster
A TextPaster
that pasts the characters on the background image, turned around a random angle from the
center of the character and past at a random y position.
- Since:
- Nov 11, 2007
Method Summary |
void |
addRenderingHints(java.awt.RenderingHints.Key key,
java.lang.Object value)
Adds RenderingHints for the drawing of the characters. |
protected double |
getRandomAngle()
Returns a random angle between 0 and 360 degrees in radians (inclusive). |
protected void |
pasteCharacter(java.awt.Graphics2D g2d,
java.text.AttributedString character)
Draws a certain character on the BufferedImage with a random angle and y pos. |
java.awt.image.BufferedImage |
pasteText(java.awt.image.BufferedImage background,
java.text.AttributedString attributedWord)
Pastes the attributed string on the backround image and return the final image. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NonLinearRandomAngleTextPaster
public NonLinearRandomAngleTextPaster(java.lang.Integer minAcceptedWordLength,
java.lang.Integer maxAcceptedWordLength,
java.awt.Color textColor)
NonLinearRandomAngleTextPaster
public NonLinearRandomAngleTextPaster(java.lang.Integer minAcceptedWordLength,
java.lang.Integer maxAcceptedWordLength,
ColorGenerator colorGenerator)
NonLinearRandomAngleTextPaster
public NonLinearRandomAngleTextPaster(java.lang.Integer minAcceptedWordLength,
java.lang.Integer maxAcceptedWordLength,
ColorGenerator colorGenerator,
java.lang.Boolean manageColorPerGlyph)
pasteText
public java.awt.image.BufferedImage pasteText(java.awt.image.BufferedImage background,
java.text.AttributedString attributedWord)
throws CaptchaException
- Description copied from interface:
TextPaster
- Pastes the attributed string on the backround image and return the final image. Implementation must take into
account the fact that the text must be readable by human and non by programs
- Returns:
- the final image
- Throws:
CaptchaException
- if any exception accurs during paste routine.- See Also:
TextPaster.pasteText(java.awt.image.BufferedImage, java.text.AttributedString)
pasteCharacter
protected void pasteCharacter(java.awt.Graphics2D g2d,
java.text.AttributedString character)
- Draws a certain character on the
BufferedImage
with a random angle and y pos.
If the characters angle is greater then 90 degrees and lower then 270 degrees, the bottom
of the character will be underlined.
- Parameters:
g2d
- The graphics of the BufferedImage
character
- The character to be drawn
getRandomAngle
protected double getRandomAngle()
- Returns a random angle between 0 and 360 degrees in radians (inclusive).
- Returns:
- a random angle between 0 and 360 degrees in radians
addRenderingHints
public void addRenderingHints(java.awt.RenderingHints.Key key,
java.lang.Object value)
- Adds
RenderingHints
for the drawing of the characters.
- Parameters:
key
- The RenderingHints Keyvalue
- The RenderingHints value
Copyright 2003-2009 JCaptcha. All Rights Reserved.