Package play.libs

Class 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      jj.play.ns.nl.captcha.backgrounds.BackgroundProducer background  
      java.util.List<java.awt.Font> fonts  
      jj.play.ns.nl.captcha.gimpy.GimpyRenderer gimpy  
      int h  
      java.awt.Color noise  
      java.lang.String text  
      java.awt.Color textColor  
      int w  
    • 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 it
      java.lang.String getText​(int length)
      Tell the captche to draw a text of the specified size and retrieve it
      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
      java.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
      • Methods inherited from class java.io.InputStream

        available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • Captcha

        public Captcha​(int w,
                       int h)
    • 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 - a String 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 - a String that represents an opaque color as a 24-bit integer
        length - 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 text
        chars - 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 - a String that represents an opaque color as a 24-bit integer
        length - the specified size of the text
        chars - 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 - a String 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 - a String that represents an opaque color use to start the gradient
        to - a String 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 - a String 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 class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException