Skip to content

Commit

Permalink
Minor documentation improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Schwender <[email protected]>
  • Loading branch information
jschwe committed Jul 18, 2024
1 parent 7ed7915 commit eb489e5
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
3 changes: 1 addition & 2 deletions components/drawing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
24 changes: 24 additions & 0 deletions components/drawing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions src/native_buffer.rs
Original file line number Diff line number Diff line change
@@ -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" {}

Expand Down
14 changes: 14 additions & 0 deletions src/native_window.rs
Original file line number Diff line number Diff line change
@@ -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" {}
Expand Down
20 changes: 20 additions & 0 deletions src/xcomponent.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
//! Native XComponent bindings
//!
//! ## When to Use
//!
//! NativeXComponent provides an instance for the <XComponent> at the native layer, which can be
//! used as a bridge for binding with the <XComponent> at the JS layer. The NDK APIs provided by the
//! <XComponent> depend on this instance. The provided APIs include those for obtaining a native
//! window, obtaining the layout or event information of the <XComponent>, registering the lifecycle
//! callbacks of the <XComponent>, and registering the callbacks for the touch, mouse, and key events
//! of the <XComponent>. You can use the provided APIs in the following scenarios:
//!
//! * Register the lifecycle and event callbacks of the <XComponent>.
//! * 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" {}

Expand Down

0 comments on commit eb489e5

Please sign in to comment.