- 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.graphical.HeightAccessor
HeightAccessor.HeightBuilder<B extends HeightAccessor.HeightBuilder<B>>, HeightAccessor.HeightMutator, HeightAccessor.HeightProperty
-
Nested classes/interfaces inherited from interface org.refcodes.graphical.Pixmap
Pixmap.PixmapBuilder<PX,B extends Pixmap.PixmapBuilder<PX,B>>, Pixmap.PixmapMutator<PX>, Pixmap.PixmapProperty<PX>
-
Nested classes/interfaces inherited from interface org.refcodes.graphical.RgbPixmap
RgbPixmap.RgbPixmapBuilder, RgbPixmap.RgbPixmapMutator, RgbPixmap.RgbPixmapProperty
-
Nested classes/interfaces inherited from interface org.refcodes.graphical.WidthAccessor
WidthAccessor.WidthBuilder<B extends WidthAccessor.WidthBuilder<B>>, WidthAccessor.WidthMutator, WidthAccessor.WidthProperty
-
-
Constructor Summary
Constructors Constructor Description RgbPixmapImpl()Instantiates a new rgb pixmap impl.RgbPixmapImpl(int aWidth, int aHeight)Instantiates a new rgb pixmap impl.RgbPixmapImpl(BufferedImage aImage)Constructs aRgbPixmapfrom the givenBufferedImage.RgbPixmapImpl(BufferedImage aImage, int aWidth, int aHeight)Constructs aRgbPixmapfrom the givenBufferedImageand the given dimension for the resulting pixmap.RgbPixmapImpl(File aImageFile)RgbPixmapImpl(File aImageFile, int aWidth, int aHeight)RgbPixmapImpl(InputStream aImageInputStream)Constructs aRgbPixmapfrom the given imageInputStream.RgbPixmapImpl(InputStream aImageInputStream, int aWidth, int aHeight)Constructs aRgbPixmapfrom the given imageInputStreamand the given dimension for the resulting pixmap.RgbPixmapImpl(URL aImageUrl)RgbPixmapImpl(URL aImageUrl, int aWidth, int aHeight)RgbPixmapImpl(RgbPixel[][] aPixels)Instantiates a new rgb pixmap impl.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHeight()Retrieves the height of thePixmap.RgbPixelgetPixelAt(int aPosX, int aPosY)Retrieves a pixel at a given position.RgbPixel[][]getPixels()Returns the two dimensional pixels array representing the pixmap.intgetWidth()Retrieves the width of thePixmap.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.graphical.Pixmap
hasPixelAt
-
Methods inherited from interface org.refcodes.graphical.RgbPixmap
getColorAt, getRgbAt
-
-
-
-
Field Detail
-
_pixels
protected RgbPixel[][] _pixels
-
-
Constructor Detail
-
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 widthaHeight- the height
-
RgbPixmapImpl
public RgbPixmapImpl(BufferedImage aImage)
Constructs aRgbPixmapfrom the givenBufferedImage.- Parameters:
aImage- the image from which to get the pixmap.
-
RgbPixmapImpl
public RgbPixmapImpl(URL aImageUrl) throws IOException
- 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
- Parameters:
aImageFile- the imageFilefrom which to get the pixmap.- Throws:
IOException- thrown in case reading the image encountered problems.
-
RgbPixmapImpl
public RgbPixmapImpl(InputStream aImageInputStream) throws IOException
Constructs aRgbPixmapfrom the given imageInputStream.- Parameters:
aImageInputStream- the imageInputStreamfrom 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
- 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
- Parameters:
aImageFile- the imageFilefrom 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 aRgbPixmapfrom the given imageInputStreamand the given dimension for the resulting pixmap.- Parameters:
aImageInputStream- the imageInputStreamfrom 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 aRgbPixmapfrom the givenBufferedImageand 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 Detail
-
getPixels
public RgbPixel[][] getPixels()
Returns the two dimensional pixels array representing the pixmap.
-
getWidth
public int getWidth()
Retrieves the width of thePixmap.
-
getHeight
public int getHeight()
Retrieves the height of thePixmap.
-
getPixelAt
public RgbPixel getPixelAt(int aPosX, int aPosY) throws IndexOutOfBoundsException
Retrieves a pixel at a given position.- Specified by:
getPixelAtin interfacePixmap<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
- Throws:
IndexOutOfBoundsException- in case the index is out of bounds.
-
-