Stay organized with collections
Save and categorize content based on your preferences.
Plane
abstract class Plane
A single color plane of image data.
The number and meaning of the planes in an Image are determined by the format of the Image.
Once the Image has been closed, any access to the plane's ByteBuffer will fail.
Summary
Public methods |
abstract ByteBuffer! |
Get a direct ByteBuffer containing the frame data.
|
abstract Int |
The distance between adjacent pixel samples, in bytes.
|
abstract Int |
The row stride for this color plane, in bytes.
|
Public methods
getBuffer
abstract fun getBuffer(): ByteBuffer!
Get a direct ByteBuffer
containing the frame data.
In particular, the buffer returned will always have isDirect
return true
, so the underlying data could be mapped as a pointer in JNI without doing any copies with GetDirectBufferAddress
.
For raw formats, each plane is only guaranteed to contain data up to the last pixel in the last row. In other words, the stride after the last row may not be mapped into the buffer. This is a necessary requirement for any interleaved format.
Return |
ByteBuffer! |
the byte buffer containing the image data for this plane. |
getPixelStride
abstract fun getPixelStride(): Int
The distance between adjacent pixel samples, in bytes.
This is the distance between two consecutive pixel values in a row of pixels. It may be larger than the size of a single pixel to account for interleaved image data or padded formats. Note that pixel stride is undefined for some formats such as RAW_PRIVATE
, and calling getPixelStride on images of these formats will cause an UnsupportedOperationException being thrown. For formats where pixel stride is well defined, the pixel stride is always greater than 0.
getRowStride
abstract fun getRowStride(): Int
The row stride for this color plane, in bytes.
This is the distance between the start of two consecutive rows of pixels in the image. Note that row stride is undefined for some formats such as RAW_PRIVATE
, and calling getRowStride on images of these formats will cause an UnsupportedOperationException being thrown. For formats where row stride is well defined, the row stride is always greater than 0.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Image.Plane\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPlane\n=====\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/Image.Plane \"View this page in Java\") \n\n```\nabstract class Plane\n```\n\n|---|--------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.Image.Plane](#) |\n\nA single color plane of image data.\n\nThe number and meaning of the planes in an Image are determined by the format of the Image.\n\nOnce the Image has been closed, any access to the plane's ByteBuffer will fail.\n\nSummary\n-------\n\n| Public methods ||\n|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|\n| abstract [ByteBuffer](../../java/nio/ByteBuffer.html#)! | [getBuffer](#getBuffer())`()` Get a direct [ByteBuffer](../../java/nio/ByteBuffer.html#) containing the frame data. |\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getPixelStride](#getPixelStride())`()` The distance between adjacent pixel samples, in bytes. |\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getRowStride](#getRowStride())`()` The row stride for this color plane, in bytes. |\n\nPublic methods\n--------------\n\n### getBuffer\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getBuffer(): ByteBuffer!\n```\n\nGet a direct [ByteBuffer](../../java/nio/ByteBuffer.html#) containing the frame data.\n\nIn particular, the buffer returned will always have [isDirect](../../java/nio/ByteBuffer.html#isDirect()) return `true`, so the underlying data could be mapped as a pointer in JNI without doing any copies with `GetDirectBufferAddress`.\n\nFor raw formats, each plane is only guaranteed to contain data up to the last pixel in the last row. In other words, the stride after the last row may not be mapped into the buffer. This is a necessary requirement for any interleaved format.\n\n| Return ||\n|------------------------------------------------|-----------------------------------------------------------|\n| [ByteBuffer](../../java/nio/ByteBuffer.html#)! | the byte buffer containing the image data for this plane. |\n\n### getPixelStride\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getPixelStride(): Int\n```\n\nThe distance between adjacent pixel samples, in bytes.\n\nThis is the distance between two consecutive pixel values in a row of pixels. It may be larger than the size of a single pixel to account for interleaved image data or padded formats. Note that pixel stride is undefined for some formats such as [RAW_PRIVATE](../graphics/ImageFormat.html#RAW_PRIVATE:kotlin.Int), and calling getPixelStride on images of these formats will cause an UnsupportedOperationException being thrown. For formats where pixel stride is well defined, the pixel stride is always greater than 0. \n\n### getRowStride\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getRowStride(): Int\n```\n\nThe row stride for this color plane, in bytes.\n\nThis is the distance between the start of two consecutive rows of pixels in the image. Note that row stride is undefined for some formats such as [RAW_PRIVATE](../graphics/ImageFormat.html#RAW_PRIVATE:kotlin.Int), and calling getRowStride on images of these formats will cause an UnsupportedOperationException being thrown. For formats where row stride is well defined, the row stride is always greater than 0."]]