Package com.jogamp.nativewindow.util
Class PixelRectangle.GenericPixelRect
- java.lang.Object
-
- com.jogamp.nativewindow.util.PixelRectangle.GenericPixelRect
-
- All Implemented Interfaces:
PixelRectangle
- Enclosing interface:
- PixelRectangle
public static class PixelRectangle.GenericPixelRect extends Object implements PixelRectangle
Generic PixelRectangle implementation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jogamp.nativewindow.util.PixelRectangle
PixelRectangle.GenericPixelRect
-
-
Constructor Summary
Constructors Constructor Description GenericPixelRect(PixelFormat pixelformat, DimensionImmutable size, int strideInBytes, boolean isGLOriented, ByteBuffer pixels)
GenericPixelRect(PixelRectangle src)
Copy ctor validating src.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PixelFormat
getPixelformat()
Returns thePixelFormat
.ByteBuffer
getPixels()
Returns the pixels.DimensionImmutable
getSize()
Returns the size, i.e.int
getStride()
Returns stride in byte-size, i.e.int
hashCode()
Computes a hash code over: pixelformat size stride isGLOriented pixelsboolean
isGLOriented()
Returnstrue
if the memory is laid out in OpenGL's coordinate system, origin at bottom left.String
toString()
-
-
-
Constructor Detail
-
GenericPixelRect
public GenericPixelRect(PixelFormat pixelformat, DimensionImmutable size, int strideInBytes, boolean isGLOriented, ByteBuffer pixels) throws IllegalArgumentException, IndexOutOfBoundsException
- Parameters:
pixelformat
-size
-strideInBytes
- stride in byte-size, i.e. byte count from one line to the next. If not zero, value must be >=width * bytes-per-pixel
. If zero, stride is set towidth * bytes-per-pixel
.isGLOriented
-pixels
-- Throws:
IllegalArgumentException
- ifstrideInBytes
is invalid.IndexOutOfBoundsException
- ifpixels
has insufficient bytes left
-
GenericPixelRect
public GenericPixelRect(PixelRectangle src) throws IllegalArgumentException, IndexOutOfBoundsException
Copy ctor validating src.- Parameters:
src
-- Throws:
IllegalArgumentException
- ifstrideInBytes
is invalid.IndexOutOfBoundsException
- ifpixels
has insufficient bytes left
-
-
Method Detail
-
hashCode
public int hashCode()
Description copied from interface:PixelRectangle
Computes a hash code over:
- pixelformat
- size
- stride
- isGLOriented
- pixels
The hashCode shall be computed only once with first call and stored for later retrieval to enhance performance.
- Specified by:
hashCode
in interfacePixelRectangle
- Overrides:
hashCode
in classObject
-
getPixelformat
public PixelFormat getPixelformat()
Description copied from interface:PixelRectangle
Returns thePixelFormat
.- Specified by:
getPixelformat
in interfacePixelRectangle
-
getSize
public DimensionImmutable getSize()
Description copied from interface:PixelRectangle
Returns the size, i.e. width and height.- Specified by:
getSize
in interfacePixelRectangle
-
getStride
public int getStride()
Description copied from interface:PixelRectangle
Returns stride in byte-size, i.e. byte count from one line to the next.Must be >=
PixelRectangle.getPixelformat()
.bytesPerPixel()
*PixelRectangle.getSize()
.getWidth()
.- Specified by:
getStride
in interfacePixelRectangle
-
isGLOriented
public boolean isGLOriented()
Description copied from interface:PixelRectangle
Returnstrue
if the memory is laid out in OpenGL's coordinate system, origin at bottom left. Otherwise returnsfalse
, i.e. origin at top left.- Specified by:
isGLOriented
in interfacePixelRectangle
-
getPixels
public ByteBuffer getPixels()
Description copied from interface:PixelRectangle
Returns the pixels.- Specified by:
getPixels
in interfacePixelRectangle
-
toString
public final String toString()
- Specified by:
toString
in interfacePixelRectangle
- Overrides:
toString
in classObject
-
-