Skip to content

lenna-project/lenna-plugins

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

lenna-plugins

Lenna is a library for image processing algorithms and apps.

Here are some plugins for Lenna.

🐰 quickstart

cargo build

🌱 new plugin

Append library project to workspace:

#Cargo.toml
[workspace]
members = ["blur", "canny", "resize"]

Add dependencies for image and lenna-core:

[package]
authors = ["Christian <chriamue@gmail.com>"]
edition = "2018"
name = "resize"
version = "0.1.0"

[lib]
crate-type = ["cdylib"]

[dependencies]
image = {version = "0.23"}
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
lenna-core = {git = "https://github.com/lenna-project/lenna-core", branch="main" }

Import PluginRegistrar and export plugin:

// lib.rs
use lenna_core::plugins::PluginRegistrar;
use lenna_core::core::resize::Resize;

extern "C" fn register(registrar: &mut dyn PluginRegistrar) {
    registrar.add_plugin(Box::new(Resize{}));
}

lenna_core::export_plugin!(register);

For creating wasm package also export wasm plugin:

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use lenna_core::Processor;
#[cfg(target_arch = "wasm32")]
lenna_core::export_wasm_plugin!(Resize);

Build the plugin library using

cargo build --release

For building the wasm package, run:

wasm-pack build

πŸ“œ License

This software is licensed under the MIT Β© lenna-project.

About

Plugins for Lenna

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published