Package edu.wpi.cscore.raw
Class RawFrame
- java.lang.Object
-
- edu.wpi.cscore.raw.RawFrame
-
- All Implemented Interfaces:
AutoCloseable
public class RawFrame extends Object implements AutoCloseable
Class for storing raw frame data between image read call.Data is reused for each frame read, rather then reallocating every frame.
-
-
Constructor Summary
Constructors Constructor Description RawFrame()Construct a new RawFrame.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the RawFrame, releasing native resources.ByteBuffergetDataByteBuffer()Get a ByteBuffer pointing to the frame data.longgetDataPtr()Get a long (is a char* in native code) pointing to the frame data.longgetFramePtr()Get the pointer to native representation of this frame.intgetHeight()Get the height of the frame.intgetPixelFormat()Get the PixelFormat of the frame.intgetTotalData()Get the total length of the data stored in the frame.intgetWidth()Get the width of the frame.voidsetData(ByteBuffer dataByteBuffer, long dataPtr, int totalData, int width, int height, int pixelFormat)Called from JNI to set data in class.voidsetHeight(int height)Set the height of the frame.voidsetPixelFormat(int pixelFormat)Set the PixelFormat of the frame.voidsetWidth(int width)Set the width of the frame.
-
-
-
Method Detail
-
close
public void close()
Close the RawFrame, releasing native resources. Any images currently using the data will be invalidated.- Specified by:
closein interfaceAutoCloseable
-
setData
public void setData(ByteBuffer dataByteBuffer, long dataPtr, int totalData, int width, int height, int pixelFormat)
Called from JNI to set data in class.
-
getFramePtr
public long getFramePtr()
Get the pointer to native representation of this frame.
-
getDataByteBuffer
public ByteBuffer getDataByteBuffer()
Get a ByteBuffer pointing to the frame data. This ByteBuffer is backed by the frame directly. Its lifetime is controlled by the frame. If a new frame gets read, it will overwrite the current one.
-
getDataPtr
public long getDataPtr()
Get a long (is a char* in native code) pointing to the frame data. This pointer is backed by the frame directly. Its lifetime is controlled by the frame. If a new frame gets read, it will overwrite the current one.
-
getTotalData
public int getTotalData()
Get the total length of the data stored in the frame.
-
getWidth
public int getWidth()
Get the width of the frame.
-
setWidth
public void setWidth(int width)
Set the width of the frame.
-
getHeight
public int getHeight()
Get the height of the frame.
-
setHeight
public void setHeight(int height)
Set the height of the frame.
-
getPixelFormat
public int getPixelFormat()
Get the PixelFormat of the frame.
-
setPixelFormat
public void setPixelFormat(int pixelFormat)
Set the PixelFormat of the frame.
-
-