commit b2b863366fbe0b135917142531de2b8daa8c0931 Author: folinhilo Date: Thu Aug 20 22:22:27 2026 +0800 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a89721b --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,19 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "color-engine" +version = "0.1.0" + +[[package]] +name = "mark-engine" +version = "0.1.0" + +[[package]] +name = "text-engine" +version = "0.1.0" + +[[package]] +name = "ui-engine" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0cd5ae3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,3 @@ +[workspace] +members = ["crate/color-engine", "crate/mark-engine","crate/text-engine", "crate/ui-engine"] +resolver = "3" diff --git a/crate/color-engine/Cargo.toml b/crate/color-engine/Cargo.toml new file mode 100644 index 0000000..5d6e75c --- /dev/null +++ b/crate/color-engine/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "color-engine" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/crate/color-engine/src/core/color_model/cmyk.rs b/crate/color-engine/src/core/color_model/cmyk.rs new file mode 100644 index 0000000..e6029c4 --- /dev/null +++ b/crate/color-engine/src/core/color_model/cmyk.rs @@ -0,0 +1,6 @@ +pub struct CMYK { + pub c: u32, + pub m: u32, + pub y: u32, + pub k: u32, +} diff --git a/crate/color-engine/src/core/color_model/hsv.rs b/crate/color-engine/src/core/color_model/hsv.rs new file mode 100644 index 0000000..76777e2 --- /dev/null +++ b/crate/color-engine/src/core/color_model/hsv.rs @@ -0,0 +1,5 @@ +pub struct HSV { + pub h: u32, + pub s: u32, + pub v: u32, +} diff --git a/crate/color-engine/src/core/color_model/rgb.rs b/crate/color-engine/src/core/color_model/rgb.rs new file mode 100644 index 0000000..a86de30 --- /dev/null +++ b/crate/color-engine/src/core/color_model/rgb.rs @@ -0,0 +1,18 @@ +use crate::core::color_model::hsv::HSV; + +pub struct RGB { + pub r: u32, + pub g: u32, + pub b: u32, +} + +impl RGB { + pub fn new_from_hsv(hsv: HSV) -> Self { + let h = hsv.h; + Self { + r: 32, + g: 32, + b: 32, + } + } +} diff --git a/crate/color-engine/src/core/layer_base.rs b/crate/color-engine/src/core/layer_base.rs new file mode 100644 index 0000000..0bfbd0b --- /dev/null +++ b/crate/color-engine/src/core/layer_base.rs @@ -0,0 +1,5 @@ +pub struct LayerBase { + pub isLocked: bool, + pub isHided: bool, + pub optic: f32, +} diff --git a/crate/color-engine/src/core/shape_base.rs b/crate/color-engine/src/core/shape_base.rs new file mode 100644 index 0000000..f26fc15 --- /dev/null +++ b/crate/color-engine/src/core/shape_base.rs @@ -0,0 +1,5 @@ +pub struct ShapeBase { + pub width: i32, + pub height: i32, + pub rotation: i32, +} diff --git a/crate/color-engine/src/lib.rs b/crate/color-engine/src/lib.rs new file mode 100644 index 0000000..c7b1ea0 --- /dev/null +++ b/crate/color-engine/src/lib.rs @@ -0,0 +1,13 @@ +pub mod core { + pub mod color_model { + pub mod cmyk; + pub mod hsv; + pub mod rgb; + } +} + +pub mod tool { + pub mod shape { + pub mod square; + } +} diff --git a/crate/color-engine/src/tool/distribute/gradient.rs b/crate/color-engine/src/tool/distribute/gradient.rs new file mode 100644 index 0000000..86ed3bb --- /dev/null +++ b/crate/color-engine/src/tool/distribute/gradient.rs @@ -0,0 +1 @@ +pub struct Layer {} diff --git a/crate/color-engine/src/tool/shape/polygen.rs b/crate/color-engine/src/tool/shape/polygen.rs new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/crate/color-engine/src/tool/shape/polygen.rs @@ -0,0 +1 @@ + diff --git a/crate/color-engine/src/tool/shape/square.rs b/crate/color-engine/src/tool/shape/square.rs new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/crate/color-engine/src/tool/shape/square.rs @@ -0,0 +1 @@ + diff --git a/crate/mark-engine/Cargo.toml b/crate/mark-engine/Cargo.toml new file mode 100644 index 0000000..8ac1d07 --- /dev/null +++ b/crate/mark-engine/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "mark-engine" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/crate/mark-engine/src/lib.rs b/crate/mark-engine/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/crate/mark-engine/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/crate/mark-engine/src/style/border-style.rs b/crate/mark-engine/src/style/border-style.rs new file mode 100644 index 0000000..16d92fb --- /dev/null +++ b/crate/mark-engine/src/style/border-style.rs @@ -0,0 +1,10 @@ +pub struct BorderStyle(pub String); + +impl BorderStyle { + pub const NONE: Self = Self("None"); + pub const SOLID: Self = Self("SOLID"); + pub const DASHED: Self = Self("DASHED"); + pub const DOTTED: Self = Self("DOTTED"); + + fn check() {} +} diff --git a/crate/mark-engine/src/style/color.rs b/crate/mark-engine/src/style/color.rs new file mode 100644 index 0000000..d3f5a12 --- /dev/null +++ b/crate/mark-engine/src/style/color.rs @@ -0,0 +1 @@ + diff --git a/crate/mark-engine/src/style/font-size.rs b/crate/mark-engine/src/style/font-size.rs new file mode 100644 index 0000000..c300b49 --- /dev/null +++ b/crate/mark-engine/src/style/font-size.rs @@ -0,0 +1,14 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct FontSize(pub f32); + +impl FontSize { + pub const SMALL: Self = Self(12); + pub const NORMAL: Self = Self(14); + pub const MEDIUM: Self = Self(16); + pub const LARGE: Self = Self(24); + pub const X_LARGE: Self = Self(30); + + pub fn as_f32(&self) -> f32 { + self.0 + } +} diff --git a/crate/mark-engine/src/style/font-weight.rs b/crate/mark-engine/src/style/font-weight.rs new file mode 100644 index 0000000..c3495b2 --- /dev/null +++ b/crate/mark-engine/src/style/font-weight.rs @@ -0,0 +1,14 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct FontWeight(pub f32); + +impl FontWeight { + pub const LIGHT: Self = Self(300); + pub const NORMAL: Self = Self(400); + pub const MEDIUM: Self = Self(500); + pub const SEMIBOLD: Self = Self(600); + pub const BOLD: Self = Self(700); + + pub fn as_f32(&self) -> f32 { + self.0 + } +} diff --git a/crate/mark-engine/src/style/line-height.rs b/crate/mark-engine/src/style/line-height.rs new file mode 100644 index 0000000..829d3e6 --- /dev/null +++ b/crate/mark-engine/src/style/line-height.rs @@ -0,0 +1,10 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct LineHeight(pub f32); + +impl LineHeight { + pub const LINE_HEIGHT_NORMAL: Self = Self(1.4); + + pub fn as_f32(&self) -> f32 { + self.0 + } +} diff --git a/crate/mark-engine/src/style/width.rs b/crate/mark-engine/src/style/width.rs new file mode 100644 index 0000000..bf4ce2a --- /dev/null +++ b/crate/mark-engine/src/style/width.rs @@ -0,0 +1,18 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub struct Width(pub f32); + +impl Width { + pub const ITEM_WIDTH_SMALL: Self = Self(20); + pub const ITEM_WIDTH_NORMAL: Self = Self(24); + pub const ITEM_WIDTH_MEDIUM: Self = Self(28); + pub const ITEM_WIDTH_LARGE: Self = Self(34); + pub const ITEM_WIDTH_X_LARGE: Self = Self(44); + pub const ITEM_WIDTH_XX_LARGE: Self = Self(56); + pub const ITEM_WIDTH_XXX_LARGE: Self = Self(64); + + pub const INLINE_WIDTH_SMALL: Self = Self(64); + + pub fn as_f32(&self) -> f32 { + self.0 + } +} diff --git a/crate/text-engine/Cargo.toml b/crate/text-engine/Cargo.toml new file mode 100644 index 0000000..46f5031 --- /dev/null +++ b/crate/text-engine/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "text-engine" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/crate/text-engine/src/lib.rs b/crate/text-engine/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/crate/text-engine/src/lib.rs @@ -0,0 +1 @@ + diff --git a/crate/ui-engine/Cargo.toml b/crate/ui-engine/Cargo.toml new file mode 100644 index 0000000..6540c20 --- /dev/null +++ b/crate/ui-engine/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ui-engine" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/crate/ui-engine/src/lib.rs b/crate/ui-engine/src/lib.rs new file mode 100644 index 0000000..b93cf3f --- /dev/null +++ b/crate/ui-engine/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: u64, right: u64) -> u64 { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/playground/Cargo.toml b/playground/Cargo.toml new file mode 100644 index 0000000..bb4ef1a --- /dev/null +++ b/playground/Cargo.toml @@ -0,0 +1,4 @@ +[package] +name = "playground" +version = "0.1.0" +edition = "2024" diff --git a/playground/src/main.rs b/playground/src/main.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/playground/src/main.rs @@ -0,0 +1 @@ +