npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gaoding/illusion-sdk

v2.0.0-alpha.1

Published

illuion sdk on web

Downloads

47

Readme

web 端滤镜 sdk

本项目通过 emscripten 打包了 illusion-engine,提供更快更稳定的 web 滤镜渲染 sdk

模块介绍

本项目根据 illusion-engine 的模块划分,将渲染库分为以下模块:

  • Engine(渲染引擎主模块,负责渲染引擎的声明周期控制与自模块的创建)
  • Layer(图层, 是包括数据源、处理效果以及自身如变换等多数据的载体)
  • Source(数据源, 目前为渲染的输入图像数据)
  • Filter(滤镜, 图层渲染使用到的滤镜、混合效果等)
  • Target(渲染目标, 渲染结果输出的目标, 在 web 中为引擎挂载的 canvas)

快速使用

import { installIllusionEngine } from '@gaoding/illusion-sdk';

installIllusionEngine({
    useWorker: false
})
    .then(async(engine) => {
        await engine.init();

        // 创建视图源
        const source = await engine.createSource();
        await source.setPixelsFromUrl(imageUrl);

        // 创建滤镜
        const filters = await engine.createFiltersByZip(zipDataBuffer);

        // 创建图层
        const layer = await engine.createLayer();
        await layer.setSource(source);
        await Promise.all(filters.map(async(filter) => {
            await layer.addEffect(filter);
        }));

        await engine.addLayer(layer);

        // 创建目标视图
        const target = await engine.createTarget('canvasId', 500, 500);
        await engine.prepare(target);

        engine.submit(0);
    });

如何编译

安装 emsdk

可以参考 emscripten 的官方文档

本项目开发使用版本为 1.39.19


git clone https://github.com/emscripten-core/emsdk.git

cd emsdk

./emsdk install 1.39.19

source /env/emsdk_env.sh

注意: emsdk 在安装时会从 googlesource 上下载版本镜像,所以最好设置 HTTP_PROXY 进行翻墙与加速

安装依赖项

yarn install

编译 webassembly

yarn build:sdk

编译 sdk

yarn buid

运行单元测试

yarn test

运行 demo

···bash yarn dev ···