Struct ndk::native_window::NativeWindow
source · [−]pub struct NativeWindow { /* private fields */ }Expand description
It is the C counterpart of the android.view.Surface object in Java, and can be converted
both ways. Depending on the consumer, images submitted to NativeWindow can be shown on the
display or sent to other consumers, such as video encoders.
Implementations
sourceimpl NativeWindow
impl NativeWindow
sourcepub unsafe fn from_ptr(ptr: NonNull<ANativeWindow>) -> Self
pub unsafe fn from_ptr(ptr: NonNull<ANativeWindow>) -> Self
sourcepub unsafe fn clone_from_ptr(ptr: NonNull<ANativeWindow>) -> Self
pub unsafe fn clone_from_ptr(ptr: NonNull<ANativeWindow>) -> Self
pub fn ptr(&self) -> NonNull<ANativeWindow>
pub fn height(&self) -> i32
pub fn width(&self) -> i32
sourcepub fn format(&self) -> HardwareBufferFormat
pub fn format(&self) -> HardwareBufferFormat
Return the current pixel format (HardwareBufferFormat) of the window surface.
sourcepub fn set_buffers_geometry(
&self,
width: i32,
height: i32,
format: Option<HardwareBufferFormat>
) -> Result<()>
pub fn set_buffers_geometry(
&self,
width: i32,
height: i32,
format: Option<HardwareBufferFormat>
) -> Result<()>
Change the format and size of the window buffers.
The width and height control the number of pixels in the buffers, not the dimensions of the window on screen. If these are different than the window’s physical size, then its buffer will be scaled to match that size when compositing it to the screen. The width and height must be either both zero or both non-zero.
For all of these parameters, if 0 or None is supplied then the window’s base value
will come back in force.
sourcepub unsafe fn from_surface(env: *mut JNIEnv, surface: jobject) -> Option<Self>
pub unsafe fn from_surface(env: *mut JNIEnv, surface: jobject) -> Option<Self>
Return the NativeWindow associated with a JNI android.view.Surface pointer.
Safety
By calling this function, you assert that env is a valid pointer to a JNIEnv and
surface is a valid pointer to an android.view.Surface.
sourcepub unsafe fn to_surface(&self, env: *mut JNIEnv) -> jobject
Available on crate feature api-level-26 only.
pub unsafe fn to_surface(&self, env: *mut JNIEnv) -> jobject
api-level-26 only.Return a JNI android.view.Surface pointer derived from this NativeWindow.
Safety
By calling this function, you assert that env is a valid pointer to a JNIEnv.
Trait Implementations
sourceimpl Clone for NativeWindow
impl Clone for NativeWindow
sourceimpl Debug for NativeWindow
impl Debug for NativeWindow
sourceimpl Drop for NativeWindow
impl Drop for NativeWindow
sourceimpl HasRawWindowHandle for NativeWindow
impl HasRawWindowHandle for NativeWindow
fn raw_window_handle(&self) -> RawWindowHandle
sourceimpl Hash for NativeWindow
impl Hash for NativeWindow
sourceimpl Ord for NativeWindow
impl Ord for NativeWindow
sourceimpl PartialEq<NativeWindow> for NativeWindow
impl PartialEq<NativeWindow> for NativeWindow
sourcefn eq(&self, other: &NativeWindow) -> bool
fn eq(&self, other: &NativeWindow) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &NativeWindow) -> bool
fn ne(&self, other: &NativeWindow) -> bool
This method tests for !=.
sourceimpl PartialOrd<NativeWindow> for NativeWindow
impl PartialOrd<NativeWindow> for NativeWindow
sourcefn partial_cmp(&self, other: &NativeWindow) -> Option<Ordering>
fn partial_cmp(&self, other: &NativeWindow) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Eq for NativeWindow
impl Send for NativeWindow
impl StructuralEq for NativeWindow
impl StructuralPartialEq for NativeWindow
impl Sync for NativeWindow
Auto Trait Implementations
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more