Skip to content

doc: adds architecture diagram and method comments #1140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions c_api/src/c_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,21 @@ pub unsafe extern "C" fn c2pa_builder_add_resource(
///
/// # Safety
/// Reads from NULL-terminated C strings.
///
/// # Example
/// ```c
/// auto result = c2pa_builder_add_ingredient_from_stream(
/// builder,
/// "{\"title\": \"Test Ingredient\"}",
/// "image/jpeg",
/// stream);
/// if (result < 0) {
/// auto error = c2pa_error();
/// printf("Error: %s\n", error);
/// c2pa_string_free(error);
/// }
/// ```
///
#[no_mangle]
pub unsafe extern "C" fn c2pa_builder_add_ingredient_from_stream(
builder_ptr: *mut C2paBuilder,
Expand Down
59 changes: 59 additions & 0 deletions docs/c2pa_binding_architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
```mermaid
graph TB
%% Core SDK Components
SDK["🦀 Core Rust SDK<br/><small>Reader • Builder • Signer</small>"]

%% C Bindings Layer
CBindings["🔗 C Bindings<br/><small>Foreign Function Interface</small>"]

%% Language Bindings
subgraph "Language Bindings"
CPP["C++"]
Python["🐍 Python"]
Swift["🍎 Swift"]
Kotlin["📱 Kotlin"]
NodeJS["📗 Node.js"]
WebJS["🌐 Web JS"]
Copy link
Collaborator

@crandmck crandmck May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Client JavaScript" might be clearer here. Someone might think this refers to Web JS.

end

%% Applications
subgraph "Applications"
PythonApps["Python Apps"]
WebApps["Web Applications"]
MobileApps["Mobile Apps"]
DesktopApps["Desktop Apps"]
C2PATool["c2patool"]
EmbeddedApps["📷 Embedded Apps"]
end

%% Connections
SDK --> CBindings

CBindings --> CPP
CBindings --> Python
CBindings --> Swift
CBindings --> Kotlin
CBindings --> NodeJS
CBindings --> WebJS

Python --> PythonApps
WebJS --> WebApps
NodeJS --> WebApps
Swift --> MobileApps
Kotlin --> MobileApps
CPP --> DesktopApps

%% Direct Rust SDK usage
SDK --> C2PATool
SDK --> EmbeddedApps

%% Styling
classDef coreSDK fill:#e1f5fe,stroke:#01579b,stroke-width:2px
classDef bindings fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
classDef tools fill:#e8f5e8,stroke:#1b5e20,stroke-width:2px
classDef apps fill:#fff3e0,stroke:#e65100,stroke-width:2px

class SDK coreSDK
class CBindings,CPP,Python,Swift,Kotlin,NodeJS,WebJS bindings
class C2PATool,PythonApps,WebApps,MobileApps,DesktopApps,EmbeddedApps apps
```
Loading