1.0.1 • Published 1 year ago

@9am/img-victor v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Demo

Usage

  1. Installation

    npm install @9am/img-victor
  2. ESM

    import { register } from '@9am/img-victor';
    register({/* options */})
    
    // html
    <img-victor src="/img.png"></img-victor>

Documentation

Attributes

NameTypeDefaultDescription
src{String}Required if data-src unsetThe image URL
data-src{String}Required if src unsetThe lazy-loading src
title{String}''For screen readers
ratio{String}'1:1'${width}:${height} to prevent reflow before iamge loading
manual{Boolean}falseWhen manual is true, img-victor will not draw automatically, it could be done by toggle the className active

CSS property

NameTypeDefaultDescription
--victor-strokecss \dimgraysvg path stroke color
--victor-stroke-widthcss \0.3%svg path stroke width
--victor-stroke-linecap{butt\|round\|square\|inherit}roundsvg path stroke linecap
--victor-stroke-linejoin{arcs\|bevel\|miter\|miter-clip\|round}roundsvg path stroke linejoin
--victor-durationcss <transition-duration>3200mstransition duration
--victor-timing-functioncss <transition-timing-function>ease-in-outtransition timing function
--victor-filtercss <filter>custom brushpath filter

Register Options

NameTypeDefaultDescription
tagName{String}img-victorChange tag name of the web component
worker{Worker}LSD workerThe worker plugin.1. Write your own worker.js like:onmessage({ data:ImageData }) => postMessage([, groupOfLines])2. Using a faster version LSD worker, example can be found in index.htmlNotice: you need to bundle and serve fastWorker.js and fastWorker.wasm.
poolSize{Number}2Worker pool size

Development

  1. Install dependencies

    npm install

  2. Install emcc

    emscripten.org

  3. Build worker

    npm run build:all

  4. Start dev server

    npm run dev

  5. Put images under ./demo/img, replace image URL in index.html

  6. Open localhost:3000 in browser

References

The LSD worker in this component is compiled from the C version of LSD: a Line Segment Detector Rafael Grompone von Gioi, Jérémie Jakubowicz, Jean-Michel Morel, Gregory Randall by Emscripten.

License

MIT

1.0.1

1 year ago

1.0.0

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago