From eb489e5792c8613fd8cfcc455652e2d7c61ecc73 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Thu, 18 Jul 2024 11:20:13 +0200 Subject: [PATCH] Minor documentation improvements Signed-off-by: Jonathan Schwender --- Cargo.toml | 3 +-- components/drawing/Cargo.toml | 3 +-- components/drawing/src/lib.rs | 24 ++++++++++++++++++++++++ src/native_buffer.rs | 13 +++++++++++++ src/native_window.rs | 14 ++++++++++++++ src/xcomponent.rs | 20 ++++++++++++++++++++ 6 files changed, 73 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8410adf..b0451f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,8 +43,7 @@ all-components = [ #! Optionally enable one of the `api-*` features to get access to bindings for newer #! OpenHarmony versions. -## Enables bindings for OpenHarmony API-level 10. Enabled by default. -## Note: this crate is empty if this feature is not selected. +## No effect. API-10 bindings can't be deselected. The feature exists for internal purposes. api-10 = [] ## Enables bindings for OpenHarmony API-level 11 api-11 = ["api-10"] diff --git a/components/drawing/Cargo.toml b/components/drawing/Cargo.toml index e6e5be4..5c32507 100644 --- a/components/drawing/Cargo.toml +++ b/components/drawing/Cargo.toml @@ -19,8 +19,7 @@ default = ["api-10"] #! Optionally enable one of the `api-*` features to get access to bindings for newer #! OpenHarmony versions. -## Enables bindings for OpenHarmony API-level 10. Enabled by default. -## Note: this crate is empty if this feature is not selected. +## No effect. API-10 bindings can't be deselected. The feature exists for internal purposes. api-10 = [] ## Enables bindings for OpenHarmony API-level 11 api-11 = ["api-10"] diff --git a/components/drawing/src/lib.rs b/components/drawing/src/lib.rs index b9c2d58..a60d7a5 100644 --- a/components/drawing/src/lib.rs +++ b/components/drawing/src/lib.rs @@ -31,51 +31,75 @@ pub mod text_typography; pub mod types; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod color_filter; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod filter; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod font; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod mask_filter; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod matrix; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod point; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod rect; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod register_font; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod round_rect; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod shader_effect; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod text_blob; #[cfg(feature = "api-11")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-11")))] pub mod typeface; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod color_space; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod error_code; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod font_mgr; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod gpu_context; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod image; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod image_filter; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod memory_stream; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod path_effect; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod pixel_map; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod sampling_options; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod shadow_layer; #[cfg(feature = "api-12")] +#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))] pub mod surface; diff --git a/src/native_buffer.rs b/src/native_buffer.rs index 2b5dce0..f943572 100644 --- a/src/native_buffer.rs +++ b/src/native_buffer.rs @@ -1,3 +1,16 @@ +//! Native Buffer bindings +//! +//! The native buffer module provides APIs that you can use to apply for, use, and release the +//! shared memory, and query memory properties. +//! The following scenario is common for native buffer development: +//! Use the native buffer APIs to create an OH_NativeBuffer instance, obtain memory properties, +//! and map the corresponding ION memory to the process address space. +//! +//! Source: +//! +//! [English Documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/graphics/native-buffer-guidelines.md) +//! [Chinese Documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/graphics/native-buffer-guidelines.md) + #[link(name = "native_buffer")] extern "C" {} diff --git a/src/native_window.rs b/src/native_window.rs index df5d9a8..a33331b 100644 --- a/src/native_window.rs +++ b/src/native_window.rs @@ -1,3 +1,17 @@ +//! Native Window bindings +//! +//! The native window module is a local platform-based window that represents the producer of a +//! graphics queue. It provides APIs for you to request and flush a buffer and configure buffer attributes. +//! The following scenarios are common for native window development: +//! * Request a graphics buffer by using the native window API, write the produced graphics content +//! to the buffer, and flush the buffer to the graphics queue. +//! * Request and flush a buffer when adapting to the `eglswapbuffer` interface at the EGL. +//! +//! Source: +//! +//! [English Documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/graphics/native-window-guidelines.md) +//! [Chinese Documentation](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/graphics/native-window-guidelines.md) + #[link(name = "ace_ndk.z")] #[link(name = "native_window")] extern "C" {} diff --git a/src/xcomponent.rs b/src/xcomponent.rs index 3c4b5e5..0e1ce5a 100644 --- a/src/xcomponent.rs +++ b/src/xcomponent.rs @@ -1,3 +1,23 @@ +//! Native XComponent bindings +//! +//! ## When to Use +//! +//! NativeXComponent provides an instance for the at the native layer, which can be +//! used as a bridge for binding with the at the JS layer. The NDK APIs provided by the +//! depend on this instance. The provided APIs include those for obtaining a native +//! window, obtaining the layout or event information of the , registering the lifecycle +//! callbacks of the , and registering the callbacks for the touch, mouse, and key events +//! of the . You can use the provided APIs in the following scenarios: +//! +//! * Register the lifecycle and event callbacks of the . +//! * Initialize the environment, obtain the current state, and respond to various events via these callbacks. +//! * Use the native window and EGL APIs to develop custom drawing content, and apply for and submit buffers to the graphics queue. +//! +//! Source: +//! +//! [English Documentation](https://docs.openharmony.cn/pages/v5.0/en/application-dev/ui/napi-xcomponent-guidelines.md) +//! [Chinese Documentation](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/ui/napi-xcomponent-guidelines.md) + #[link(name = "ace_ndk.z")] extern "C" {}