All Projects → dy → bitmap-sdf

dy / bitmap-sdf

Licence: other
Calculate SDF for image/bitmap/bw data

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to bitmap-sdf

Pilosa
Pilosa is an open source, distributed bitmap index that dramatically accelerates queries across multiple, massive data sets.
Stars: ✭ 2,224 (+8796%)
Mutual labels:  bitmap
Signed
Signed is a 3D modeling and construction language based on Lua and SDFs. Signed will be available for macOS and iOS and is heavily optimized for Metal.
Stars: ✭ 90 (+260%)
Mutual labels:  sdf
cocoa-close-pixelate
Cocoa port of https://github.com/desandro/close-pixelate
Stars: ✭ 47 (+88%)
Mutual labels:  bitmap
Steganography
Least Significant Bit Steganography for bitmap images (.bmp and .png), WAV sound files, and byte sequences. Simple LSB Steganalysis (LSB extraction) for bitmap images.
Stars: ✭ 229 (+816%)
Mutual labels:  bitmap
CQULogo
重庆大学视觉标识素材包 --- Visual Identification Bundle of Chongqing University
Stars: ✭ 55 (+120%)
Mutual labels:  bitmap
AsciiMap
Creates ASCII Art from Bitmaps
Stars: ✭ 21 (-16%)
Mutual labels:  bitmap
Ezfilter
A lightweight (<180KB), easy-to-extend Android filter and dynamic sticker framework for adding filters and stickers for camera, video, bitmap and view.(一个轻量级(<180KB)、易扩展的Android滤镜和动态贴纸框架,支持摄像头、视频、图片和视图添加滤镜和贴纸。)
Stars: ✭ 155 (+520%)
Mutual labels:  bitmap
aframe-bmfont-text-component
A-Frame component for rendering bitmap fonts.
Stars: ✭ 62 (+148%)
Mutual labels:  sdf
Doramon
个人工具汇总:一致性哈希工具,Bitmap工具,布隆过滤器参数生成器,Yaml和properties互转工具,一键式生成整个前后端工具,单机高性能幂等工具,zookeeper客户端工具,分布式全局id生成器,时间转换工具,Http封装工具
Stars: ✭ 53 (+112%)
Mutual labels:  bitmap
netsuite-suitecloud-sdk
SuiteCloud Software Development Kit (SuiteCloud SDK) are the set of tools that allow you to customize accounts and create SuiteApps through SuiteCloud Development Framework (SDF).
Stars: ✭ 140 (+460%)
Mutual labels:  sdf
Cherry
another bitmap font
Stars: ✭ 244 (+876%)
Mutual labels:  bitmap
torch-ngp
A pytorch CUDA extension implementation of instant-ngp (sdf and nerf), with a GUI.
Stars: ✭ 1,317 (+5168%)
Mutual labels:  sdf
pixi-sdf-text
Signed distance field text implementation for PixiJS
Stars: ✭ 89 (+256%)
Mutual labels:  sdf
Resourcelib
C# File Resource Management Library
Stars: ✭ 197 (+688%)
Mutual labels:  bitmap
FastBitmap
A fast C# Bitmap wrapping layer
Stars: ✭ 86 (+244%)
Mutual labels:  bitmap
Signatureview
SignatureView is an open source Android library which allow developers to produce pen and paper like effect for creating signatures on Android
Stars: ✭ 185 (+640%)
Mutual labels:  bitmap
neurecon
Multi-view 3D reconstruction using neural rendering. Unofficial implementation of UNISURF, VolSDF, NeuS and more.
Stars: ✭ 697 (+2688%)
Mutual labels:  sdf
AvatarImageGenerator
Android library to generate image avatar from the first letter of a username. Letter avatar like Gmail Android best practice
Stars: ✭ 61 (+144%)
Mutual labels:  bitmap
BMPtoArray
Python script to convert a bitmap to an Arduino prog_mem array for outputting grayscale images to OLEDs.
Stars: ✭ 25 (+0%)
Mutual labels:  bitmap
Unity-MSDF-Fonts
Basic tool to convert Unity fonts to use Multichannel Signed Distance Field fonts
Stars: ✭ 54 (+116%)
Mutual labels:  sdf

bitmap-sdf unstable

Calculate signed distance field for an image / bw-data. Fork of tiny-sdf with reduced API.

bitmap-sdf

Demo

Usage

npm install bitmap-sdf

let calcSdf = requrie('bitmap-sdf')

//draw image
let canvas = document.body.appendChild(document.createElement('canvas'))
let w = canvas.width = 200, h = canvas.height = 200
let ctx = canvas.getContext('2d')
ctx.fillStyle = 'white'
ctx.font = 'bold 30px sans-serif'
ctx.fillText('X', 20, 20)

//calculate distances
let distances = calcSdf(canvas)

//show distances
let imgArr = new Uint8ClampedArray(w*h*4)
for (let i = 0; i < w; i++) {
	for (let j = 0; j < h; j++) {
		imgArr[j*w*4 + i*4 + 0] = arr[j*w+i]*255
		imgArr[j*w*4 + i*4 + 1] = arr[j*w+i]*255
		imgArr[j*w*4 + i*4 + 2] = arr[j*w+i]*255
		imgArr[j*w*4 + i*4 + 3] = 255
	}
}
var data = new ImageData(imgArr, w, h)
ctx.putImageData(data, 0, 0)

dist = calcSdf(source, options?)

Calculate distance field for the input source data, based on options. Returns 1-channel array with distance values from 0..1 range.

Source:

Type Meaning
Canvas, Context2D Calculates sdf for the full canvas image data based on options.channel, by default 0, ie. red channel.
ImageData Calculates sdf for the image data based on options.channel
Uint8ClampedArray, Uint8Array Handles raw pixel data, requires options.width and options.height. Stride is detected from width and height.
Float32Array, Array Handles raw numbers from 0..1 range, requires options.width and options.height. Stride is detected from width and height.

Options:

Property Default Meaning
cutoff 0.25 Cutoff parameter, balance between SDF inside 1 and outside 0 of glyph
radius 10 Max length of SDF, ie. the size of SDF around the cutoff
width canvas.width Width of input data, if array
height canvas.height Height of input data, if array
channel 0 Channel number, 0 is red, 1 is green, 2 is blue, 3 is alpha.
stride null Explicitly indicate number of channels per pixel. Not needed if height and width are provided.

See also

Alternatives

License

(c) 2017 Dima Yv. MIT License

Development supported by plot.ly.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].