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 arrayintReturn the image heightintReturn the number of image levelsgetType()Return the image format typeintgetWidth()Return the image widthbooleanReturn whether the image includes alpha (1 - transparency) componentsbooleanReturn whether the image should be treated as grayscalevoidsetBuffer(ByteBuffer buffer) Set the image buffervoidsetBuffer(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 arenullIllegalArgumentException- 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 arenullIllegalArgumentException- 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 isnullIllegalArgumentException- if the buffer is insufficiently sized
-
setBuffer
Set the image buffer array- Parameters:
buffer- The image buffer- Throws:
NullPointerException- if the argument buffer isnullIllegalArgumentException- if the buffer is insufficiently sized
-
toString
-