Share via


SurfaceTexture.SetDefaultBufferSize(Int32, Int32) Method

Definition

Set the default size of the image buffers.

[Android.Runtime.Register("setDefaultBufferSize", "(II)V", "GetSetDefaultBufferSize_IIHandler")]
public virtual void SetDefaultBufferSize (int width, int height);
[<Android.Runtime.Register("setDefaultBufferSize", "(II)V", "GetSetDefaultBufferSize_IIHandler")>]
abstract member SetDefaultBufferSize : int * int -> unit
override this.SetDefaultBufferSize : int * int -> unit

Parameters

width
Int32
height
Int32
Attributes

Remarks

Set the default size of the image buffers. The image producer may override the buffer size, in which case the producer-set buffer size will be used, not the default size set by this method. Both video and camera based image producers do override the size. This method may be used to set the image size when producing images with android.graphics.Canvas (via android.view.Surface#lockCanvas), or OpenGL ES (via an EGLSurface).

The new default buffer size will take effect the next time the image producer requests a buffer to fill. For android.graphics.Canvas this will be the next time android.view.Surface#lockCanvas is called. For OpenGL ES, the EGLSurface should be destroyed (via eglDestroySurface), made not-current (via eglMakeCurrent), and then recreated (via eglCreateWindowSurface) to ensure that the new default size has taken effect.

The width and height parameters must be no greater than the minimum of GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see javax.microedition.khronos.opengles.GL10#glGetIntegerv glGetIntegerv). An error due to invalid dimensions might not be reported until updateTexImage() is called.

Java documentation for android.graphics.SurfaceTexture.setDefaultBufferSize(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to