Interface SpritePixels


  • public interface SpritePixels
    Represents data about the pixels of a sprite image.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void drawAt​(int x, int y)
      Draws the pixels at the given coordinates on the canvas.
      int getHeight()
      Gets the height of the sprite image in pixels.
      int getMaxHeight()
      Gets the max height of the sprite image in pixels.
      int getMaxWidth()
      Gets the max width of the sprite image in pixels.
      int getOffsetX()
      Gets the x offset of the sprite image in pixels.
      int getOffsetY()
      Gets the y offset of the sprite image in pixels.
      int[] getPixels()
      Gets an array of all pixels data in the sprite.
      int getWidth()
      Gets the width of the sprite image in pixels.
      void setMaxHeight​(int maxHeight)
      Sets the max height of the sprite image in pixels.
      void setMaxWidth​(int maxWidth)
      Sets the max width of the sprite image in pixels.
      void setOffsetX​(int offsetX)
      Sets the x offset of the sprite image in pixels.
      void setOffsetY​(int offsetY)
      Sets the y offset of the sprite image in pixels.
      java.awt.image.BufferedImage toBufferedImage()
      Converts the sprite into a BufferedImage.
      void toBufferedImage​(java.awt.image.BufferedImage img)
      Writes the contents of the sprite to the given BufferedImage.
      java.awt.image.BufferedImage toBufferedOutline​(java.awt.Color color)
      Writes the contents of the SpritePixels with chosen outline to the BufferedImage
      void toBufferedOutline​(java.awt.image.BufferedImage img, int color)
      Writes the contents of the SpritePixels with chosen outline to the BufferedImage
    • Method Detail

      • drawAt

        void drawAt​(int x,
                    int y)
        Draws the pixels at the given coordinates on the canvas.
        Parameters:
        x - the x-axis coordinate
        y - the y-axis coordinate
      • getWidth

        int getWidth()
        Gets the width of the sprite image in pixels.
        Returns:
        the width
      • getHeight

        int getHeight()
        Gets the height of the sprite image in pixels.
        Returns:
        the height
      • getMaxWidth

        int getMaxWidth()
        Gets the max width of the sprite image in pixels.
        Returns:
        the width
      • getMaxHeight

        int getMaxHeight()
        Gets the max height of the sprite image in pixels.
        Returns:
        the height
      • getOffsetX

        int getOffsetX()
        Gets the x offset of the sprite image in pixels.
        Returns:
        the offset
      • getOffsetY

        int getOffsetY()
        Gets the y offset of the sprite image in pixels.
        Returns:
        the offset
      • setMaxWidth

        void setMaxWidth​(int maxWidth)
        Sets the max width of the sprite image in pixels.
        Parameters:
        maxWidth - the width
      • setMaxHeight

        void setMaxHeight​(int maxHeight)
        Sets the max height of the sprite image in pixels.
        Parameters:
        maxHeight - the height
      • setOffsetX

        void setOffsetX​(int offsetX)
        Sets the x offset of the sprite image in pixels.
        Parameters:
        offsetX - the offset
      • setOffsetY

        void setOffsetY​(int offsetY)
        Sets the y offset of the sprite image in pixels.
        Parameters:
        offsetY - the offset
      • getPixels

        int[] getPixels()
        Gets an array of all pixels data in the sprite.
        Returns:
        the pixel data
      • toBufferedImage

        java.awt.image.BufferedImage toBufferedImage()
        Converts the sprite into a BufferedImage.
        Returns:
        the resulting BufferedImage
      • toBufferedImage

        void toBufferedImage​(java.awt.image.BufferedImage img)
                      throws java.lang.IllegalArgumentException
        Writes the contents of the sprite to the given BufferedImage.
        Parameters:
        img - the passsed buffered image
        Throws:
        java.lang.IllegalArgumentException - if the width or height do not match
      • toBufferedOutline

        java.awt.image.BufferedImage toBufferedOutline​(java.awt.Color color)
        Writes the contents of the SpritePixels with chosen outline to the BufferedImage
        Parameters:
        color - target color
      • toBufferedOutline

        void toBufferedOutline​(java.awt.image.BufferedImage img,
                               int color)
        Writes the contents of the SpritePixels with chosen outline to the BufferedImage
        Parameters:
        img - target image
        color - target color