Class RgbPixmapImpl

java.lang.Object
org.refcodes.graphical.RgbPixmapImpl
All Implemented Interfaces:
HeightAccessor, Pixmap<RgbPixel>, RgbPixmap, WidthAccessor
Direct Known Subclasses:
RgbPixmapBuilderImpl

public class RgbPixmapImpl extends Object implements RgbPixmap
The Class RgbPixmapImpl.
Author:
steiner
  • Field Details

    • _pixels

      protected RgbPixel[][] _pixels
  • Constructor Details

    • RgbPixmapImpl

      public RgbPixmapImpl()
      Instantiates a new rgb pixmap impl.
    • RgbPixmapImpl

      public RgbPixmapImpl(RgbPixel[][] aPixels)
      Instantiates a new rgb pixmap impl.
      Parameters:
      aPixels - the pixels
    • RgbPixmapImpl

      public RgbPixmapImpl(int aWidth, int aHeight)
      Instantiates a new rgb pixmap impl.
      Parameters:
      aWidth - the width
      aHeight - the height
    • RgbPixmapImpl

      public RgbPixmapImpl(BufferedImage aImage)
      Constructs a RgbPixmap from the given BufferedImage.
      Parameters:
      aImage - the image from which to get the pixmap.
    • RgbPixmapImpl

      public RgbPixmapImpl(URL aImageUrl) throws IOException
      Constructs a RgbPixmap from the given image's URL.
      Parameters:
      aImageUrl - the image URL from which to get the pixmap.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(File aImageFile) throws IOException
      Constructs a RgbPixmap from the given File.
      Parameters:
      aImageFile - the image File from which to get the pixmap.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(InputStream aImageInputStream) throws IOException
      Constructs a RgbPixmap from the given image InputStream.
      Parameters:
      aImageInputStream - the image InputStream from which to get the pixmap.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(URL aImageUrl, int aWidth, int aHeight) throws IOException
      Constructs a RgbPixmap from the given image's URL and the given dimension for the resulting pixmap.
      Parameters:
      aImageUrl - the image URL from which to get the pixmap.
      aWidth - The width to for the resulting pixmap, -1 if the image's width is to be used.
      aHeight - the height for the resulting pixmap, -1 if the image's height is to be used.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(File aImageFile, int aWidth, int aHeight) throws IOException
      Constructs a RgbPixmap from the given File and the given dimension for the resulting pixmap.
      Parameters:
      aImageFile - the image File from which to get the pixmap.
      aWidth - The width to for the resulting pixmap, -1 if the image's width is to be used.
      aHeight - the height for the resulting pixmap, -1 if the image's height is to be used.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(InputStream aImageInputStream, int aWidth, int aHeight) throws IOException
      Constructs a RgbPixmap from the given image InputStream and the given dimension for the resulting pixmap.
      Parameters:
      aImageInputStream - the image InputStream from which to get the pixmap.
      aWidth - The width to for the resulting pixmap, -1 if the image's width is to be used.
      aHeight - the height for the resulting pixmap, -1 if the image's height is to be used.
      Throws:
      IOException - thrown in case reading the image encountered problems.
    • RgbPixmapImpl

      public RgbPixmapImpl(BufferedImage aImage, int aWidth, int aHeight)
      Constructs a RgbPixmap from the given BufferedImage and the given dimension for the resulting pixmap.
      Parameters:
      aImage - the image from which to get the pixmap.
      aWidth - The width to for the resulting pixmap, -1 if the image's width is to be used.
      aHeight - the height for the resulting pixmap, -1 if the image's height is to be used.
  • Method Details

    • getPixels

      public RgbPixel[][] getPixels()
      Returns the two dimensional pixels array representing the pixmap.
      Specified by:
      getPixels in interface Pixmap<RgbPixel>
      Returns:
      The pixmap array.
    • getWidth

      public int getWidth()
      Retrieves the width of the Pixmap.
      Specified by:
      getWidth in interface Pixmap<RgbPixel>
      Specified by:
      getWidth in interface WidthAccessor
      Returns:
      The width of the Pixmap
    • getHeight

      public int getHeight()
      Retrieves the height of the Pixmap.
      Specified by:
      getHeight in interface HeightAccessor
      Specified by:
      getHeight in interface Pixmap<RgbPixel>
      Returns:
      The height of the Pixmap
    • getPixelAt

      public RgbPixel getPixelAt(int aPosX, int aPosY)
      Retrieves a pixel at a given position.
      Specified by:
      getPixelAt in interface Pixmap<RgbPixel>
      Parameters:
      aPosX - The x position for the pixel to be retrieved.
      aPosY - The y position for the pixel to be retrieved.
      Returns:
      The according pixel