Package play.libs
Class Images.Captcha
- java.lang.Object
-
- java.io.InputStream
-
- play.libs.Images.Captcha
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Enclosing class:
- Images
public static class Images.Captcha extends java.io.InputStream
A captcha image.
-
-
Constructor Summary
Constructors Constructor Description Captcha(int w, int h)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Images.Captcha
addNoise()
Add noise to the captcha.Images.Captcha
addNoise(java.lang.String color)
Add noise to the captcha.java.lang.String
getText()
Tell the captche to draw a text and retrieve itjava.lang.String
getText(int length)
Tell the captche to draw a text of the specified size and retrieve itjava.lang.String
getText(int length, java.lang.String chars)
Tell the captche to draw a text of the specified size using specials characters and retrieve itjava.lang.String
getText(java.lang.String color)
Tell the captche to draw a text using the specified color (ex.java.lang.String
getText(java.lang.String color, int length)
Tell the captche to draw a text of the specified size using the specified color (ex.java.lang.String
getText(java.lang.String color, int length, java.lang.String chars)
Tell the captche to draw a text of the specified size using specials characters and a the specified color (ex.int
read()
int
read(byte[] b)
Images.Captcha
setBackground(java.lang.String color)
Set a solid background.Images.Captcha
setBackground(java.lang.String from, java.lang.String to)
Set a gradient background.Images.Captcha
setSquigglesBackground()
Set a squiggles background
-
-
-
Field Detail
-
text
public java.lang.String text
-
background
public jj.play.ns.nl.captcha.backgrounds.BackgroundProducer background
-
gimpy
public jj.play.ns.nl.captcha.gimpy.GimpyRenderer gimpy
-
textColor
public java.awt.Color textColor
-
fonts
public java.util.List<java.awt.Font> fonts
-
w
public int w
-
h
public int h
-
noise
public java.awt.Color noise
-
-
Method Detail
-
getText
public java.lang.String getText()
Tell the captche to draw a text and retrieve it- Returns:
- the given text
-
getText
public java.lang.String getText(java.lang.String color)
Tell the captche to draw a text using the specified color (ex. #000000) and retrieve it- Parameters:
color
- aString
that represents an opaque color as a 24-bit integer- Returns:
- The text to draw
-
getText
public java.lang.String getText(int length)
Tell the captche to draw a text of the specified size and retrieve it- Parameters:
length
- the specified size of the text- Returns:
- The text to draw
-
getText
public java.lang.String getText(java.lang.String color, int length)
Tell the captche to draw a text of the specified size using the specified color (ex. #000000) and retrieve it- Parameters:
color
- aString
that represents an opaque color as a 24-bit integerlength
- the specified size of the text- Returns:
- The text to draw
-
getText
public java.lang.String getText(int length, java.lang.String chars)
Tell the captche to draw a text of the specified size using specials characters and retrieve it- Parameters:
length
- the specified size of the textchars
- List of allowed characters- Returns:
- The text to draw
-
getText
public java.lang.String getText(java.lang.String color, int length, java.lang.String chars)
Tell the captche to draw a text of the specified size using specials characters and a the specified color (ex. #000000)and retrieve it- Parameters:
color
- aString
that represents an opaque color as a 24-bit integerlength
- the specified size of the textchars
- List of allowed characters- Returns:
- The text to draw
-
addNoise
public Images.Captcha addNoise()
Add noise to the captcha.- Returns:
- The given captcha
-
addNoise
public Images.Captcha addNoise(java.lang.String color)
Add noise to the captcha.- Parameters:
color
- aString
that represents an opaque color as a 24-bit integer- Returns:
- The given captcha
-
setBackground
public Images.Captcha setBackground(java.lang.String from, java.lang.String to)
Set a gradient background.- Parameters:
from
- aString
that represents an opaque color use to start the gradientto
- aString
that represents an opaque color use to end the gradient- Returns:
- The given captcha
-
setBackground
public Images.Captcha setBackground(java.lang.String color)
Set a solid background.- Parameters:
color
- aString
that represents an opaque color as a 24-bit integer- Returns:
- The given captcha
-
setSquigglesBackground
public Images.Captcha setSquigglesBackground()
Set a squiggles background- Returns:
- The given captcha
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-