Skip to content

Commit

Permalink
Move drawing into a separate package
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 00988a1 commit 7e208ae
Show file tree
Hide file tree
Showing 129 changed files with 150 additions and 112 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ repository = "https://github.com/openharmony-rs/ohos-sys"
keywords = ["OpenHarmony", "HarmonyOS", "ffi"]
exclude = ["src/**/*_api11.rs", "src/**/*_api12.rs"]

[workspace]
members = ["components/drawing"]

[dependencies]
document-features = { version = "0.2", optional = true }
ohos-drawing-sys = { path = "components/drawing", version = "0.1"}

[features]
default = ["api-10"]
## Enables bindings to `native_drawing`
## Enables bindings to `native_drawing`. Re-exports `ohos-drawing-sys`.
drawing = []
## Enables bindings to `hilog`
hilog = []
Expand Down
36 changes: 36 additions & 0 deletions components/drawing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "ohos-drawing-sys"
version = "0.1.0"
edition = "2021"
description = "Bindings to the `native_drawing` API of OpenHarmony OS"
license = "Apache-2.0"
repository = "https://github.com/openharmony-rs/ohos-sys"
keywords = ["OpenHarmony", "HarmonyOS", "ffi", "drawing"]
exclude = ["src/**/*_api11.rs", "src/**/*_api12.rs"]

[dependencies]
document-features = { version = "0.2", optional = true }

[features]
default = ["api-10"]

#! ### OpenHarmony API level
#! This crate by default exposes bindings for API-level 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.
api-10 = []
## Enables bindings for OpenHarmony API-level 11
api-11 = ["api-10"]
## **EXPERIMENTAL**: Enables bindings for OpenHarmony API-level 12 (beta-1).
## Will stabilize once the final version has been released.
api-12 = ["api-11"]
## Document available features when building the documentation
document-features = ["dep:document-features"]

[package.metadata.docs.rs]
features = ["document-features"]
targets = ["aarch64-unknown-linux-ohos", "armv7-unknown-linux-ohos", "x86_64-unknown-linux-ohos"]
all-features = true
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::drawing::types::{
use crate::types::{
OH_Drawing_AlphaFormat, OH_Drawing_Bitmap, OH_Drawing_ColorFormat, OH_Drawing_Image_Info,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

/** @brief Defines the pixel format of a bitmap, including the color type and alpha type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

/** @brief Defines the pixel format of a bitmap, including the color type and alpha type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

/** @brief Defines the pixel format of a bitmap, including the color type and alpha type.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)]

use crate::drawing::types::{OH_Drawing_Brush, OH_Drawing_Filter, OH_Drawing_ShaderEffect};
use crate::types::{OH_Drawing_Brush, OH_Drawing_Filter, OH_Drawing_ShaderEffect};

extern "C" {
/** @brief Obtains the alpha of a brush. The alpha is used by the brush to fill in a shape.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)]

use crate::drawing::types::{
use crate::types::{
OH_Drawing_BlendMode, OH_Drawing_Brush, OH_Drawing_Filter, OH_Drawing_ShadowLayer,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Brush</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Brush</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Brush</b> object.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use crate::drawing::types::{
use crate::types::{
OH_Drawing_Bitmap, OH_Drawing_Canvas, OH_Drawing_Path, OH_Drawing_Point, OH_Drawing_Rect,
OH_Drawing_RoundRect, OH_Drawing_TextBlob,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use crate::drawing::canvas::OH_Drawing_CanvasClipOp;
use crate::drawing::types::{
use crate::canvas::OH_Drawing_CanvasClipOp;
use crate::types::{
OH_Drawing_Bitmap, OH_Drawing_BlendMode, OH_Drawing_Brush, OH_Drawing_Canvas, OH_Drawing_Image,
OH_Drawing_Image_Info, OH_Drawing_Matrix, OH_Drawing_Path, OH_Drawing_PixelMap,
OH_Drawing_Point2D, OH_Drawing_Point3D, OH_Drawing_Rect, OH_Drawing_Region,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Canvas</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_CanvasClipOp {
/// Clip with difference.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_SrcRectConstraint {
/// Using sampling only inside bounds in a slower manner.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Converts four variables (alpha, red, green, and blue) into a 32-bit (ARGB) variable that describes a color.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_ColorFilter</b> with a blend mode.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_ColorFilter</b> with a blend mode.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_ColorSpace</b> object that represents the SRGB color space.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_ErrorCode {
/// @error Operation completed successfully.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)]

use crate::drawing::types::{OH_Drawing_ColorFilter, OH_Drawing_Filter, OH_Drawing_ImageFilter};
use crate::types::{OH_Drawing_ColorFilter, OH_Drawing_Filter, OH_Drawing_ImageFilter};

extern "C" {
/** @brief Sets an <b>OH_Drawing_ImageFilter</b> object for an <b>OH_Drawing_Filter</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Filter</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Filter</b> object.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]

use crate::drawing::types::{OH_Drawing_Font, OH_Drawing_TextEncoding, OH_Drawing_Typeface};
use crate::types::{OH_Drawing_Font, OH_Drawing_TextEncoding, OH_Drawing_Typeface};

impl OH_Drawing_FontHinting {
/// glyph outlines unchanged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Font</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_FontHinting {
/// glyph outlines unchanged
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(non_snake_case)]

use crate::drawing::text_declaration::OH_Drawing_FontCollection;
use crate::text_declaration::OH_Drawing_FontCollection;

extern "C" {
/** @brief Disable the font collection fallback.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::text_declaration::*;
use crate::drawing::types::*;
use crate::text_declaration::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_FontCollection</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::text_declaration::*;
use crate::drawing::types::*;
use crate::text_declaration::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_FontCollection</b> object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::text_declaration::*;
use crate::drawing::types::*;
use crate::text_declaration::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_FontCollection</b> object.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::text_typography::*;
use crate::drawing::types::*;
use crate::text_typography::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_FontMgr</b> object.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

/** @brief Defines the options about GPU context.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_Image</b> object.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::shader_effect::*;
use crate::drawing::types::*;
use crate::shader_effect::*;
use crate::types::*;

extern "C" {
/** @brief Creates an <b>OH_Drawing_ImageFilter</b> object that blurs its input by the separate x and y sigmas.
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_BlurType {
/// Fuzzy inside and outside.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::drawing::types::*;
use crate::types::*;

impl OH_Drawing_BlurType {
/// Fuzzy inside and outside.
Expand Down
File renamed without changes.
Loading

0 comments on commit 7e208ae

Please sign in to comment.