Stay organized with collections
Save and categorize content based on your preferences.
Image.Plane
public
static
abstract
class
Image.Plane
extends Object
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
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public methods
getBuffer
public abstract ByteBuffer getBuffer ()
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.
Returns |
ByteBuffer |
the byte buffer containing the image data for this plane. |
getPixelStride
public abstract int getPixelStride ()
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
public abstract int getRowStride ()
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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nImage.Plane\n===========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/media/Image.Plane \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\nabstract\nclass\nImage.Plane\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|---------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.media.Image.Plane |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nA single color plane of image data.\n\nThe number and meaning of the planes in an Image are determined by the\nformat of the Image.\n\nOnce the Image has been closed, any access to the plane's\nByteBuffer will fail.\n\n\u003cbr /\u003e\n\n**See also:**\n\n- [Image.getFormat()](/reference/android/media/Image#getFormat())\n\nSummary\n-------\n\n| ### Public methods ||\n|----------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[ByteBuffer](/reference/java/nio/ByteBuffer) | ` `[getBuffer](/reference/android/media/Image.Plane#getBuffer())`() ` \u003cbr /\u003e Get a direct [ByteBuffer](/reference/java/nio/ByteBuffer) containing the frame data. |\n| ` abstract int` | ` `[getPixelStride](/reference/android/media/Image.Plane#getPixelStride())`() ` \u003cbr /\u003e The distance between adjacent pixel samples, in bytes. |\n| ` abstract int` | ` `[getRowStride](/reference/android/media/Image.Plane#getRowStride())`() ` \u003cbr /\u003e The row stride for this color plane, in bytes. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic methods\n--------------\n\n### getBuffer\n\nAdded in [API level 19](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract ByteBuffer getBuffer ()\n```\n\n\u003cbr /\u003e\n\nGet a direct [ByteBuffer](/reference/java/nio/ByteBuffer)\ncontaining the frame data.\n\nIn particular, the buffer returned will always have\n[isDirect](/reference/java/nio/ByteBuffer#isDirect()) return `true`, so\nthe underlying data could be mapped as a pointer in JNI without doing\nany copies with `GetDirectBufferAddress`.\n\nFor raw formats, each plane is only guaranteed to contain data\nup to the last pixel in the last row. In other words, the stride\nafter the last row may not be mapped into the buffer. This is a\nnecessary requirement for any interleaved format.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|----------------------------------------------|------------------------------------------------------------------|\n| [ByteBuffer](/reference/java/nio/ByteBuffer) | the byte buffer containing the image data for this plane. \u003cbr /\u003e |\n\n### getPixelStride\n\nAdded in [API level 19](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract int getPixelStride ()\n```\n\n\u003cbr /\u003e\n\nThe distance between adjacent pixel samples, in bytes.\n\nThis is the distance between two consecutive pixel values in a row\nof pixels. It may be larger than the size of a single pixel to\naccount for interleaved image data or padded formats.\nNote that pixel stride is undefined for some formats such as\n[RAW_PRIVATE](/reference/android/graphics/ImageFormat#RAW_PRIVATE),\nand calling getPixelStride on images of these formats will\ncause an UnsupportedOperationException being thrown.\nFor formats where pixel stride is well defined, the pixel stride\nis always greater than 0.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |\n\n### getRowStride\n\nAdded in [API level 19](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract int getRowStride ()\n```\n\n\u003cbr /\u003e\n\nThe row stride for this color plane, in bytes.\n\nThis is the distance between the start of two consecutive rows of\npixels in the image. Note that row stride is undefined for some formats\nsuch as\n[RAW_PRIVATE](/reference/android/graphics/ImageFormat#RAW_PRIVATE),\nand calling getRowStride on images of these formats will\ncause an UnsupportedOperationException being thrown.\nFor formats where row stride is well defined, the row stride\nis always greater than 0.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |"]]