Class CameraFrame
java.lang.Object
com.codename1.camera.CameraFrame
A single frame delivered to a FrameListener.
Lifetime: the byte arrays returned by this class are valid only while
FrameListener#onFrame(CameraFrame) is on the stack. After it returns the
framework may reuse or release the underlying buffers. Clone any data you
need to keep.
-
Constructor Summary
ConstructorsConstructorDescriptionCameraFrame(byte[] jpegBytes, byte[] rawBytes, int width, int height, int rotationDegrees, long timestampNanos, FrameFormat format) Used by platform implementations. -
Method Summary
Modifier and TypeMethodDescriptionPixel format actually used for#getRawBytes().intPixel height of the frame.byte[]JPEG-encoded bytes for this frame.byte[]Raw pixel bytes in the format requested viaCameraSessionOptions#frameFormat(FrameFormat).intClockwise rotation in degrees (0, 90, 180, 270) that should be applied to the bytes to display them upright.longMonotonic timestamp in nanoseconds.intgetWidth()Pixel width of the frame.
-
Constructor Details
-
CameraFrame
public CameraFrame(byte[] jpegBytes, byte[] rawBytes, int width, int height, int rotationDegrees, long timestampNanos, FrameFormat format) Used by platform implementations.
-
-
Method Details
-
getJpegBytes
public byte[] getJpegBytes()JPEG-encoded bytes for this frame. Always non-null regardless of the requestedFrameFormat; the framework encodes raw frames into JPEG on demand for AI module consumption. -
getRawBytes
public byte[] getRawBytes()Raw pixel bytes in the format requested viaCameraSessionOptions#frameFormat(FrameFormat).nullwhen the requested format wasFrameFormat#JPEG. -
getWidth
public int getWidth()Pixel width of the frame. -
getHeight
public int getHeight()Pixel height of the frame. -
getRotationDegrees
public int getRotationDegrees()Clockwise rotation in degrees (0, 90, 180, 270) that should be applied to the bytes to display them upright. -
getTimestampNanos
public long getTimestampNanos()Monotonic timestamp in nanoseconds. Useful for measuring inter-frame intervals. -
getFormat
Pixel format actually used for#getRawBytes(). JPEG bytes returned by#getJpegBytes()are always JPEG-encoded regardless of this value.
-