Package com.jogamp.nativewindow.util
Class PixelFormatUtil
java.lang.Object
com.jogamp.nativewindow.util.PixelFormatUtil
Pixel Rectangle Utilities.
All conversion methods are endian independent.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconvert(int width, int height, ByteBuffer src_bb, PixelFormat src_fmt, boolean src_glOriented, int src_lineStride, ByteBuffer dst_bb, PixelFormat dst_fmt, boolean dst_glOriented, int dst_lineStride) static voidconvert(PixelFormatUtil.ComponentMap cmap, PixelFormat.Composition dstComp, com.jogamp.common.util.Bitstream<ByteBuffer> dstBitStream, PixelFormat.Composition srcComp, com.jogamp.common.util.Bitstream<ByteBuffer> srcBitStream) static PixelRectangleconvert(PixelRectangle src, PixelFormat destFmt, int ddestStride, boolean isGLOriented, boolean destIsDirect) static voidconvert(PixelRectangle src, ByteBuffer dst_bb, PixelFormat dst_fmt, boolean dst_glOriented, int dst_lineStride) static intconvertToInt32(PixelFormat dst_fmt, byte r, byte g, byte b, byte a) static intconvertToInt32(PixelFormat dest_fmt, PixelFormat src_fmt, int src_pixel) static intconvertToInt32(PixelFormat dst_fmt, PixelFormat src_fmt, ByteBuffer src, int srcOff) static final intfind(PixelFormat.CType s, PixelFormat.CType[] pool, boolean mapRGB2Y) static PixelFormatgetReversed(PixelFormat fmt) Returns thePixelFormatwith reversed components offmt.static intgetShiftedI32(int bytesPerPixel, byte[] data, int offset) Returns shifted bytes from the givendataat givenoffsetof maximal 4bytesPerPixel.static intgetShiftedI32(int bytesPerPixel, ByteBuffer data, boolean retainDataPos) Returns shifted bytes from the givendataat current position of maximal 4bytesPerPixel.static longgetShiftedI64(int bytesPerPixel, byte[] data, int offset) Returns shifted bytes from the givendataat givenoffsetof maximal 8bytesPerPixel.static longgetShiftedI64(int bytesPerPixel, ByteBuffer data, boolean retainDataPos) Returns shifted bytes from the givendataat current position of maximal 8bytesPerPixel.
-
Constructor Details
-
PixelFormatUtil
public PixelFormatUtil()
-
-
Method Details
-
find
-
getShiftedI32
public static int getShiftedI32(int bytesPerPixel, byte[] data, int offset) Returns shifted bytes from the givendataat givenoffsetof maximal 4bytesPerPixel.- Parameters:
bytesPerPixel- number of bytes per pixel to fetch, a maximum of 4 are alloweddata- byte buffer covering complete pixel at positionoffsetoffset- byte offset of pixeldatastart- Returns:
- the shifted 32bit integer value of the pixel
-
getShiftedI64
public static long getShiftedI64(int bytesPerPixel, byte[] data, int offset) Returns shifted bytes from the givendataat givenoffsetof maximal 8bytesPerPixel.- Parameters:
bytesPerPixel- number of bytes per pixel to fetch, a maximum of 4 are alloweddata- byte buffer covering complete pixel at positionoffsetoffset- byte offset of pixeldatastart- Returns:
- the shifted 64bit integer value of the pixel
-
getShiftedI32
Returns shifted bytes from the givendataat current position of maximal 4bytesPerPixel.- Parameters:
bytesPerPixel- number of bytes per pixel to fetch, a maximum of 4 are alloweddata- byte buffer covering complete pixel at positionoffsetretainDataPos- if true, absoluteByteBuffer.get(int)is used and thedataposition stays unchanged. Otherwise relativeByteBuffer.get()is used and thedataposition changes.- Returns:
- the shifted 32bit integer value of the pixel
-
getShiftedI64
Returns shifted bytes from the givendataat current position of maximal 8bytesPerPixel.- Parameters:
bytesPerPixel- number of bytes per pixel to fetch, a maximum of 4 are alloweddata- byte buffer covering complete pixel at positionoffsetretainDataPos- if true, absoluteByteBuffer.get(int)is used and thedataposition stays unchanged. Otherwise relativeByteBuffer.get()is used and thedataposition changes.- Returns:
- the shifted 64bit integer value of the pixel
-
getReversed
Returns thePixelFormatwith reversed components offmt. If no reversedPixelFormatis available, returnsfmt. -
convertToInt32
-
convertToInt32
public static int convertToInt32(PixelFormat dst_fmt, PixelFormat src_fmt, ByteBuffer src, int srcOff) -
convertToInt32
-
convert
public static PixelRectangle convert(PixelRectangle src, PixelFormat destFmt, int ddestStride, boolean isGLOriented, boolean destIsDirect) -
convert
public static void convert(PixelRectangle src, ByteBuffer dst_bb, PixelFormat dst_fmt, boolean dst_glOriented, int dst_lineStride) throws IllegalStateException - Parameters:
src-dst_bb-ByteBuffersinkdst_fmt- destinationPixelFormatdst_glOriented- if true, the source memory is laid out in OpenGL's coordinate system, origin at bottom left, otherwise origin at top left.dst_lineStride- line stride in byte-size for destination, i.e. byte count from one line to the next. Must be >=dst_fmt.comp.bytesPerPixel()* width orzerofor default stride.- Throws:
IllegalStateExceptionIllegalArgumentException- ifsrc_lineStrideordst_lineStrideis invalid
-
convert
public static void convert(int width, int height, ByteBuffer src_bb, PixelFormat src_fmt, boolean src_glOriented, int src_lineStride, ByteBuffer dst_bb, PixelFormat dst_fmt, boolean dst_glOriented, int dst_lineStride) throws IllegalStateException, IllegalArgumentException - Parameters:
width- width of the to be converted pixel rectangleheight- height of the to be converted pixel rectanglesrc_bb-ByteBuffersourcesrc_fmt- sourcePixelFormatsrc_glOriented- if true, the source memory is laid out in OpenGL's coordinate system, origin at bottom left, otherwise origin at top left.src_lineStride- line stride in byte-size for source, i.e. byte count from one line to the next. Must be >=src_fmt.comp.bytesPerPixel()* width orzerofor default stride.dst_bb-ByteBuffersinkdst_fmt- destinationPixelFormatdst_glOriented- if true, the source memory is laid out in OpenGL's coordinate system, origin at bottom left, otherwise origin at top left.dst_lineStride- line stride in byte-size for destination, i.e. byte count from one line to the next. Must be >=dst_fmt.comp.bytesPerPixel()* width orzerofor default stride.- Throws:
IllegalStateExceptionIllegalArgumentException- ifsrc_lineStrideordst_lineStrideis invalid
-
convert
public static void convert(PixelFormatUtil.ComponentMap cmap, PixelFormat.Composition dstComp, com.jogamp.common.util.Bitstream<ByteBuffer> dstBitStream, PixelFormat.Composition srcComp, com.jogamp.common.util.Bitstream<ByteBuffer> srcBitStream) throws IllegalStateException, IOException - Throws:
IllegalStateExceptionIOException
-