Interface Colorable<T extends Drawable<T>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.awt.Color getColor()
      Get the current color of an element as a Color
      void internalSetColor​(java.awt.Color color)  
      default T setColor​(int hex)
      Set the color of this to the specified color.
      default T setColor​(int r, int g, int b)
      Set the color of this to the specified color.
      default T setColor​(int r, int g, int b, int a)
      Set the color of this to the specified color See Wikipedia for how this works.
      default T setColor​(java.awt.Color color)
      Set the color of the object with a Color object.
      default T setColor​(java.lang.String name)
      Set the color of the object with a hue name or hex code.
      default T setColor​(Hue hue)
      Set the color of the object with a Hue object.
      • Methods inherited from interface paintingcanvas.animation.Animatable

        Modifier and Type Method Description
        default AnimationBuilder colorTo​(int hex, double duration)
        Change the color of this to the specified color over duration seconds.
        default AnimationBuilder colorTo​(int r, int g, int b, double duration)
        Change the color of this to the specified color over duration seconds.
        default AnimationBuilder colorTo​(int r, int g, int b, int a, double duration)
        Change the color of this to the specified color over duration seconds.
        default AnimationBuilder colorTo​(java.awt.Color color, double duration)
        Change the color of this to the specified color over duration seconds.
        default AnimationBuilder colorTo​(java.lang.String name, double duration)
        Change the color of this to the specified color over duration seconds.
        default AnimationBuilder colorTo​(Hue hue, double duration)
        Change the color of this to the specified color over duration seconds.
        Drawable<?> drawable()
        Get the Drawable element from this Animatable.
        default AnimationBuilder fadeIn​(double duration)
        Fade this in over duration seconds.
        default AnimationBuilder fadeOut​(double duration)
        Fade this out over duration seconds.
        default AnimationBuilder moveBy​(int x, int y, double duration)
        Move this by the specified x and y over duration seconds.
        default AnimationBuilder moveHorizontalBy​(int x, double duration)
        Move this by the specified x horizontally over duration seconds.
        default AnimationBuilder moveTo​(int x, int y, double duration)
        Move this to the specified x and y over duration seconds
        default AnimationBuilder moveVerticalBy​(int y, double duration)
        Move this by the specified y vertically over duration seconds.
        default AnimationBuilder rotateBy​(int angle, double duration)
        Rotate this by angle degrees over duration seconds.
        default AnimationBuilder rotateTo​(int angle, double duration)
        Rotate this to the specified angle degrees over duration seconds.
      • Methods inherited from interface paintingcanvas.drawable.Drawable

        Modifier and Type Method Description
        default AnimationBuilder animate()
        Start animating this object.
        default T bringToFront()
        Brings the object in front of all other objects.
        java.awt.Point center​(java.awt.Graphics2D g)
        Get the object's centerpoint
        default Drawable<?> drawable()
        Get the Drawable element from this Animatable.
        default void erase()
        Erase this object from the canvas.
        int getLayer()
        Gets the current layer of the object.
        T getThis()  
        T hide()
        Hide the Object.
        void internalSetLayer​(int layer)  
        void render​(java.awt.Graphics2D g)
        Actually render the object itself
        default T sendToBack()
        Puts the object behind all other objects.
        default T setLayer​(int layer)
        Puts the object on a specific layer.
        T show()
        Show the Object
    • Method Detail

      • internalSetColor

        void internalSetColor​(java.awt.Color color)
      • getColor

        java.awt.Color getColor()
        Get the current color of an element as a Color
        Returns:
        the Color of the element
      • setColor

        default T setColor​(java.awt.Color color)
        Set the color of the object with a Color object.
        
         Circle o = new Circle(100, 100, 20);
         o.setColor(Color.RED); // Set color to red
         
        Parameters:
        color - color.
        Returns:
        the original object to allow method chaining
      • setColor

        default T setColor​(int hex)
        Set the color of this to the specified color. See Wikipedia for how this works.
        
         Circle o = new Circle(100, 100, 20);
         // 0xFF0000 is hex for (255, 0, 0), which is red
         o.setColor(0xFF0000);
         
        Parameters:
        hex - the number describing the RGB color
        Returns:
        the original object to allow method chaining
      • setColor

        default T setColor​(Hue hue)
        Set the color of the object with a Hue object.
        
         Circle o = new Circle(100, 100, 20);
         o.setColor(Hue.GREEN); // Set color to red
         
        Parameters:
        hue - the hue
        Returns:
        the original object to allow method chaining
      • setColor

        default T setColor​(java.lang.String name)
        Set the color of the object with a hue name or hex code.
        Parameters:
        name - the string describing the hue or the hex code
        Returns:
        the original object to allow method chaining
        See Also:
        Misc.stringToColor(String)
      • setColor

        default T setColor​(int r,
                           int g,
                           int b)
        Set the color of this to the specified color. See Wikipedia for how this works.
        
         Circle o = new Circle(100, 100, 20);
         o.setColor(255, 0, 0); // Set color to red
         
        Parameters:
        r - red (0-255)
        g - green (0-255)
        b - blue (0-255)
        Returns:
        the original object to allow method chaining
      • setColor

        default T setColor​(int r,
                           int g,
                           int b,
                           int a)
        Set the color of this to the specified color See Wikipedia for how this works.
        
         Circle o = new Circle(100, 100, 20);
         o.setColor(255, 0, 0); // Set color to red
         
        Parameters:
        r - red (0-255)
        g - green (0-255)
        b - blue (0-255)
        a - alpha (0-255)
        Returns:
        the original object to allow method chaining