| Flutter Impeller |

Classes | Public Member Functions | List of all members
impeller::android::NativeWindow Class Reference

A wrapper for ANativeWindow https://developer.android.com/ndk/reference/group/a-native-window. More...

`#include <native_window.h>`

## Public Member Functions
| NativeWindow (ANativeWindow *window)
| ~NativeWindow ()
| NativeWindow (const NativeWindow &)=delete
NativeWindow & | operator= (const NativeWindow &)=delete
bool | IsValid () const
ISize | GetSize () const
ANativeWindow * | GetHandle () const

## Detailed Description

A wrapper for ANativeWindow https://developer.android.com/ndk/reference/group/a-native-window.

This wrapper is only available on Android.

Definition at line 20 of file native_window.h.

## Constructor & Destructor Documentation

## ◆ NativeWindow() [1/2]

impeller::android::NativeWindow::NativeWindow | ( | ANativeWindow * | window | ) |
| explicit

Definition at line 9 of file native_window.cc.

9 : window_(window) {
10 if (window_.get()) {
11 GetProcTable().ANativeWindow_acquire(window_.get());
12 }
13 }

References impeller::android::GetProcTable().

## ◆ ~NativeWindow()

impeller::android::NativeWindow::~NativeWindow | ( |  | ) |
| default

## ◆ NativeWindow() [2/2]

impeller::android::NativeWindow::NativeWindow | ( | const NativeWindow & |  | ) |
| delete

## Member Function Documentation

## ◆ GetHandle()

ANativeWindow * impeller::android::NativeWindow::GetHandle | ( |  | ) | const

Definition at line 30 of file native_window.cc.

30 {
31 return window_.get();
32 }

## ◆ GetSize()

ISize impeller::android::NativeWindow::GetSize | ( |  | ) | const

Returns
  The current size of the native window.

Definition at line 21 of file native_window.cc.

21 {
22 if (!IsValid()) {
23 return {};
24 }
25 const int32_t width = ANativeWindow_getWidth(window_.get());
26 const int32_t height = ANativeWindow_getHeight(window_.get());
27 return ISize::MakeWH(std::max(width, 0), std::max(height, 0));
28 }

References IsValid(), and impeller::TSize< int64_t >::MakeWH().

## ◆ IsValid()

bool impeller::android::NativeWindow::IsValid | ( |  | ) | const

Definition at line 17 of file native_window.cc.

17 {
18 return window_.is_valid();
19 }

Referenced by GetSize().

## ◆ operator=()

NativeWindow& impeller::android::NativeWindow::operator= | ( | const NativeWindow & |  | ) |
| delete

The documentation for this class was generated from the following files:

- impeller/toolkit/android/native_window.h
- impeller/toolkit/android/native_window.cc

impeller::android::NativeWindow::IsValid
bool IsValid() const
Definition: native_window.cc:17
impeller::android::GetProcTable
const ProcTable & GetProcTable()
Definition: proc_table.cc:12
impeller::TSize< int64_t >::MakeWH
static constexpr TSize MakeWH(Type width, Type height)
Definition: size.h:34