Package org.web3d.image
Class NIOBufferImage
java.lang.Object
org.web3d.image.NIOBufferImage
A representation of an image contained in a
ByteBuffer
.- Version:
- $Revision: 1.4 $
- Author:
- Rex Melton
-
Constructor Summary
ConstructorsConstructorDescriptionNIOBufferImage
(int width, int height, NIOBufferImageType type) ConstructorNIOBufferImage
(int width, int height, NIOBufferImageType type, boolean isGrayScale, ByteBuffer buffer) ConstructorNIOBufferImage
(int width, int height, NIOBufferImageType type, ByteBuffer buffer) Constructor -
Method Summary
Modifier and TypeMethodDescriptionReturn the image buffergetBuffer
(ByteBuffer[] ret_buf) Return the image buffer arrayint
Return the image heightint
Return the number of image levelsgetType()
Return the image format typeint
getWidth()
Return the image widthboolean
Return whether the image includes alpha (1 - transparency) componentsboolean
Return whether the image should be treated as grayscalevoid
setBuffer
(ByteBuffer buffer) Set the image buffervoid
setBuffer
(ByteBuffer[] buffer) Set the image buffer arraytoString()
Return a description of the image
-
Constructor Details
-
NIOBufferImage
Constructor- Parameters:
width
- The image widthheight
- The image heighttype
- The image format type- Throws:
IllegalArgumentException
- if either the width or height arguments are not positive integersNullPointerException
- if the type argument isnull
-
NIOBufferImage
Constructor- Parameters:
width
- The image widthheight
- The image heighttype
- The image format typebuffer
- The image data- Throws:
IllegalArgumentException
- if either the width or height arguments are not positive integersNullPointerException
- if either the type or buffer argument arenull
IllegalArgumentException
- if the buffer is insufficiently sized
-
NIOBufferImage
public NIOBufferImage(int width, int height, NIOBufferImageType type, boolean isGrayScale, ByteBuffer buffer) Constructor- Parameters:
width
- The image widthheight
- The image heighttype
- The image format typeisGrayScale
- Flag indicating that the image should be treated as grayscale, regardless of the formatbuffer
- The image data- Throws:
IllegalArgumentException
- if either the width or height arguments are not positive integersNullPointerException
- if either the type or buffer argument arenull
IllegalArgumentException
- if the buffer is insufficiently sized
-
-
Method Details
-
getWidth
public int getWidth()Return the image width- Returns:
- The image width
-
getHeight
public int getHeight()Return the image height- Returns:
- The image height
-
getType
-
isGrayScale
public boolean isGrayScale()Return whether the image should be treated as grayscale- Returns:
- whether the image should be treated as grayscale
-
hasTransparency
public boolean hasTransparency()Return whether the image includes alpha (1 - transparency) components- Returns:
- whether the image should be treated as having alpha (1 - transparency) components
-
getLevels
public int getLevels()Return the number of image levels- Returns:
- The number of image levels
-
getBuffer
-
getBuffer
Return the image buffer array- Parameters:
ret_buf
-- Returns:
- The image buffer array
-
setBuffer
Set the image buffer- Parameters:
buffer
- The image buffer- Throws:
NullPointerException
- if the argument buffer isnull
IllegalArgumentException
- if the buffer is insufficiently sized
-
setBuffer
Set the image buffer array- Parameters:
buffer
- The image buffer- Throws:
NullPointerException
- if the argument buffer isnull
IllegalArgumentException
- if the buffer is insufficiently sized
-
toString
-